Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / profiler / cpu-profiler-calculate-time.html
blobeb45c3adc91b710a7c97b744ce912ebd87e83339
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="profiler-test.js"></script>
5 <script>
7 function test()
9 // Profile for 1070ms, 2140 samples.
10 var profileAndExpectations = {
11 "head": {
12 "functionName": "(root)",
13 "scriptId": "0",
14 "url": "",
15 "lineNumber": 0,
16 "expectedTotalTime": 1070,
17 "expectedSelfTime": 4,
18 "hitCount": 8,
19 "callUID": 4174152086,
20 "children": [
22 "functionName": "A",
23 "scriptId": "40",
24 "url": "",
25 "lineNumber": 4642,
26 "hitCount": 7,
27 "expectedTotalTime": 1010,
28 "expectedSelfTime": 3.5,
29 "callUID": 1820492223,
30 "children": [
32 "functionName": "Aaa",
33 "scriptId": "40",
34 "url": "",
35 "lineNumber": 5025,
36 "hitCount": 2000,
37 "expectedTotalTime": 1000,
38 "expectedSelfTime": 1000,
39 "callUID": 2901333737,
40 "children": []
43 "functionName": "Bbb",
44 "scriptId": "40",
45 "url": "",
46 "lineNumber": 505,
47 "hitCount": 13,
48 "expectedTotalTime": 6.5,
49 "expectedSelfTime": 6.5,
50 "callUID": 2901333737,
51 "children": []
56 "functionName": "C",
57 "scriptId": "40",
58 "url": "",
59 "lineNumber": 4642,
60 "hitCount": 5,
61 "expectedTotalTime": 56,
62 "expectedSelfTime": 2.5,
63 "callUID": 1820492223,
64 "children": [
66 "functionName": "Ccc",
67 "scriptId": "40",
68 "url": "",
69 "lineNumber": 525,
70 "hitCount": 100,
71 "expectedTotalTime": 50,
72 "expectedSelfTime": 50,
73 "callUID": 2901333737,
74 "children": []
77 "functionName": "Ddd",
78 "scriptId": "41",
79 "url": "",
80 "lineNumber": 55,
81 "hitCount": 7,
82 "expectedTotalTime": 3.5,
83 "expectedSelfTime": 3.5,
84 "callUID": 2901333737,
85 "children": []
91 "idleTime": 202.88199791684747,
92 "startTime": 1375445600.000847,
93 "endTime": 1375445601.070847,
94 "samples": [ 1, 2 ]
96 WebInspector.CPUProfileDataModel.prototype._calculateTimes(profileAndExpectations);
97 function checkExpectations(node)
99 if (Math.abs(node.selfTime - node.expectedSelfTime) > 0.0001) {
100 InspectorTest.addResult("totalTime: " + node.totalTime + ", expected:" + node.expectedTotalTime);
101 return false;
103 if (Math.abs(node.totalTime - node.expectedTotalTime) > 0.0001) {
104 InspectorTest.addResult("totalTime: " + node.totalTime + ", expected:" + node.expectedTotalTime);
105 return false;
107 for (var i = 0; i < node.children.length; i++) {
108 if (!checkExpectations(node.children[i]))
109 return false;
111 return true;
113 if (checkExpectations(profileAndExpectations.head))
114 InspectorTest.addResult("SUCCESS: all nodes have correct self and total times");
115 else
116 InspectorTest.addResult("FAIL: incorrect node times\n" + JSON.stringify(profileAndExpectations, null, 4));
117 InspectorTest.completeTest();
120 </script>
121 </head>
122 <body onload="runTest()">
124 Tests self and total time calculation in CPU profiler.
125 </p>
126 </body>
127 </html>