Timeline: viewing a request’s resources consumption over time

By Nicolas Grekas, on Apr 13, 2017

Blackfire is recognized by many as the tool they need to understand how their code behaves. When it comes to performance, you cannot optimize what you cannot measure. The first use of Blackfire on a code base is most of time a real eye opener that leads to very quick and amazing optimizations. Check out what people say about it!

The call-graph origins

When we first built Blackfire, we opted for a very specific kind of display for profiling results: call-graphs. The main advantage is that such displays give you a lot of context elements and the bigger picture. You can read more about call-graphs in our documentation.

Aggregating information in “nodes” (which represent single function calls, called many times by several “callers” or calling many times several “callees”) enables to track down which part of the code is consuming more resources, but always in relation to others.

For instance, we often get the question: “how do I view only my business logic, not including the frameworks’ stuff?”. Well in many cases, you actually do not want to do that. Your code is dependent on your usage of the framework, and vice-versa. Not displaying how the framework is consuming resources because of your code makes you miss out on a lot of valuable information. We’ve got some stories about that.

Still, we knew that the call-graph view was also not enough in some other use cases.

You may have seen flame-graphs already. This is another typical data visualization for performance measurements. Did you know that the x-axis of flame-graphs is not the passage of time? Flame-graphs are constructed by taking samples of the call stack of a running engine. The wider a frame is, the more often it is present in the stacks at that level. Nothing more. The colors usually mean nothing special.

So, how do you know if this call has been made before that other one? Or if the first call of some function took more time than the other ones of the same function? Because of its aggregating property, the call-graph cannot answer those questions. Neither can a flame-graph.

That’s why we built the timeline.

Meet the Timeline

No text is better than a picture (or a GIF!):

On the x-axis, the timeline represents single function calls at the offset in time where they happened since the beginning of the script execution. On the y-axis, calls are nested in their call stack levels (from top to bottom), so that you can also inspect all parent calls that led to any specific call.

As done for the callgraph, the 1% less significant calls are removed, which makes profiles lighter, thus provides great experience by default.

Using the same metric definitions than we already have to provide you performance recommendations, the timeline also detects special function calls, and groups them by metrics, using colored blocks. This allows to quickly spot them just by looking at the legend. You can also click on the “Filter events” button and keep only the significant colored calls.

Premium and Enterprise users can define their own metrics to be highlighted in the timeline. 

Using our PHP SDK, you can even add markers at any position in the timeline, by calling BlackfireProbe::addMarker('some label') in your code.

The timeline is available to all our customers, starting with the Profiler plan. Start a Premium trial for 15 days, no credit card required.

Let us know what you think, tweet to @blackfireio and mention #timeline!

Happy profiling,

Nicolas Grekas

Nicolas is Blackfire.io's Chief Technology Officer. He studied at ESPCI Paris 12 years ago and holds a MS in physic and chemistry. He also studied entrepreneurship at HEC-Entrepreneurs; a skill he applied immediately as co-founder of the Webistem company, developing SaaS products for the KM area. Active Open-Source contributor in the PHP world since years, he is an active Symfony core-team member.