Parent: [288ae8] (diff)

Download this file

Timer.def    124 lines (99 with data), 7.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
DEFINITION MODULE Timer;
(*------------------------------------------------------------------------*)
(* Einige Routinen zur Zeiterfassung. *)
(* Some routines to measure timings. *)
(*------------------------------------------------------------------------*)
(* Implementation : Michael Riedl *)
(* Licence : GNU Lesser General Public License (LGPL) *)
(*------------------------------------------------------------------------*)
(* $Id: Timer.def,v 1.2 2018/06/08 21:38:43 mriedl Exp mriedl $ *)
IMPORT UnixLib;
IMPORT SysClock;
IMPORT Streams;
TYPE tms = UnixLib.tms;
CONST HZ = SysClock.maxSecondParts; (* 100 f"ur i80386, Linux *)
PROCEDURE GetUserTime(VAR T : LONGCARD);
(*----------------------------------------------------------------*)
(* Gibt die aktuelle Systemzeit in Sekunden seit dem 01.01.1970, *)
(* 00:00 zur"uck. *)
(* *)
(* Retruns the actual system time in seconds since 01.01.1970 *)
(* 00:00 *)
(*----------------------------------------------------------------*)
PROCEDURE DeltaZeit() : CARDINAL;
(*----------------------------------------------------------------*)
(* Gibt die Zeit, die seit dem letzten Ruf dieser Prozedur ver- *)
(* strichen ist, in Sekunden zur"uck. *)
(* *)
(* Returns the time since the last call to this function in *)
(* seconds. This procedure is not thread-safe *)
(*----------------------------------------------------------------*)
PROCEDURE DeltaZeitHZ() : CARDINAL;
(*----------------------------------------------------------------*)
(* Gibt die Zeit, die seit dem letzten Ruf dieser Prozedur *)
(* verstrichen ist, in Einheiten von HZ zur"uck, wobei HZ die *)
(* maschienenabh"angige Zahl der Schl"age der Systemuhr pro *)
(* Sekunde ist. *)
(* *)
(* Returns the time since the last call to this function in *)
(* units of HZ. HZ is the machine depended number of ticks of the *)
(* system clock per second. This procedure is not thread-safe *)
(*----------------------------------------------------------------*)
PROCEDURE DeltaZeitHZr() : REAL;
(*----------------------------------------------------------------*)
(* Gibt die Zeit, die seit dem letzten Ruf dieser Prozedur *)
(* verstrichen ist, in Einheiten von HZ zur"uck, wobei HZ die *)
(* maschienenabh"angige Zahl der Schl"age der Systemuhr pro *)
(* pro Sekunde ist. Im Gegensatz zu UserTime wird die Zeit als *)
(* REAL-Varibale zur��ckgegeben die auch noch die Sekunkenbruch- *)
(* teile (abh��ngig von SysClock.maxSecondParts) enth"alt. *)
(* *)
(* Returns the time since the last call to this function in *)
(* units of HZ. HZ is the machine depended number of ticks of the *)
(* system clock per second. The return value is a real varible. *)
(* This procedure is not thread-safe *)
(*----------------------------------------------------------------*)
PROCEDURE InitUserTime(VAR t0 : tms);
(*----------------------------------------------------------------*)
(* Initialisiert UserTime. *)
(* *)
(* Initialize UserTime. *)
(*----------------------------------------------------------------*)
PROCEDURE UserTime(t0 : tms) : LONGCARD;
(*----------------------------------------------------------------*)
(* Gibt die Benutzerzeit seit dem letzten Aufruf von *)
(* InitUserTime mit demselben Argument t0 zur"uck. *)
(* *)
(* Return the user time since the last call to InitUserTime with *)
(* the same argument t0 *)
(*----------------------------------------------------------------*)
PROCEDURE UserTimeHZr(t0 : tms) : REAL;
(*----------------------------------------------------------------*)
(* Gibt die Benutzerzeit seit dem letzten Aufruf von *)
(* InitUserTime mit demselben Argument t0 zur"uck. Im Gegensatz *)
(* zu UserTime wird die Benutzerzeit als REAL-Varibale zur��ckge- *)
(* geben die auch noch den Sekunkenbruchteil (abh��ngig von *)
(* SysClock.maxSecondParts) enth"alt. *)
(* *)
(* Return the user time since the last call to InitUserTime with *)
(* the same argument t0, the return value beeing a real varibale. *)
(* That way - depending on SysClock.maxSecondPart) also parts of *)
(* a second can be taken into consideration. *)
(*----------------------------------------------------------------*)
PROCEDURE WriteDate(VAR Aus : Streams.Stream;
VAR Date : SysClock.DateTime);
(*----------------------------------------------------------------*)
(* Ausschreiben des Datums auf dem Stream Aus als DD:MM:YYYY *)
(* *)
(* Write the date provided in Date in the form DD:MM:YYY on the *)
(* stream "Aus" *)
(*----------------------------------------------------------------*)
PROCEDURE WriteTime(VAR Aus : Streams.Stream;
VAR Zeit : SysClock.DateTime);
(*----------------------------------------------------------------*)
(* Ausschreiben der Zeit auf dem Stream Aus als hh:mm:ss *)
(* *)
(* Write the date provided in Zeit in the form hh.mm:ss on the *)
(* stream "Aus" *)
(*----------------------------------------------------------------*)
END Timer.