import isystem.connect as ic
import export_profiler_data
winidea_id = ''
def test_createCloseInstance():
conn_mgr = ic.ConnectionMgr()
conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
trd_file_path = export_profiler_data.EXAMPLE_TRD_FILE_NAME
print(f"Exporting TRD data to XML and creating instance of CProfilerData2 class: {trd_file_path}")
prof_ctrl = ic.CProfilerController2(conn_mgr, trd_file_path, "u")
prof_ctrl.waitUntilLoaded(3000, isThrow=True)
prof_data = ic.CProfilerData2.createInstance(prof_ctrl,
"test_createCloseInstance.xml",
False,
"*",
"*")
prof_data.closeParser()
xml_file_path = export_profiler_data.export_data(conn_mgr)
print("Importing existing XML file and creating instance of CProfilerData2 class...")
prof_data = ic.CProfilerData2.createInstance(xml_file_path, False)
prof_data.closeParser()
prof_ctrl.close()
if __name__ == "__main__":
test_createCloseInstance()