Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Stopwatch.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Stopwatch.h
1
#ifndef Stopwatch_header
2
#define Stopwatch_header
3
4
#include <ctime>
5
6
class
Stopwatch
7
{
8
private
:
9
time_t
start
,
end
;
10
public
:
11
Stopwatch
() {
start
=clock();
end
=0;}
12
void
tic
() {
start
=clock();}
13
void
toc
() {
end
=clock();}
14
double
takeTime
() {
return
((
double
)(
end
-
start
)) / CLOCKS_PER_SEC;}
15
};
16
17
#endif
18
19
/*-----------------------------------------------------------------------
20
Usage:
21
Declare a class as:
22
Stopwatch sw;
23
Then the time a piece of code takes can be recorded as:
24
sw.tic();
25
**** code ****
26
sw.toc();
27
And the result can be outputted using:
28
cout << sw.takeTime() << endl;
29
-----------------------------------------------------------------------*/
JETSCAPE
blob
main
external_packages
hydro_from_external_file
Stopwatch.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:24
using
1.8.2 with
sPHENIX GitHub integration