- Changed Linux to use clock_gettime for profiling instead of rdtsc. This

avoids potential erroneous results on multicore and variable speed
  processors. Windows will need to be updated accordingly.



SVN r1142 (trunk)
This commit is contained in:
Randy Heit 2008-08-10 03:25:08 +00:00
commit ad96225213
21 changed files with 399 additions and 540 deletions

View file

@ -461,7 +461,7 @@ sightcounts[2]++;
bool P_CheckSight (const AActor *t1, const AActor *t2, int flags)
{
clock (SightCycles);
SightCycles.Clock();
bool res;
@ -538,7 +538,7 @@ sightcounts[0]++;
SeePastShootableLines = 0;
done:
unclock (SightCycles);
SightCycles.Unclock();
return res;
}
@ -546,8 +546,7 @@ ADD_STAT (sight)
{
FString out;
out.Format ("%04.1f ms (%04.1f max), %5d %2d%4d%4d%4d%4d\n",
(double)SightCycles * 1000 * SecondsPerCycle,
(double)MaxSightCycles * 1000 * SecondsPerCycle,
SightCycles.TimeMS(), MaxSightCycles.TimeMS(),
sightcounts[3], sightcounts[0], sightcounts[1], sightcounts[2], sightcounts[4], sightcounts[5]);
return out;
}
@ -556,12 +555,12 @@ void P_ResetSightCounters (bool full)
{
if (full)
{
MaxSightCycles = 0;
MaxSightCycles.Reset();
}
if (SightCycles > MaxSightCycles)
if (SightCycles.Time() > MaxSightCycles.Time())
{
MaxSightCycles = SightCycles;
}
SightCycles = 0;
SightCycles.Reset();
memset (sightcounts, 0, sizeof(sightcounts));
}