Filtering profiles

You choose which data in the selected set of profiles to display with filters.

Each filter is specified by a predefined FILTER-OPTION that is paired with a user-defined VALUE:


The filters being used are displayed in the filter bar as filter chips. Each filter chip displays the filter option, the filter value, and a Close close button. In this example, there is one filter chip that displays Metric : Bytes:

Show a filter chip.

Profiler automatically creates a filter chip with a FILTER-OPTION of Metric and a VALUE based on your selected profile type. You can change VALUE for some profile types. You cannot remove this filter chip.

To add a filter, use one of the following approaches:

  • Click Filters , select an option from the list, and then enter the value.
  • Click the gray text Add profile data filter in the filter bar, and then enter the filter option and value.
  • For the Focus, Show from frame, and Show stacks filter options, you can also place your pointer on the frame, and then select the option from the frame tooltip.

To remove a filter, click Close on the filter chip.

When preparing the data to display, Profiler searches for matches between a frame and a filter. When a match occurs Profiler uses the FILTER-OPTION to determine what action to execute. A frame matches the filter when the frame's function name or the function's source file name contains VALUE. A case-sensitive comparison is performed. For example, if the filter is Hide frames : oo, then frames with functions named foo, foo1, and busyloop match are hidden from the flame graph.


To set the profile type aggregation mode, use the Metric filter. For example, if you select a Heap profile type, you have the choice between visualizing the data in terms of Bytes and Objects.

The choices available for the Metric filter depend on the programming language and the selected Profile type:

  • For CPU time profiles, the only choice is CPU time.
  • For Heap profiles, the choices are:

    • Bytes
    • Objects
  • For Allocated Heap profiles, the choices are:

    • Total alloc bytes
    • Total alloc objects
  • For Wall time profiles, the choices are:

    • Count
    • Wall time
  • For Threads profiles, the only choice is Goroutine.

  • For Contention profiles, the choices are:

    • Delay
    • Contentions

For more information about types of profiling metrics, see Profiling concepts.

For example, the following screenshot shows the CPU consumption of a program:

Profiler graph for CPU usage

Here, you can see that the busyloop routine calls foo1 and foo2, both of which call various other routines. You can use additional filters to further restrict the graph only to the data of interest.


When you use the Focus filter, you select a single function and the flame graph displays all of the code paths that flow into, and out of, that specific function.

For details how to focus the graph and interpret the results, go to Focusing the graph.

Show stacks

To display all call stacks that contain a frame that matches the filter value and to hide all other call stacks, use the Show stacks filter. The graph shows the callers and callees of the function, that is, everything that calls the matching function, and everything it calls.

To restrict the CPU-usage graph from the previous example to show only the call stacks that involve the function foo1, set a Show stacks filter for foo1:

Profiler graph for CPU usage filtered with show stacks

In this case, the call stacks involving foo1 account for 59% of the CPU usage.

Hide stacks

Hide all call stacks that contain a frame that matches the filter value. This filter is often useful Wording for migration dialog box (Sam)when you want to hide uninteresting stacks. For example, with Java applications, adding a Hide stacks: unsafe.park filter is common.

Show from frame

To display all call stacks, starting from the frame that matches the filter value and to hide all other call stacks, use the Show from frame filter. The resulting graph shows the call stacks from the named function down. This filter is useful if your function is called from many places, and you want to see the total consumption attributable to it.

For example, to only show calls originating from the baz function, set a Show from frame filter for baz:

Profiler graph for CPU usage filtered with show from frame

Hide frames

To hide from view all frames that match the filter value use the Hide frames filter. The graph shows the callers of the function, and any callees of the function are collected together. This is useful for removing irrelevant frames from the graph.

For example, to hide the frames for both foo1 and foo2, set a Hide frames filter for foo. Both foo1 and foo2 match, so both are removed from the graph. Because both of them call the bar and baz routines, the data for each of those is aggregated together.

Profiler graph for CPU usage filtered with hide frames


To highlight all frames whose function names matches the filter value, use the Highlight filter. The function remains in normal color mode, but the call sequences are colored in more subdued tones.

For example, here is a graph with no highlighting:

Profiling graph with no highlighting

Here's the same graph with highlighting requested for the baz function:

Profiling graph with highlighting

Color mode

By default, the frame color corresponds, where possible, to the function's package. If package information is unavailable, as with Node.js, the names of the source files are used to color the function blocks. With the default setting, a change in a call stack frame color means a transition from one package to another. The default option corresponds to the Color mode filter with a value of Name.

To color the frames in the flame graph by the consumption of a function and its children, add a Color mode filter with the value of Total. If a function is called through multiple call stacks, the color is determined by the metric consumption for all call stacks. For example, the main, busyloop and load frames are colored red, the foo1 frame is orange, and the baz, bar, and foo2 frames are light orange. This flame graph illustrates that foo1 has a higher metric consumption than foo2, but a lower metric consumption than load:

Color mode total

To color the frames in the flame graph by the function's metric consumption but exclude the metric consumption of its children, add a Color mode filter with the value of Self. For example, this filter shows that the load function consumes the majority of the CPU time:

Color mode self

What's next

Kunde den här sidan hjälpa dig? Berätta:

Skicka feedback om ...

Stackdriver Profiler
Behöver du hjälp? Besök vår supportsida.