forked from jlgreathouse/StreamMR
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimeRec.cpp
More file actions
29 lines (24 loc) · 691 Bytes
/
timeRec.cpp
File metadata and controls
29 lines (24 loc) · 691 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
/******************************************************************************************************
* (c) Virginia Polytechnic Insitute and State University, 2011.
******************************************************************************************************/
#include "timeRec.h"
#include <stdio.h>
#include <stdlib.h>
struct timeval timeStart;
struct timeval timeEnd;
void timerStart()
{
gettimeofday(&timeStart, NULL);
}
void timerEnd()
{
gettimeofday(&timeEnd, NULL);
}
//return value is ms
double elapsedTime()
{
double deltaTime;
deltaTime = (timeEnd.tv_sec - timeStart.tv_sec) * 1000.0 +
(timeEnd.tv_usec - timeStart.tv_usec) / 1000.0;
return deltaTime;
}