std.perf functions unintuitive (windows version)
nobody_
spam at spam.spam
Thu Nov 23 13:01:30 PST 2006
timer.start() initializes a timer and saves the starting 'tick' and
frequency.
timer.periodCount() returns ending tick - starting tick, but the ending tick
is only initialized when timer.close() is called.
timer.stop() saves ending 'tick'
timer.second()/millisecond()/microsecond() all depend on periodCount() thus
have no meaning untill stop() is called.
My suggestion is :
remove timer.stop()
add timer.remove(), which removes the instance of the timer (gives you back
that few bytes used :D)
make periodCount() like this:
interval_type periodCount()
{
QueryPerformanceCounter(&m_end);
return m_end - m_start;
}
This way timer.second()/millisecond()/microsecond() all make meaning the
whole time ;)
More information about the Digitalmars-d-bugs
mailing list