import isystem.connect as ic
import export_profiler_data
winidea_id = ''
def test_hasStatisticsForArea():
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("Has statistics for area (by area ID):")
area_ok = prof_data.getArea(ic.CProfilerArea2.EFunctions, "targetInit")
area_err = 123456789
print(f"\t'{area_ok.getAreaName()}': {prof_data.hasStatisticsForArea(area_ok.getAreaId())}")
print(f"\t'{area_err}': {prof_data.hasStatisticsForArea(area_err)}")
print("Has statistics for area (by area URL):")
area_url = 'Code/targetInit'
print(f"\t'{area_url}': {prof_data.hasStatisticsForArea(area_url)}")
if __name__ == "__main__":
test_hasStatisticsForArea()