1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 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 #include "Stopwatch.hh"
12 Stopwatch::Stopwatch(const char *name
)
16 gettimeofday(&tv_start
, 0);
19 Stopwatch::~Stopwatch()
21 struct timeval tv_end
;
22 gettimeofday(&tv_end
, 0);
24 struct timeval tv_diff
= {
25 tv_end
.tv_sec
- tv_start
.tv_sec
,
26 tv_end
.tv_usec
- tv_start
.tv_usec
28 if (tv_diff
.tv_usec
< 0) {
30 tv_diff
.tv_usec
+= 1000000;
33 NOTIFY("%s took %ld.%06ld sec", my_name
,
34 (long)tv_diff
.tv_sec
, (long)tv_diff
.tv_usec
);
This page took 0.031121 seconds and 5 git commands to generate.