OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="profiler-test.js"></script> | 4 <script src="profiler-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function test() | 7 function test() |
8 { | 8 { |
9 var profileAndExpectations = { | 9 var profileAndExpectations = { |
10 _profile: { | 10 _profile: { |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 "id": 1 | 924 "id": 1 |
925 }, | 925 }, |
926 "startTime": 1384977392.3568, | 926 "startTime": 1384977392.3568, |
927 "endTime": 1384977392.5345, | 927 "endTime": 1384977392.5345, |
928 "samples": [2,16,21,26,35,36,37,2,2,2,2,2,2,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37 ,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,48,52,52,61,2,37,37,37,37,37 ,37,37] | 928 "samples": [2,16,21,26,35,36,37,2,2,2,2,2,2,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37 ,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,48,52,52,61,2,37,37,37,37,37 ,37,37] |
929 } | 929 } |
930 }; | 930 }; |
931 var profile = profileAndExpectations._profile; | 931 var profile = profileAndExpectations._profile; |
932 var startTime = profile.startTime * 1000; | 932 var startTime = profile.startTime * 1000; |
933 var endTime = profile.endTime * 1000; | 933 var endTime = profile.endTime * 1000; |
934 profile.nodes = flattenNodes(profile.head); | |
934 profile.startTime /= 1000; | 935 profile.startTime /= 1000; |
935 profile.endTime /= 1000; | 936 profile.endTime /= 1000; |
936 var samplingInterval = (endTime - startTime) / (profile.samples.length - 1); | 937 var samplingInterval = (endTime - startTime) / (profile.samples.length - 1); |
937 profile.timestamps = []; | 938 profile.timestamps = []; |
938 for (var i = 0; i < profile.samples.length; ++i) | 939 for (var i = 0; i < profile.samples.length; ++i) |
939 profile.timestamps.push(startTime + i * samplingInterval); | 940 profile.timestamps.push(startTime + i * samplingInterval); |
940 profileAndExpectations.target = function() {}; | 941 profileAndExpectations.target = function() {}; |
941 profileAndExpectations.weakTarget = function() { return new WeakReference(nu ll);}; | 942 profileAndExpectations.weakTarget = function() { return new WeakReference(nu ll);}; |
942 var cpuProfileView = new WebInspector.CPUProfileView(profileAndExpectations) ; | 943 var cpuProfileView = new WebInspector.CPUProfileView(profileAndExpectations) ; |
943 cpuProfileView.viewSelectComboBox.setSelectedIndex(0); | 944 cpuProfileView.viewSelectComboBox.setSelectedIndex(0); |
944 cpuProfileView._changeView(); | 945 cpuProfileView._changeView(); |
945 var overviewPane = cpuProfileView._flameChart._overviewPane; | 946 var overviewPane = cpuProfileView._flameChart._overviewPane; |
946 console.log(Object.values(overviewPane._calculateDrawData(16))); | 947 console.log(Object.values(overviewPane._calculateDrawData(16))); |
947 console.log(Object.values(overviewPane._calculateDrawData(8))); | 948 console.log(Object.values(overviewPane._calculateDrawData(8))); |
948 console.log(Object.values(overviewPane._calculateDrawData(4))); | 949 console.log(Object.values(overviewPane._calculateDrawData(4))); |
949 console.log(Object.values(overviewPane._calculateDrawData(2))); | 950 console.log(Object.values(overviewPane._calculateDrawData(2))); |
950 console.log(Object.values(overviewPane._calculateDrawData(1))); | 951 console.log(Object.values(overviewPane._calculateDrawData(1))); |
951 InspectorTest.completeTest(); | 952 InspectorTest.completeTest(); |
953 | |
954 function flattenNodes(node) | |
955 { | |
956 var childrenIds = node.children.map(n => n.id); | |
957 var result = node.children.reduce((res, n) => res.concat(flattenNodes(n) ), [node]); | |
958 node.children = childrenIds; | |
959 return result; | |
960 } | |
952 } | 961 } |
953 | 962 |
954 </script> | 963 </script> |
955 </head> | 964 </head> |
956 <body onload="runTest()"> | 965 <body onload="runTest()"> |
957 <p> | 966 <p> |
958 Tests Overview pane calculation in FlameChart for different width = 2^n with n i n range 4 - 0. | 967 Tests Overview pane calculation in FlameChart for different width = 2^n with n i n range 4 - 0. |
959 | 968 |
960 </p> | 969 </p> |
961 </body> | 970 </body> |
962 </html> | 971 </html> |
OLD | NEW |