Browse Source

fix EstimateCpuClockrate & CyclesToMs -- return absolute value because perfmon trapped on win64 with negative values

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8567 8c9fc860-2736-0410-a75d-ab315db34111
eth.metacore 6 years ago
parent
commit
b41e02caa0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      source/WMPerfMonPlugins.Mod

+ 2 - 2
source/WMPerfMonPlugins.Mod

@@ -762,7 +762,7 @@ BEGIN
 	END;
 	endTime := Machine.GetTimer();
 	IF nbrOfGcRuns # Heaps.Ngc THEN RETURN FALSE; END;
-	timeDiff := endTime - startTime;
+	timeDiff := ABS( endTime - startTime );
 	clockrate := SHORT (timeDiff DIV (1000*1000));
 	RETURN TRUE;
 END EstimateCpuClockrate;
@@ -774,7 +774,7 @@ END EstimateCpuClockrate;
 *)
 PROCEDURE CyclesToMs*(cycles : HUGEINT; mhz : LONGINT) : LONGINT;
 BEGIN
-	RETURN SHORT (cycles DIV (1000*mhz));
+	RETURN SHORT (ABS(cycles) DIV (1000*ABS(mhz)));
 END CyclesToMs;
 
 (** Convert number of milliseconds into string of the form d:h:m:s if m >= 1 or x.xxxs if m < 1*)