OLD | NEW |
---|---|
(Empty) | |
1 <!-- Copyright 2017 The Chromium Authors. All rights reserved. | |
2 Use of this source code is governed by a BSD-style license that can be | |
3 found in the LICENSE file. | |
4 --> | |
5 | |
6 # CPU Time MultiDimensionalView Explainer | |
7 | |
8 This document explains the MultiDimensionalView returned by `constructMultiDimen sionalView` in `cpuTime.html`. | |
9 | |
10 The returned MultiDimensionalView in TopDownTreeView mode. It is three | |
tdresser
2017/04/10 20:48:29
I think this sentence missing a word?
dproy
2017/05/11 00:50:46
Was missing 'is'. Fixed.
| |
11 dimensional (processType, threadType, and railStage + initiator). Rail stage and | |
12 initiator are not separate dimensions because they are not independent - there | |
13 is no such thing as CSS Response or Scroll Load. | |
14 | |
15 Each node in the tree view contains two values - cpuUsage and cpuTotal. | |
16 | |
17 When talking about multidimensional tree views, a useful abstration is "path", | |
18 which uniquely determines a node in the tree: A path is a 3 element array, and | |
19 each of these three elements is a possibly empty array of strings. Here is an | |
20 example path: | |
21 [ ['browser_process'], ['CrBrowserMain'], ['Animation', 'CSS'] ] | |
22 Dimension 1 Dimension 2 Dimension 3 | |
23 | |
24 We can arrive at the node denoted by this path in many different ways starting | |
25 from the root node, so this path is not to be confused with the graph theoretic | |
26 notion of path. Here is one of the ways to reach the node (we show the | |
27 intermediate paths during the traversal inline): | |
28 | |
29 ```javascript | |
30 const node = treeRoot // [[], [], []] | |
31 .children[0] // access children along first dimension | |
32 .get('browser_process') // [['browser_process'], [], []] | |
33 .children[2] // access children along third dimension | |
34 .get('Animation') // [['browser_process'], [], ['Animation']] | |
35 .children[1] // Access children along second dimension | |
36 .get('CrBrowserMain') // [['browser_process'], ['CrBrowserMain'], ['Animation ']] | |
37 .children[2] // Go further down along third dimension | |
38 .get('CSS') // [['browser_process'], ['CrBrowserMain'], ['Animation', 'CSS']] | |
39 ``` | |
40 Now node.values contains the cpu time data for the browser main thread during | |
41 the CSS Animation stage: | |
42 - `node.values[0]` is `cpuUsage` - cpu time over per unit of wall clock time | |
43 - `node.values[1]` is `cpuTotal` - total miliseconds of used cpu time | |
44 | |
45 The path for the node that hold data for all threads of renderer process | |
46 during scroll response expectations is `[['renderer_process'], [], ['Response', 'Scroll']]`. | |
47 | |
48 As we can see, we simply have an empty array for the second dimension. This | |
49 works similarly if we want to get data for all processes for a particular | |
50 thread. | |
51 | |
52 However, if we want to access data for all rail stages and all initiator | |
53 types, we have to use the special rail stage `all_stages`, and initiator | |
54 type `all_initiators`. For example, to get cpu data during all Response | |
55 stages for all processes and threads, we use the node at path | |
56 `[[], [], ['Response', 'all_initiators']]` | |
57 | |
58 To get cpu data for all rail stages for ChildIOThread, we use the path | |
59 `[[], ['ChildIOThread'], ['all_stages', 'all_initiators']]` | |
60 | |
61 This is because the tree view automatically aggregates cpu time | |
62 data along each dimension by summing values on the children nodes. For | |
63 aggregating rail stages and initiator types, summing is not the right thing | |
64 to do since | |
65 | |
66 1. User Expectations can overlap (for example, one tab can go through a | |
67 Video Animation while another tab is concurrently going through a CSS | |
68 Animation - it's worth noting that user expectations are not scoped to a | |
69 tab.) | |
70 | |
71 2. Different rail stages have different durations (for example, if we | |
72 have 200ms of Video Animation with 50% cpuUsage, and 500ms of CSS | |
73 Animation with 60% cpuUage, cpuUsage for all Animations is clearly not | |
74 110%.) | |
75 | |
76 We therefore more manually do the appropriate aggregations and store the | |
77 data in `all_stages` and `all_initiators` nodes. | |
OLD | NEW |