winIDEA SDK
Loading...
Searching...
No Matches
test_get_timeline_iterator.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import isystem.connect as ic
import export_profiler_data # see docs section Examples for link to source
winidea_id = ''
def test_getTimelineIterator():
conn_mgr = ic.ConnectionMgr()
conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
# To see exportProfilerData(), click Examples tab in iSYSTEM online docs.
xml_file_path = export_profiler_data.export_data(conn_mgr)
prof_data = ic.CProfilerData2.createInstance(xml_file_path, True)
print("First 10 'write' events in timeline:")
titr = prof_data.getTimelineIterator(ic.CProfilerTimeEvent.EEvWrite)
for index in range(10):
assert titr.hasNext() is True, f"There are no more 'write' events available, last: {index}"
event_data = titr.next()
event_data: ic.CProfilerTimeEvent
print(
f"\tIndex {index}: value {event_data.getValue()} @ {event_data.getTime()}")
print("First 10 'write' events in timeline of 'mainLoopCounter' variable:")
area = prof_data.getArea('Data/mainLoopCounter')
titr = prof_data.getTimelineIterator(ic.CProfilerTimeEvent.EEvWrite,
area.getHandle())
for index in range(10):
assert titr.hasNext(
) is True, f"There is no more 'write' events available, last: {index}"
event_data = titr.next()
event_data: ic.CProfilerTimeEvent
print(
f"\tIndex {index}: value {event_data.getValue()} @ {event_data.getTime()}")
if __name__ == "__main__":
test_getTimelineIterator()