1 -- Created on: 2018-03-15
2 -- Created by: Stephan GARNAUD (ARM)
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 -- Updated: J.P. TIRAULT Sept,1993
25 class Timer from OSD inherits Chronometer from OSD
27 ---Purpose: Working on heterogeneous platforms
28 -- we need to use the system call gettimeofday.
29 -- This function is portable and it measures ELAPSED
30 -- time and CPU time in seconds and microseconds.
31 -- Example: OSD_Timer aTimer;
32 -- aTimer.Start(); // Start the timers (t1).
33 -- ..... // Do something.
34 -- aTimer.Stop(); // Stop the timers (t2).
35 -- aTimer.Show(); // Give the elapsed time between t1 and t2.
36 -- // Give also the process CPU time between
42 Create returns Timer from OSD;
43 ---Purpose: Builds a Chronometer initialized and stopped.
46 Reset (me : in out) is redefined;
47 ---Purpose: Stops and reinitializes the timer.
50 Show (me : in out) is redefined;
51 ---Purpose: Shows both the elapsed time and CPU time on the standard output
52 -- stream <cout>.The chronometer can be running (Lap Time) or
56 Show (me : in out; os : in out OStream from Standard) is redefined;
57 ---Purpose: Shows both the elapsed time and CPU time on the
58 -- output stream <OS>.
61 Show (me : in out; seconds : in out Real from Standard;
62 minutes : in out Integer from Standard;
63 hours : in out Integer from Standard;
64 CPUtime : in out Real from Standard);
66 ---Purpose: returns both the elapsed time(seconds,minutes,hours)
70 Stop (me : in out) is redefined;
71 ---Purpose: Stops the Timer.
74 Start (me : in out) is redefined;
75 ---Purpose: Starts (after Create or Reset) or restarts (after Stop)
79 ElapsedTime (me : in out) returns Real;
80 ---Purpose: Returns elapsed time in seconds.