Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: trace_processor/experimental/mappers/scheduling/map_wake_ups.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2015 The Chromium Authors. All rights reserved. 3 Copyright 2015 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/perf_insights/mre/function_handle.html"> 8 <link rel="import" href="/perf_insights/mre/function_handle.html">
9 <link rel="import" href="/tracing/base/range.html"> 9 <link rel="import" href="/tracing/base/range.html">
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 // Estimate number of times the CPU was woken up from idle to execute 45 // Estimate number of times the CPU was woken up from idle to execute
46 // different types of work (e.g., timer work) and the time the CPU had been 46 // different types of work (e.g., timer work) and the time the CPU had been
47 // idle before that. 47 // idle before that.
48 // See https://goo.gl/l7V5xg. 48 // See https://goo.gl/l7V5xg.
49 function findWakeUpsOnThread(thread) { 49 function findWakeUpsOnThread(thread) {
50 var wakeUps = {}; 50 var wakeUps = {};
51 var foundWakeUps = false; 51 var foundWakeUps = false;
52 var lastTaskEnd = undefined; 52 var lastTaskEnd = undefined;
53 thread.iterateAllEvents(function(event) { 53 for (var event of thread.getDescendantEvents()) {
54 if (!event.isTopLevel) 54 if (!event.isTopLevel)
55 return; 55 continue;
56 var taskEnd = event.start + event.duration; 56 var taskEnd = event.start + event.duration;
57 if (lastTaskEnd === undefined) { 57 if (lastTaskEnd === undefined) {
58 lastTaskEnd = taskEnd; 58 lastTaskEnd = taskEnd;
59 return; 59 continue;
60 } 60 }
61 var sleepTime = event.start - lastTaskEnd; 61 var sleepTime = event.start - lastTaskEnd;
62 var isWakeUp = sleepTime >= IDLE_THRESHOLD_MILLISECONDS; 62 var isWakeUp = sleepTime >= IDLE_THRESHOLD_MILLISECONDS;
63 lastTaskEnd = taskEnd; 63 lastTaskEnd = taskEnd;
64 if (!isWakeUp) 64 if (!isWakeUp)
65 return; 65 continue;
66 var reason = sanitizeReason(findWakeUpReason(event)); 66 var reason = sanitizeReason(findWakeUpReason(event));
67 if (wakeUps[reason] === undefined) 67 if (wakeUps[reason] === undefined)
68 wakeUps[reason] = {frequency: 0, sleepTimes: []}; 68 wakeUps[reason] = {frequency: 0, sleepTimes: []};
69 wakeUps[reason].frequency++; 69 wakeUps[reason].frequency++;
70 wakeUps[reason].sleepTimes.push(sleepTime); 70 wakeUps[reason].sleepTimes.push(sleepTime);
71 foundWakeUps = true; 71 foundWakeUps = true;
72 }); 72 }
73 return foundWakeUps ? wakeUps : undefined; 73 return foundWakeUps ? wakeUps : undefined;
74 } 74 }
75 75
76 function updateThreadWakeUps(existingWakeUps, newWakeUps) { 76 function updateThreadWakeUps(existingWakeUps, newWakeUps) {
77 for (var reason in newWakeUps) { 77 for (var reason in newWakeUps) {
78 if (!(reason in existingWakeUps)) { 78 if (!(reason in existingWakeUps)) {
79 existingWakeUps[reason] = newWakeUps[reason]; 79 existingWakeUps[reason] = newWakeUps[reason];
80 continue; 80 continue;
81 } 81 }
82 existingWakeUps[reason].frequency += newWakeUps[reason].frequency; 82 existingWakeUps[reason].frequency += newWakeUps[reason].frequency;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 result.addPair('wakeUps', allWakeUps); 122 result.addPair('wakeUps', allWakeUps);
123 } 123 }
124 124
125 pi.FunctionRegistry.register(mapWakeUps); 125 pi.FunctionRegistry.register(mapWakeUps);
126 126
127 return { 127 return {
128 mapWakeUpsForTest: mapWakeUps 128 mapWakeUpsForTest: mapWakeUps
129 }; 129 };
130 }); 130 });
131 </script> 131 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698