from pyfbsdk import *
gPROFILER = FBProfiler()
lSamplesCount = gPROFILER.GetEventSampleCount()
if lSamplesCount > 0:
logPath = FBSystem().UserConfigPath + '/EventsLog.txt'
print logPath
f = open(logPath, 'w')
for i in range(lSamplesCount):
lEvent = gPROFILER.GetEventSample(i)
lEndEvent = gPROFILER.GetEndEventSample(i)
lColor = lEvent.GetColor()
if lEvent.IsSingleEvent():
lString = "%s;%s;%f %f %f %d %d\n" % (lEvent.GetComment(),lEvent.GetTypeName(),lColor[0],lColor[1],lColor[2],lEvent.GetThreadID(), lEvent.GetTime().Get())
f.write(lString)
elif lEndEvent:
lString = "%s;%s;%f %f %f %d %d %d\n" % (lEvent.GetComment(),lEvent.GetTypeName(),lColor[0],lColor[1],lColor[2],lEvent.GetThreadID(), lEvent.GetTime().Get(), lEndEvent.GetTime().Get())
f.write(lString)
f.close()