

# Filtering visualization data
<a name="working-with-visualizations-filtering"></a>

This section contains information about how to filter profiling data.

**Topics**
+ [Selecting and coloring thread states](working-with-visualizations-thread-states.md)
+ [Hiding a frame](working-with-visualizations-hiding-frame.md)

# Selecting and coloring thread states
<a name="working-with-visualizations-thread-states"></a>

In a visualization view, you can filter profiling data by thread state. You can color thread states inside of stack frames to make it easy to spot how the application is behaving. You can also select which thread states are displayed.

**Note**  
The CPU view and latency view were not supported for first release of Python applications; if you open old Python profiles from before February 2021, the profiling data represents wall clock time percentages for each frame. This is similar to the latency view, without the different thread states and colors. On recent Python profiles the different views work normally.

CPU view – The default thread state view for visualizations, it's useful to try to reduce CPU utilization. It displays frames for thread states that correspond to CPU usage: `RUNNABLE`, `BLOCKED`, and `NATIVE`. In this view, the different shades of coloring simply help with visualization, and are based on the frame names. 

Latency view – Useful to try to improve the latency of all or part of your application. When you select it, the visualization displays frames for all of the thread states except `IDLE`. All of these threads might contribute to latency. Frames in the visualization are colored based on the thread state. 

Custom view – You can choose to select the thread states for frames to include in the visualization. The threads you can select are the ones found in your profile data. You can also choose whether to color the frames based on thread states. 

## Example of differences between CPU view and latency view
<a name="working-with-visualizations-thread-states-example"></a>


****  

| CPU view | Latency view | 
| --- | --- | 
|  ![\[Image: CPU view.\]](http://docs.aws.amazon.com/codeguru/latest/profiler-ug/images/cpu-visualization.png)  |  ![\[Image: Latency view.\]](http://docs.aws.amazon.com/codeguru/latest/profiler-ug/images/latency-visualization.png)  | 

The `callOtherService` function appears smaller in the **CPU** view because it's not showing the time when the thread was in a waiting state. In the **Latency view**, we still see the part where the CPU was active (in red), but we also see when the threads were waiting (in green). 

If you're trying to reduce your CPU usage, the **CPU view** shows you that `localActions` is the most CPU heavy inside `handleServiceCall`, and you might want to optimize this part. 

If you're trying to improve the latency of `handleServiceCall`, the **Latency view** shows you that most of the time is spent in `callOtherService`. You can check if this is expected and try to reduce the number of calls or speed up the execution of calls (for example, caching or batching the requests, or calling a closer AWS Region). 

# Hiding a frame
<a name="working-with-visualizations-hiding-frame"></a>

When you hide a frame, the visualization no longer shows that frame or its callee frames. This is useful when you want to remove certain execution paths from the visualization. For example, you can exclude the `myFunction` function if it's not causing performance issues. All occurrences of that frame in the visualization will be hidden.

**To hide a stack frame while pausing over it**

1. On the **Profiling group detail** page, pause over the frame you want to inspect on the visualization. 

1. Open the context (right-click) menu, and then choose **Hide frame**. 

**To search for stack frames to hide**

1. On the **Profiling group detail** page, choose **Actions**, and then choose **Hide frames**. 

1. In the **Hidden frames** page, specify a search string. As the string is provided, results will automatically update. 

1. Select a stack frame to hide. When you're done, close the **Hidden frames** page.

**To unhide stack frames**

1. Choose **X Hidden frames** in the upper-left corner. It opens the **Hidden frames** menu with the list of already hidden frames. **X** is how many frames are currently hidden. 

1. Choose **Show** on any of the hidden frames to stop hiding it. 