Quelle stackcollapse-chrome-tracing.py
Sprache: Python
#!/usr/bin/python # # stackcolllapse-chrome-tracing.py collapse Trace Event Format [1] # callstack events into single lines. # # [1] https://github.com/catapult-project/catapult/wiki/Trace-Event-Format # # USAGE: ./stackcollapse-chrome-tracing.py input_json [input_json...] > outfile # # Example input: # # {"traceEvents":[ # {"pid":1,"tid":2,"ts":0,"ph":"X","name":"Foo","dur":50}, # {"pid":1,"tid":2,"ts":10,"ph":"X","name":"Bar","dur":30} # ]} # # Example output: # # Foo 20.0 # Foo;Bar 30.0 # # Input may contain many stack trace events from many processes/threads. # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at docs/cddl1.txt or # http://opensource.org/licenses/CDDL-1.0. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at docs/cddl1.txt. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # 4-Jan-2018 Marcin Kolny Created this. import argparse import json
for e in events: ifnot event_stack:
event_stack.append(e) else: while event_stack and event_stack[-1].get_stop_timestamp() <= e.timestamp:
save_stack(event_stack)
event_stack.pop()
if event_stack:
event_stack[-1].total_duration -= e.duration
event_stack.append(e)
while event_stack:
save_stack(event_stack)
event_stack.pop()
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.