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
12 ******************************************************************************/
13 #include "Stopwatch.hh"
17 Stopwatch::Stopwatch(const char *name
)
21 gettimeofday(&tv_start
, 0);
24 Stopwatch::~Stopwatch()
26 struct timeval tv_end
;
27 gettimeofday(&tv_end
, 0);
29 struct timeval tv_diff
= {
30 tv_end
.tv_sec
- tv_start
.tv_sec
,
31 tv_end
.tv_usec
- tv_start
.tv_usec
33 if (tv_diff
.tv_usec
< 0) {
35 tv_diff
.tv_usec
+= 1000000;
38 NOTIFY("%s took %ld.%06ld sec", my_name
,
39 (long)tv_diff
.tv_sec
, (long)tv_diff
.tv_usec
);
This page took 0.033878 seconds and 5 git commands to generate.