Skip to content

Instantly share code, notes, and snippets.

@crydalch
Created July 18, 2012 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crydalch/3139492 to your computer and use it in GitHub Desktop.
Save crydalch/3139492 to your computer and use it in GitHub Desktop.
Houdini hou.perfMon Example
# This is an example script which will load the given hip file and record the performance of two areas (voronoi fracturing, and the bullet sim).
# Run with 'hython 50k_shatter.py'
import hou, sys
# Load the hip file
hou.hipFile.load("massive_bldg.hip")
# Setup (create and start) fracture-only profile & event
profile = hou.perfMon.startProfile("Fracture25Pieces")
evnm = "Fracture25"
event = hou.perfMon.startEvent(evnm)
# Set the voronoi fracture to create 50,000 pieces.
# dont' forget to force cook
hou.parm('/obj/building/chunkcenters/npts').set(50000)
vnode = hou.node('/obj/building/voronoifracture1')
vnode.cook()
# Stop everything, and save out the files.
event.stop()
profile.stop()
profile.save("voronoiChop.hperf")
profile.exportAsCSV("voronoiChop.csv")
print "Finished fractur, ready to sim..."
# Setup sim-only profile
profile = hou.perfMon.startProfile("Sim25Pieces")
evnm = "Sim25"
event = hou.perfMon.startEvent(evnm)
# Begin sim by rendering output driver
hou.node('/obj/building/perf_render').render()
event.stop()
profile.stop()
profile.save("sim.hperf")
profile.exportAsCSV("sim.csv")
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment