Tops and PerfMon

   1236   1   1
User Avatar
Member
5 posts
Joined: Sept. 2011
Offline
Is there a way to start a performance monitor profile when starting the execution of a TOPs network then stop and save it when it is finished? Looking through the documentation I can see I can start and name a profile via python but there doesn't seem to be a method for retrieving a profile by name or id in a later script node.
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
hello, I experienced the same issue and Support from SideFX was of great help,
I quote their advice, but I don't know if it can be implemented with TOPs (can you use the hou.session in Top?)

Note: "START_" and "END_" are 2 python sop nodes the wraps the network block I wanted to profile.

In the "START_perf_profile" node, you could do:
"""
node = hou.pwd()
iteration = node.evalParm("iteration")

if not hasattr(hou.session, "profiles"):
hou.session.profiles = {}

profile = hou.perfMon.startProfile("profile for iteration " + str(iteration))
hou.session.profiles[profile.id()] = profile
"""

And in the "END_perf_profile" node, you could do:

node = hou.pwd()
id = node.evalParm("get_id")
profile = hou.session.profiles[id]
profile.stop()

In the future, we probably should add a new `hou.perfMon.getProfile(id)` to HOM but we'll need to do an investigation first. I vaguely recall that we chose not to add such a function but I can't recall exactly why.
  • Quick Links