Samples/Profiling/CreateProfilingEventsLog.py
21 gProfiler.ActiveSampling =
True
24 gPlayer.Goto(
FBTime(0,0,0,0) )
26 while FBSystem().LocalTime.GetFrame() < 50:
27 gApp.FlushEventQueue()
31 while gPlayer.IsPlaying:
32 gApp.FlushEventQueue()
35 gProfiler.ActiveSampling =
False
37 lSamplesCount = gProfiler.GetEventSampleCount()
38 print "Number of samples collected: %d\n" % lSamplesCount
41 logPath = os.path.join( tempfile.gettempdir(),
"EventsLog.txt" )
42 f = open(logPath,
'wt')
44 for i
in range(lSamplesCount):
45 lEvent = gProfiler.GetEventSample(i)
46 lEndEvent = gProfiler.GetEndEventSample(i)
47 lColor = lEvent.GetColor()
49 if lEvent.IsSingleEvent():
50 lString =
"%s;%s;%f %f %f %d %d\n" % (lEvent.GetComment(),lEvent.GetTypeName(),lColor[0],lColor[1],lColor[2],lEvent.GetThreadID(), lEvent.GetTime().Get())
53 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())
57 print "File successfully saved to %s" % logPath