for private project use stopwatch performance measurement.
but on low repitition count of calls want measure, end 0 elapsedmilliseconds, makes difficult calculate average.
i thought writing own stopwatch class. calculate ticks , give vague elapsedmicroseconds based on stopwatch.elapsedticks , timespan.tickspermillisecond. not way.
i definitly need backed high performance counters of winapi, datetime , such not suffice.
are there other ideas?
if got 0 elapsedmicroseconds, means interval shorter 1 ms. may try measuring periods in ticks , use frequency:
stopwatch watch = stopwatch.startnew(); ... // estimated code here ... watch.stop(); // microseconds int microseconds = (int)(watch.elapsedticks * 1.0e6 / stopwatch.frequency + 0.4999); // nanoseconds (estimation) int nanoseconds = (int)(watch.elapsedticks * 1.0e9 / stopwatch.frequency + 0.4999);
Comments
Post a Comment