Skip to content
Snippets Groups Projects
Commit 73e45012 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

ENH: Add utility to print the updates per sec for a given scene

parent 926e4797
No related branches found
No related tags found
No related merge requests found
...@@ -212,6 +212,35 @@ createNonLinearSystem(std::shared_ptr<imstk::FEMDeformableBodyModel> dynaModel) ...@@ -212,6 +212,35 @@ createNonLinearSystem(std::shared_ptr<imstk::FEMDeformableBodyModel> dynaModel)
return nlSystem; return nlSystem;
} }
///
/// \brief Print number of updates for second for a given scene
///
void
printUPS(std::shared_ptr<SceneManager> sceneManager, std::shared_ptr<UPSCounter> ups)
{
sceneManager->setPreInitCallback([](Module* module)
{
LOG(INFO) << "-- Pre initialization of " << module->getName() << " module";
});
sceneManager->setPreUpdateCallback([&ups](Module* module)
{
ups->setStartPointOfUpdate();
});
sceneManager->setPostUpdateCallback([&ups](Module* module)
{
ups->setEndPointOfUpdate();
std::cout << "\r-- " << module->getName() << " running at "
<< ups->getUPS() << " ups " << std::flush;
});
sceneManager->setPostCleanUpCallback([](Module* module)
{
LOG(INFO) << "\n-- Post cleanup of " << module->getName() << " module";
});
}
} //apiutils } //apiutils
} // imstk } // imstk
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment