forked from uwescience/RelaxMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiming.cpp
More file actions
30 lines (22 loc) · 657 Bytes
/
Copy pathtiming.cpp
File metadata and controls
30 lines (22 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* Author: Seung-Hee Bae (shbae@cs.washington.edu)
* Date: Mar. 2014
* Copyright (C) since 2013, Seung-Hee Bae, Bill Howe, Database Group at the University of Washington
*/
#include <iostream>
#include "timing.h"
#include <sys/times.h>
#include <math.h>
#include <unistd.h>
#define DEC 10000
using namespace std;
float gettime(){
float clockticks;
struct tms Time;
times(&Time);
clockticks = (double) sysconf(_SC_CLK_TCK);
return floor(DEC*Time.tms_utime/clockticks)/DEC;
}
double elapsedTimeInSec(struct timeval start, struct timeval end) {
return ((end.tv_sec - start.tv_sec) * 1000000u + end.tv_usec - start.tv_usec) / 1.0e6;
}