winIDEA SDK
test_trace_get_timeline_iterator.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6import export_trace_data # see docs section Examples for link to source
7
8
9winidea_id = ''
10
11
12def test_getTimelineIterator():
13 conn_mgr = ic.ConnectionMgr()
14 conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
15
16 xml_file_path, _ = export_trace_data.export_data(conn_mgr)
17 trace_data = ic.CTraceData.createInstance(xml_file_path)
18
19 print("Iterating first 10 timeline events...")
20 count = 0
21 itr = trace_data.getTimelineIterator()
22 while itr.hasNext():
23 event = itr.nextAsSPtr()
24 print(f"Sample index: {event.getSampleIndex()}")
25 print(f"\t{event.toString()}\n")
26 # ... explore other methods of 'ic.CTraceTimeEvent'
27
28 count = count + 1
29 if count == 10:
30 break
31
32 trace_data.closeParser()
33
34
35if __name__ == "__main__":
36 test_getTimelineIterator()