0
如何使用babeltrace的python reader api打印完整的跟蹤?如何使用babeltrace-python api打印完整的跟蹤事件?
使用下面我可以得到一個事件的字段,但我怎麼能打印完整的跟蹤babeltrace。
import babeltrace
import sys
trace_collection = babeltrace.TraceCollection()
trace_path = sys.argv[1]
trace_collection.add_traces_recursive(trace_path, 'ctf')
for event in trace_collection.events:
print event.timestamp, event.cycles, event.name
並且使用事件字典可以獲取字段。但如何用Python閱讀器複製babeltrace輸出?
for event in trace_collection.events:
for field in event.items():
print field
樣品babeltrace輸出:
[2015-10-20 15:16:34.600508066] (+1.481059687) samplehost sample_trace_provider:INFO: { cpu_id = 1 }, { fileAndLine = "sampletest.cpp:330", msg = "Directing trace stream to channel #0" }
讓我知道是否需要任何進一步的信息。
感謝您的信息和評論! – seenu9333