New issue
Advanced search Search tips

Issue 663239 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

CPU usage graph is unclear and seems to depend on events from selected categories

Project Member Reported by carlosk@chromium.org, Nov 8 2016

Issue description

While running some traces to track CPU usage for Offline Page Cache I tried to obtain information from the CPU usage graph in traces. But it was especially hard to do so because of a couple of issues:

1) One has no idea of the scale and values presented in the CPU Usage graph. Contrary to almost all other graphs hovering the mouse cursor over it does not present the actual values. In fact I can't even be sure of what it is actually measuring, if it covers all CPU cores, and what is its scale range (0% to 100%?).

2) It seems like the graph will only report values from periods of time when there are active events. This is really a guess but is based on a simple experiment: trace the same action twice, the first with a couple of categories enabled and the second with all "default" categories enabled.

See attached picture for the very different results seen side-by-side. These traces were collected for a navigation to a YouTube video page [1], the left one only with "page-serialization" and "navigation" enabled and the right one with all defaults. The selected period highlights the execution of known CPU bound activities that should be reflected in CPU usage but are not in the left case.

I can provide the actual trace files if needed.

Note: this test was run on Android but I see the exact same happening on my Linux desktop (so setting OS to "All").


[1] https://www.youtube.com/watch?v=3KANI2dpXLw

 
cpu-usage-graph-side-by-side-comparison.png
196 KB View Download
PS: I selected a lot of tracing-named components as I am not sure of the correct one for this problem. Please trim down as needed.
Cc: charliea@chromium.org
Owner: alph@chromium.org
Status: Assigned (was: Untriaged)
Looks like tracing issue. @alph, could you take a look and forward it if needed?
Unfortunately, this is working as intended, but I agree that it's confusing behavior. The CPU metric basically uses the CPU time of all collected trace events to come up with the most accurate CPU usage graph possible. Because of this, it basically means that collecting more trace events will give strictly higher CPU usage, and collecting no trace events will indicate 0 CPU usage.

Comment 5 by alph@chromium.org, Nov 23 2016

Cc: -charliea@chromium.org
Components: -Platform>DevTools>Tracing -Platform>DevTools>Performance>Tracing
Owner: charliea@chromium.org
Looks like a trace-viewer issue. Nothing to do with DevTools.
Do you have suggestions for how this could be improved to be clearer? This graph represents the CPU usage as estimated via trace events that have been recorded in the trace. By definition, the more categories that you trace, the more data you'll have to flesh out that number. From my understanding, adding the "toplevel" category *should* be sufficient for getting all relevant CPU use slices.
Components: Speed>Tracing
Components: -Internals>Tracing
My suggestions might be biased to my specific use case but they are (in decreasing priority order):

1) Provide a scale to the CPU graph: does it go from 0 to 100 % CPU usage? Without this information I can't asses what it anything plotted there represents and it becomes a meaningless graph.

2) Do full CPU usage recording independent of selected categories. I would think that when one is looking at that graph it's more useful to be able to compare what's being traced against all the rest than to only itself.

I think that 

"2) Do full CPU usage recording independent of selected categories. I would think that when one is looking at that graph it's more useful to be able to compare what's being traced against all the rest than to only itself."

 is the clear best solution, but the tricky part is understanding *how* we do that. Essentially, our instantaneous CPU use graph comes from instrumenting as many entry points to Chrome code as we can possibly find. In theory, the "toplevel" category is exactly what you're asking for, but we don't have a whole lot of confidence that we've actually identified all of Chrome's entry points. We've instrumented some of the big ones (e.g. MessageLoop::RunTask), but what about smaller ones, like when Chrome registers a callback with a system call? Right now, we don't have any means to verify that Chrome's purported CPU usage is accurate, and if there's anything we've realized since we set out in the benchmarking space, it's that if you're not measuring something, it's probably not doing what you want it to.
Owner: ----
Status: Available (was: Assigned)
Marking this as available given the fact that I don't focus on power/CPU anymore.

Sign in to add a comment