Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
TimeTracing.hpp
Go to the documentation of this file.
1//===-- TimeTracing.hpp -- Time tracing helpers --===//
2//
3// Part of the Proteus Project, under the Apache License v2.0 with LLVM
4// Exceptions. See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef PROTEUS_TIME_TRACING_HPP
12#define PROTEUS_TIME_TRACING_HPP
13
14#include <llvm/Support/TimeProfiler.h>
15
16namespace proteus {
17
18using namespace llvm;
19
21 TimeTracerRAII() { timeTraceProfilerInitialize(500 /* us */, "jit"); }
22
24 if (auto E = timeTraceProfilerWrite("", "-")) {
25 handleAllErrors(std::move(E));
26 return;
27 }
28 timeTraceProfilerCleanup();
29 }
30};
31
32#if PROTEUS_ENABLE_TIME_TRACING
33#define TIMESCOPE(x) TimeTraceScope T(x);
34#else
35#define TIMESCOPE(x)
36#endif
37
38} // namespace proteus
39
40#endif
Definition JitEngine.cpp:20
Definition TimeTracing.hpp:20
TimeTracerRAII()
Definition TimeTracing.hpp:21
~TimeTracerRAII()
Definition TimeTracing.hpp:23