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

Unified Diff: tools/telemetry/telemetry/core/timeline/slice.py

Issue 100073003: telemetry: Add thread time to telmetry timeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-ups Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/timeline/slice.py
diff --git a/tools/telemetry/telemetry/core/timeline/slice.py b/tools/telemetry/telemetry/core/timeline/slice.py
index 5ce2b28a84d9598994979b42073c8a154018065a..26c4dc240d7cabeb950ab4ffe9eeaada1366f1af 100644
--- a/tools/telemetry/telemetry/core/timeline/slice.py
+++ b/tools/telemetry/telemetry/core/timeline/slice.py
@@ -13,10 +13,11 @@ class Slice(timeline_event.TimelineEvent):
All time units are stored in milliseconds.
"""
- def __init__(self, parent_thread, category, name, timestamp,
- args=None, duration=0):
+ def __init__(self, parent_thread, category, name, timestamp, duration=0,
+ thread_timestamp=None, thread_duration=None, args=None):
super(Slice, self).__init__(
- category, name, timestamp, duration, args=args)
+ category, name, timestamp, duration, thread_timestamp, thread_duration,
+ args)
self.parent_thread = parent_thread
self.parent_slice = None
self.sub_slices = []
@@ -39,6 +40,23 @@ class Slice(timeline_event.TimelineEvent):
[e.duration for e in self.sub_slices])
return self.duration - child_total
+ @property
+ def self_thread_time(self):
+ """Thread (scheduled) time spent in this function less any thread time spent
+ in child events. Returns None if the slice or any of its children does not
+ have a thread_duration value.
+ """
+ if not self.thread_duration:
+ return None
+
+ child_total = 0
+ for e in self.sub_slices:
+ if e.thread_duration == None:
+ return None
+ child_total += e.thread_duration
+
+ return self.thread_duration - child_total
+
def _GetSubSlicesRecursive(self):
for sub_slice in self.sub_slices:
for s in sub_slice.GetAllSubSlices():
« no previous file with comments | « tools/telemetry/telemetry/core/timeline/process.py ('k') | tools/telemetry/telemetry/core/timeline/slice_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698