winIDEA SDK
test_create_close_instance.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_profiler_data # see docs section Examples for link to source
7
8
9winidea_id = ''
10
11
12def test_createCloseInstance():
13 conn_mgr = ic.ConnectionMgr()
14 conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
15
16 # To see prepareTestData.py on web, click Examples tab in iSYSTEM online docs.
17 trd_file_path = export_profiler_data.EXAMPLE_TRD_FILE_NAME
18 print(f"Exporting TRD data to XML and creating instance of CProfilerData2 class: {trd_file_path}")
19 prof_ctrl = ic.CProfilerController2(conn_mgr, trd_file_path, "u")
20 prof_ctrl.waitUntilLoaded(3000, isThrow=True)
21
22 prof_data = ic.CProfilerData2.createInstance(prof_ctrl,
23 "test_createCloseInstance.xml",
24 False,
25 "*",
26 "*")
27 prof_data.closeParser()
28
29 # To see prepareTestData.py on web, click Examples tab in iSYSTEM online docs.
30 xml_file_path = export_profiler_data.export_data(conn_mgr)
31 print("Importing existing XML file and creating instance of CProfilerData2 class...")
32 prof_data = ic.CProfilerData2.createInstance(xml_file_path, False)
33 prof_data.closeParser()
34 prof_ctrl.close()
35
36
37if __name__ == "__main__":
38 test_createCloseInstance()