cyqlone develop
Fast, parallel and vectorized solver for linear systems with optimal control structure.
Loading...
Searching...
No Matches
tracing.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <guanaqo/trace.hpp>
4#include <cstdint>
5
6#if GUANAQO_WITH_TRACING
7#include <filesystem>
8#include <span>
9
10namespace cyqlone {
11
12namespace fs = std::filesystem;
13
14struct TracingOptions {
15 bool no_barrier = true; ///< Do not log barrier events.
16};
17
18void write_chrome_trace(const fs::path &filename, std::span<const guanaqo::TraceLogger::Log> logs,
19 const TracingOptions &opts = {});
20
21enum class TraceDataNames {
22 M,
23 L,
24 Y,
25 U,
26 Kf,
27 Kb,
28 Upf,
29 Upb,
30 Q,
31 T,
32 Sentinel,
33};
34
35inline uint32_t tracing_data_ids[static_cast<size_t>(TraceDataNames::Sentinel)][256][8]{};
36
37} // namespace cyqlone
38
39#define CYQ_TRACE_WRITE(name, index, lr) \
40 do { \
41 using ::cyqlone::TraceDataNames; \
42 uint64_t id = ++tracing_data_ids[static_cast<size_t>(TraceDataNames::name)][index][lr]; \
43 id += static_cast<uint64_t>(TraceDataNames::name) << 32; \
44 id += static_cast<uint64_t>(index) << 48; \
45 id += static_cast<uint64_t>(lr) << 56; \
46 auto s = ::guanaqo::get_trace_logger().trace("w:" #name, id); \
47 s.log = nullptr; \
48 } while (false)
49#define CYQ_TRACE_READ(name, index, lr) \
50 do { \
51 using ::cyqlone::TraceDataNames; \
52 uint64_t id = tracing_data_ids[static_cast<size_t>(TraceDataNames::name)][index][lr]; \
53 id += static_cast<uint64_t>(TraceDataNames::name) << 32; \
54 id += static_cast<uint64_t>(index) << 48; \
55 id += static_cast<uint64_t>(lr) << 56; \
56 auto s = ::guanaqo::get_trace_logger().trace("r:" #name, id); \
57 s.log = nullptr; \
58 } while (false)
59
60#else
61
62#define CYQ_TRACE_WRITE(...) GUANAQO_NOOP()
63#define CYQ_TRACE_READ(...) GUANAQO_NOOP()
64
65#endif