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

Unified Diff: telemetry/telemetry/value/trace.py

Issue 2619073002: [Telemetry] Change trace_data to hold a list of raw trace data for each trace part (Closed)
Patch Set: Created 3 years, 11 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
Index: telemetry/telemetry/value/trace.py
diff --git a/telemetry/telemetry/value/trace.py b/telemetry/telemetry/value/trace.py
index 8c30c0255cd1773fc02109488daf9c531f220e41..d974ecba938b1799ef4a5fff4256351cfe3ed470 100644
--- a/telemetry/telemetry/value/trace.py
+++ b/telemetry/telemetry/value/trace.py
@@ -46,9 +46,9 @@ class TraceValue(value_module.Value):
return self._serialized_file_handle.GetAbsPath()
def _GetTraceParts(self, trace_data):
- return [(trace_data.GetTraceFor(p), p)
+ return [(trace_data.GetTracesFor(p), p)
for p in trace_data_module.ALL_TRACE_PARTS
- if trace_data.HasTraceFor(p)]
+ if trace_data.HasTracesFor(p)]
@staticmethod
def _DumpTraceToFile(trace, path):
@@ -66,12 +66,14 @@ class TraceValue(value_module.Value):
counter = 0
try:
trace_size_data = {}
- for trace, part in self._GetTraceParts(trace_data):
- file_path = os.path.join(temp_dir, '%s.trace' % counter)
- self._DumpTraceToFile(trace, file_path)
- trace_size_data[part] = os.path.getsize(file_path)
- trace_files.append(file_path)
- counter += 1
+ for traces_list, part in self._GetTraceParts(trace_data):
charliea (OOO until 10-5) 2017/01/12 21:10:17 High-level question: do you know why it's necessar
nednguyen 2017/01/12 21:29:16 We have a thread a long ago with a similar questio
charliea (OOO until 10-5) 2017/01/13 16:36:47 Ned and I talked about this offline, and I was mis
+ for trace in traces_list:
+ file_path = os.path.join(temp_dir, '%s.trace' % counter)
+ self._DumpTraceToFile(trace, file_path)
+ trace_size_data.setdefault(part, 0)
+ trace_size_data[part] += os.path.getsize(file_path)
+ trace_files.append(file_path)
+ counter += 1
logging.info('Trace sizes in bytes: %s', trace_size_data)
tf = tempfile.NamedTemporaryFile(delete=False, suffix='.html')
tf.close()

Powered by Google App Engine
This is Rietveld 408576698