ExpressionEngine Developer Performance Toolbar

I recently saw a tweet in the #eecms hashtag linking to an older article from Rob at Bluedreamer entitled 'ExpressionEngine - measuring performance during development'. I thought I would share with you my version of this developer toolbar as I call it.

Silly Performance Visual Metaphor
Silly Visual Metaphor for Performance

Variables

The following are the variables I choose to display but there are plenty more available in the ExpressionEngine Docs that you may find appropriate also.

{total_queries}
The total number of database queries used to generate the current page.

{elapsed_time}
The amount of time, in seconds, it took ExpressionEngine to render the current page.

{memory_usage}
Not in docs currently but added in EE Version 2.2.1

{exp:stats}
ExpressionEngine Statistics Module

{total_guests}
The total number of people currently using the system that are not logged in as members.

{member_names}
Currently logged in users

Template Code

{if member_group == "1" OR member_group == "4"}
<div id="devbar">
    <p>Queries: <strong>{total_queries}</strong> | Elapsed Time: <strong>{elapsed_time}</strong> | Memory Used: <strong>{memory_usage}</strong> | {exp:stats}Guests: <strong>{total_guests}</strong>  | Total Logged In: <strong>{total_logged_in}</strong><br />Members: {member_names}<strong>{name}</strong>, {/member_names} {/exp:stats}</p>
</div>
{/if} 

The code can live in a Snippet or in your footer template just before the closing body tag. I use an advanced conditional to only show the toolbar to SuperAdmins who by default have a Member Group ID of 1 and my site Editor/Admin group which in my example has an ID of 4

I usually give my ExpressionEngine Developer Toolbar a high contrast style

#devbar {
    background: #FFE203;
    margin: 0 auto;
    padding: 0;
}

#devbar p {
    font-family:Helvetica,Arial,sans-serif;
    font-size:12px;
    line-height:1.5;
    color: #000000;
    padding: 10px;
}

Original article by Rob from BlueDreamer, ExpressionEngine - measuring performance during development

As an alternative if you want something more full featured then check out the EE Debug Toolbar by Eric Lamb.

I invite any additions or improvements to this. It’s simple stuff really but helpful when you are mindful of performance when developing in ExpressionEngine. If you are not then you should be