mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
removed in-favor of chronos library of c++11
(cherry picked from commit 899be6a1f1
)
This commit is contained in:
parent
4847329527
commit
8cb310a9fc
@ -1,19 +0,0 @@
|
||||
// To calculate the time taken by a code to execute
|
||||
#include <sys/time.h>
|
||||
#include <iostream>
|
||||
|
||||
__int64_t getTimeInMicroseconds() {
|
||||
struct timeval start;
|
||||
gettimeofday(&start, NULL);
|
||||
return start.tv_sec * 1000000 + start.tv_usec;
|
||||
}
|
||||
|
||||
// write function sample(args)
|
||||
|
||||
int main() {
|
||||
// write code
|
||||
__int64_t starttime = getTimeInMicroseconds();
|
||||
// sample(args) function run
|
||||
// Any other functions (if present) run
|
||||
std::cout << getTimeInMicroseconds() - starttime;
|
||||
}
|
Loading…
Reference in New Issue
Block a user