Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69232463
surface_timer.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jun 30, 20:55
Size
1 KB
Mime Type
text/x-c
Expires
Tue, Jul 2, 20:55 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18685877
Attached To
rTAMAAS tamaas
surface_timer.hh
View Options
/* -------------------------------------------------------------------------- */
#if defined(TIMER) && defined(USING_TIMER)
/* -------------------------------------------------------------------------- */
#include <map>
#include <time.h>
#include <fstream>
/* -------------------------------------------------------------------------- */
extern
std
::
map
<
std
::
string
,
struct
timespec
>
mesT
;
extern
std
::
map
<
std
::
string
,
UInt
>
nmes
;
extern
std
::
map
<
std
::
string
,
struct
timespec
>
tstart
;
extern
std
::
map
<
std
::
string
,
struct
timespec
>
tstop
;
/* -------------------------------------------------------------------------- */
#define SEC_IN_NANOSEC 1000000000
/* -------------------------------------------------------------------------- */
#define STARTTIMER(x) { \
if (!mesT.count(x)) { \
mesT[x].tv_sec = 0; \
mesT[x].tv_nsec = 0; \
} \
clock_gettime(CLOCK_REALTIME,&(tstart[x])); \
}
/* -------------------------------------------------------------------------- */
#define STOPTIMER(x) { \
clock_gettime(CLOCK_REALTIME,&(tstop[x])); \
mesT[x].tv_sec += (tstop[x].tv_sec - tstart[x].tv_sec); \
mesT[x].tv_nsec += (tstop[x].tv_nsec - tstart[x].tv_nsec); \
if (mesT[x].tv_nsec < 0) { \
--mesT[x].tv_sec; \
mesT[x].tv_nsec += SEC_IN_NANOSEC; \
} \
if (mesT[x].tv_nsec >= SEC_IN_NANOSEC){ \
++mesT[x].tv_sec; \
mesT[x].tv_nsec -= SEC_IN_NANOSEC; \
} \
++nmes[x]; \
}
/* -------------------------------------------------------------------------- */
#else
#define STARTTIMER(x)
#define STOPTIMER(x)
#endif
void
dumpTimes
(
UInt
proc_number
=
0
);
Event Timeline
Log In to Comment