Peano
Loading...
Searching...
No Matches
trace.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <utility>
5
6#include <lang/type.h>
7
8typedef std::chrono::high_resolution_clock::time_point TimeVar;
9
10#define duration(a) std::chrono::duration_cast<std::chrono::milliseconds>(a).count()
11#define timeNow() std::chrono::high_resolution_clock::now()
12#define since(a) duration(timeNow() - a)
13
14#ifndef DISABLE_TRACING
15#define TRACE(name, function_call) TimeVar STRCAT(t, __LINE__) = timeNow(); function_call printf("%s : %ldms\n", name, since(STRCAT(t, __LINE__)));
16#else
17#define TRACE(name, function_call) function_call
18#endif
std::chrono::high_resolution_clock::time_point TimeVar
Definition trace.h:8