-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiming.h
41 lines (28 loc) · 998 Bytes
/
timing.h
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
30
31
32
33
34
35
36
37
38
39
40
41
//
// Created by nick434434 on 23/10/2019.
//
#pragma once
#ifndef RANDOM_GRAPHS_MODELS_TIMING_H
#define RANDOM_GRAPHS_MODELS_TIMING_H
#include <chrono>
#include <iostream>
namespace timing {
struct Time {
long microsec;
Time(): microsec(0) {}
explicit Time(long val): microsec(val) {}
double as_seconds() { return (double)microsec / 1e6; }
double as_milliseconds() { return (double)microsec / 1e3; }
double as_minutes() { return (double)microsec / 6e7; }
};
static auto t0 = std::chrono::high_resolution_clock::now();
static auto t1 = std::chrono::high_resolution_clock::now();
void start_clock();
Time reset_clock(std::string& message, std::ostream& out);
Time check_clock();
void start_local_clock();
Time reset_local_clock(std::string& message, std::ostream& out);
Time check_local_clock();
}
std::ostream& operator<<(std::ostream& out, timing::Time t);
#endif //RANDOM_GRAPHS_MODELS_TIMING_H