]> git.tdb.fi Git - libs/core.git/commitdiff
Fix an integer rounding error in Profiler
authorMikko Rasa <tdb@tdb.fi>
Fri, 28 Dec 2007 20:47:02 +0000 (20:47 +0000)
committerMikko Rasa <tdb@tdb.fi>
Fri, 28 Dec 2007 20:47:02 +0000 (20:47 +0000)
source/debug/profiler.cpp

index 4251797a974bb33e676b288120c03a57f97f0d1b..af1380000639c9698ae333046654b11026929495 100644 (file)
@@ -68,7 +68,7 @@ void Profiler::record(const string &scope_name, const string &parent, const Time
        si.self_time+=time-child_t;
        if(period)
        {
-               si.avg_time+=(time-si.history[si.hist_pos])/period;
+               si.avg_time+=time/period-si.history[si.hist_pos]/period;
                si.history[si.hist_pos++]=time;
                if(si.hist_pos>=period)
                        si.hist_pos-=period;