- This topic has 6 replies, 2 voices, and was last updated 8 years ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] How to use the API of AdvancedTimer?
Tagged: 64_bits, SOFA_1608, Windows_10
Hello!
Can anyone give me some details about the API of AdvancedTimer? I can’t understand the usage examples in the AdvancedTimer.h.
Hi Coco,
There is a page dedicated to it in the documentation, you should carefully read the doc.
Let’s take an example in DefaultAnimationLoop.cpp. Have a look at the DefaultAnimationLoop::step() function.
Here, the way of using AdvancedTimer is visible. First, you need the header to be included:
#include <sofa/helper/AdvancedTimer.h>
Then, in the function, you always have a first Timer starting the counting and another ending the Timer:
sofa::helper::AdvancedTimer::stepBegin("MyTimer");
//Here the code that you want to measure the computation time
sofa::helper::AdvancedTimer::stepEnd("MyTimer");
Finally, to actually measure the time spent for this piece of code what you need is click in the tab “Stats” of runSofa and then click “Log Time”. Run 100 steps and get the timers in the command window.
Cheers,
Hugo
Hi Hugo,
Thanks for your help. I will spend some time to absorb the knowledge.
Cheers,
Coco
Hi Hugo,
With your help,I have got how to use the API of AdvancedTimer. Recently, I am reading the page in the documentation and have learned a lot.
Best,
Coco
Perfect Coco,
If you have any further question, do not hesitate to create a new topic.
I’ll mark this one as solved.
Best,
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.