import isystem.connect as ic
import export_profiler_data
winidea_id = ''
def test_getStatisticsForFunction():
conn_mgr = ic.ConnectionMgr()
conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
xml_file_path = export_profiler_data.export_data(conn_mgr)
prof_data = ic.CProfilerData2.createInstance(xml_file_path, False)
print("Function 'targetInit' statistics (by area ID, in 'Neutral' context):")
area = prof_data.getArea(ic.CProfilerArea2.EFunctions, "targetInit")
stat = prof_data.getStatisticsForFunction(area.getAreaId(), "Neutral")
print(f"\tArea name: {stat.getAreaName()}")
print(f"\tCall count: {stat.getNumHits()}")
print("Function 'targetInit' statistics (directly by func name in 'Neutral' context):")
stat = prof_data.getStatisticsForFunction(ic.CProfilerArea2.EFunctions,
"targetInit",
"Neutral")
print(f"\tArea name: {stat.getAreaName()}")
print(f"\tCall count: {stat.getNumHits()}")
if __name__ == "__main__":
test_getStatisticsForFunction()