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

Unified Diff: tools/android/loading/tracing.py

Issue 1813723002: clovis: Identify prefetchable resources from dependencies and tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/android/loading/test_utils.py ('k') | tools/android/loading/tracing_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/tracing.py
diff --git a/tools/android/loading/tracing.py b/tools/android/loading/tracing.py
index 7403a9ded6f748200749997b1caeafb9520b3238..8a07a2b8439aa51e4cc9a435706fcbde0c9c8bec 100644
--- a/tools/android/loading/tracing.py
+++ b/tools/android/loading/tracing.py
@@ -91,19 +91,24 @@ class TracingTrack(devtools_monitor.Track):
def ToJsonDict(self):
return {'events': [e.ToJsonDict() for e in self._events]}
- def TracingTrackForThread(self, pid_tid):
- """Returns a new TracingTrack with only the events from a given thread.
+ def Filter(self, pid=None, tid=None, categories=None):
+ """Returns a new TracingTrack with a subset of the events.
Args:
- pid_tid: ((int, int) PID and TID.
-
- Returns:
- A new instance of TracingTrack.
+ pid: (int or None) Selects events from this PID.
+ tid: (int or None) Selects events from this TID.
+ categories: (set([str]) or None) Selects events belonging to one of the
+ categories.
"""
- (pid, tid) = pid_tid
- events = [e for e in self._events
- if (e.tracing_event['pid'] == pid
- and e.tracing_event['tid'] == tid)]
+ events = self._events
+ if pid is not None:
+ events = filter(lambda e : e.tracing_event['pid'] == pid, events)
+ if tid is not None:
+ events = filter(lambda e : e.tracing_event['tid'] == tid, events)
+ if categories is not None:
+ events = filter(
+ lambda e : set(e.category.split(',')).intersection(categories),
+ events)
tracing_track = TracingTrack(None)
tracing_track._events = events
return tracing_track
« no previous file with comments | « tools/android/loading/test_utils.py ('k') | tools/android/loading/tracing_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698