Home » U++ Library support » U++ Core » What`s the corect way to use TimingInspector?
|
Re: What`s the corect way to use TimingInspector? [message #36590 is a reply to message #36589] |
Wed, 13 June 2012 17:54 |
|
Hi akebee
I'm not sure if I understand correctly what are you trying to achieve, but I think there might be a misunderstanding about how TimingInspector works. It is not just a simple stopwatch. It gathers multiple timings of repeated actions (the intervals between Start() and End() calls) and makes up some statistics at the end. The Dump() method is automatically called in destructor, so it dumps the results into the log (see Debug>View the logfile or press Alt+L in TheIDE). If you want to measure times of more than one distinct things, you have to create multiple Timing inspector instances.
Another thing is that TimingInspector is not usually used directly. There is a macro TIMING(label) which simplifies the measurements. The usage is simple, it just measures the times between the line where it is specified and end of current scope (that is till next '}'). E.g.:#include <Core/Core.h>
using namespace Upp;
void DoSomething(){
TIMING("timer_in_DoSomething");
// do something here
}
CONSOLE_APP_MAIN{
for(int i = 0; i<500; i++)
DoSomething();
}
Note that timing works in Debug mode only, if you want to profile application build in Optimal mode, you can use RTIMING, the syntax and behavior is the same.
Hope that helps
Best regards,
Honza
|
|
|
|
|
|
Goto Forum:
Current Time: Mon May 13 09:13:58 CEST 2024
Total time taken to generate the page: 0.03371 seconds
|