Added ability to import traces from multiple tracers.
The current design of systrace can only process traces from one tracer, atrace.
This change makes it possible to import multiple tracers that can be stored in
the trace.html output. Each trace is now stored as a script tag with class
"trace-data".
This patch also simplifies storing traces in the trace.html output. Instead of
storing traces in a javascript variable, they are now simply stored as scripts
with type "application/text".
Change-Id: I39efd7e1a512fb37f84ff0c7ef6105e13bf1491b
diff --git a/systrace.py b/systrace.py
index bf47c87..da2945a 100755
--- a/systrace.py
+++ b/systrace.py
@@ -253,9 +253,10 @@
html_file.write(
html_prefix.replace("{{SYSTRACE_TRACE_VIEWER_HTML}}", trace_viewer_html))
- # format newlines and double quotes
- # for embedding in double-quoted JS string
- html_file.write(out.replace('\n', '\\n\\\n').replace('\"', '\\\"'))
+ html_file.write('<!-- BEGIN TRACE -->\n' +
+ ' <script class="trace-data" type="application/text">\n')
+ html_file.write(out)
+ html_file.write(' </script>\n<!-- END TRACE -->\n')
html_file.write(html_suffix)
html_file.close()