Fetching the Execution Time of a Manager

From Virtools Wiki

Jump to: navigation, search

What I wanted to do was show the player the execution time of the physics manager. This was to enable our beta testers to provide feedback if performance was poor.

The first step was to discover the GUID of the physics manager. This code in our standalone player did the trick:

 
// output all of the managers in use
CKGUID guid;
for(i = 0; i < TheCKContext->GetManagerCount(); i++) {
CKBaseManager* testMan = (CKBaseManager*) TheCKContext->GetManager(i);
guid = testMan->GetGuid();
printf("Manager loaded: %s, %x,%x\n", (char*) testMan->GetName(), guid.d1, guid.d2);
}
 

Output looks like this for our project:

Manager loaded: Variable Manager, 98cc3cc9,0
Manager loaded: Object Manager, 7cbb3b91,0
Manager loaded: Parameter Manager, 9ce57ab6,0
Manager loaded: Attribute Manager, 3d242466,0
Manager loaded: Time Manager, 89ce7b32,0
Manager loaded: Message Manager, 466a0fac,0
Manager loaded: Behavior Manager, 58d621ae,0
Manager loaded: Path Manager, 15fd54b9,0
Manager loaded: DirectX Input Manager, f787c904,0
Manager loaded: DirectX Sound Manager, dce135f6,0
Manager loaded: VSL Manager, 4f243100,28ab3f51
Manager loaded: Portals Manager, 2af20fe2,3c0570a7
Manager loaded: Collision Manager, 38244712,0
Manager loaded: Floor Manager, 420936f9,0
Manager loaded: Font Manager, 64fb5810,73262d3b
Manager loaded: LOD (Level Of Detail), 314f3f83,6f0e30
Manager loaded: Particle Manager, 1dd91197,1f703f3
Manager loaded: Physics Manager, 2b90b3d,518d34df
Manager loaded: Render Manager, a213c8d5,0

Then, I created a BB for specific use. I suppose it would be more useful to create a BB that spits out the execution time for any GUID, but I didn't know how to easily pass a CKGUID from schematic (I suppose via a string).

 
CKContext* ctx = behcontext.Context;
CKBaseManager* phyMan = ctx->GetManagerByGuid(CKGUID(0x2b90b3d,0x518d34df));
float profileTime = phyMan->m_ProcessingTime;
 


That's it...hope this helps anyone looking to do something similar!

Personal tools
The Swap-Meet