Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Raduly, Csaba | |
11 | * | |
12 | ******************************************************************************/ | |
970ed795 EL |
13 | #ifndef STOPWATCH_HH_ |
14 | #define STOPWATCH_HH_ | |
15 | ||
16 | #include <sys/time.h> | |
17 | ||
18 | class Stopwatch { | |
19 | public: | |
20 | Stopwatch(const char *name); | |
21 | ~Stopwatch(); | |
22 | private: | |
23 | struct timeval tv_start; | |
24 | const char *my_name; // not owned | |
25 | private: | |
26 | Stopwatch(const Stopwatch&); // no copy | |
27 | Stopwatch& operator=(const Stopwatch&); // no assignment | |
28 | }; | |
29 | ||
30 | #ifdef NDEBUG | |
31 | #define STOPWATCH(s) ((void)(s)) | |
32 | #else | |
33 | #define STOPWATCH(s) Stopwatch chrono_meter(s) | |
34 | #endif | |
35 | ||
36 | #endif /* STOPWATCH_HH_ */ |