Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F629410
timedifference.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
timedifference.h
View Options
#ifndef _time_difference_h
#define _time_difference_h
#include
<time.h>
#include
<sys/time.h>
#include
<string>
class
TimeDifference
{
public
:
TimeDifference
();
void
startTime
();
void
endTime
();
unsigned
long
long
int
getTime
();
const
std
::
string
printTime
();
const
std
::
string
printTime
(
const
std
::
string
&
description
,
int
runs
=
1
);
const
std
::
string
printAverageTime
(
const
std
::
string
&
description
,
int
runs
);
~
TimeDifference
();
protected
:
unsigned
long
long
start
,
end
;
};
/* Put this in a scope where you want to measure time differences. The constructor will
* get the start time and the destructor will get the end time and also print the difference
* between the two.
* {
* TimeCheck check;
* call_some_stuff();
* }
*
* Will print out how long `call_some_stuff' took. This class is somewhat useful in cases that the
* code could abort early due to a return or an exception so its not always clear where to
* call endTime() for a TimeDifference object.
*/
class
TimeCheck
{
public
:
TimeCheck
(
const
std
::
string
&
description
);
virtual
~
TimeCheck
();
protected
:
std
::
string
description
;
TimeDifference
time
;
};
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Nov 15, 6:47 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
113758
Default Alt Text
timedifference.h (1 KB)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline