ATLAS Offline Software
Loading...
Searching...
No Matches
DataQuality/HanConfigGenerator/src/simpletimer.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4// emacs: this is -*- c++ -*-
5//
6// @file simpletimer.h
7// these functions have a precision of about 0.001 ms
8//
9//
10// Copyright (C) 2007 M.Sutton (sutt@hep.ucl.ac.uk)
11//
12// $Id: simpletimer.h, v0.0 Thu 22 Jan 2009 15:51:52 GMT sutt $
13
14
15#ifndef __SIMPLETIMER_H
16#define __SIMPLETIMER_H
17
18#include <time.h>
19#include <sys/time.h>
20
21//#ifdef __cplusplus
22//extern "C" {
23//#endif
24
25
26inline struct timeval simpletimer_start(void) {
27 struct timeval start_time;
28 gettimeofday(&start_time, NULL);
29 return start_time;
30}
31
32inline double simpletimer_stop(const struct timeval& start_time)
33{
34 struct timeval stop_time;
35 struct timeval diff_time;
36 gettimeofday(&stop_time, NULL);
37 diff_time.tv_sec = stop_time.tv_sec - start_time.tv_sec;
38 diff_time.tv_usec = stop_time.tv_usec - start_time.tv_usec;
39 return (diff_time.tv_sec*1000.0) + (diff_time.tv_usec/1000.0);
40}
41
42
43//#ifdef __cplusplus
44//}
45//#endif
46
47#endif /* __SIMPLETIMER_H */
48
49
50
51
52
53
54
55
56
57
struct timeval simpletimer_start(void)
double simpletimer_stop(const struct timeval &start_time)