improved for inserting profile timings from Python, to analyzer performance of pybullet programs.
See examples/pybullet/examples/profileTiming.py for an example. Note that python and c++ is properly interleaved. Open a timings with a name, close the timing without a name. Note that timings can be recursive, added/popped as a stack.
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
import pybullet as p
|
||||
import time
|
||||
|
||||
#you can visualize the timings using Google Chrome, visit about://tracing
|
||||
#and load the json file
|
||||
p.connect(p.GUI)
|
||||
|
||||
t = time.time() + 0.1
|
||||
t = time.time() + 3.1
|
||||
|
||||
logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "haha")
|
||||
logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "chrome_about_tracing.json")
|
||||
while (time.time() < t):
|
||||
p.submitProfileTiming("pythontest")
|
||||
time.sleep(1./240.)
|
||||
p.submitProfileTiming("nested")
|
||||
time.sleep(1./1000.)
|
||||
p.submitProfileTiming()
|
||||
p.submitProfileTiming()
|
||||
|
||||
p.stopStateLogging(logId)
|
||||
|
||||
Reference in New Issue
Block a user