Add more Russian replay performance tests
[WebKit-https.git] / PerformanceTests / inspector / native-memory-snapshot.html
1 <html>
2 <head>
3   <style type="text/css">
4     span {
5       color:red;
6       width: 100px;
7       height: 20px;
8     }
9     div {
10       color:blue;
11       width: 50px;
12       height: 10px;
13     }
14   </style>
15   <script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
16   <script src="performance-test.js"></script>
17 <script>
18
19 function test()
20 {
21     function performanceTest(timer)
22     {
23         var testName = /([^\/]+)\.html$/.exec(WebInspector.inspectedPageURL)[1];
24         var takeTimerCookie = timer.start("take");
25         MemoryAgent.getProcessMemoryDistribution(dump);
26
27         function dump(e, data)
28         {
29             timer.finish(takeTimerCookie);
30             function reportSize(data)
31             {
32                 timer.reportSize(data.name, data.size);
33                 if (data.children) {
34                     for (var i = 0; i < data.children.length; ++i)
35                         reportSize(data.children[i]);
36                 }
37             }
38             reportSize(data);
39             var knownSize = 0;
40             for (var i = 0; i < data.children.length; ++i)
41                 knownSize += data.children[i].size;
42             timer.reportSize("Unknown", data.size - knownSize);
43             timer.done(testName);
44         }
45     }
46
47     InspectorTest.runPerformanceTest(performanceTest, 2000);
48 }
49
50 function createDOMTree(elementsCount)
51 {
52     var root = document.getElementById("testTreeRoot");
53
54     for (var i = 0; i < elementsCount; ++i) {
55         var span = document.createElement("span");
56         span.id = "span_" + i;
57         span.style.width = "10px";
58         root.appendChild(span);
59     }
60
61     for (var i = 0; i < elementsCount; ++i)
62         root.appendChild(document.createElement("div"));
63
64     for (var i = 0; i < elementsCount; ++i)
65         root.appendChild(document.createElement("a"));
66 }
67
68 setTimeout(createDOMTree.bind(null,1000), 0);
69
70 </script>
71 </head>
72 <body onload="runTest()">
73   <div id="testTreeRoot">
74   </div>
75 </body>
76 </html>