Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
trace_event.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstdint>
7#include <string>
8#include <string_view>
9
10#include "contur/core/types.h"
11
13
14namespace contur {
15
21 {
24
26 std::string subsystem;
27
29 std::string operation;
30
32 std::string details;
33
36
38 std::uint32_t depth = 0;
39
41 std::size_t workerId = 0;
42
44 std::uint64_t sequence = 0;
45
47 std::uint64_t epoch = 0;
48 };
49
58 [[nodiscard]] inline TraceEvent makeTraceEvent(
59 Tick timestamp,
60 std::string_view subsystem,
61 std::string_view operation,
62 std::string_view details,
63 std::uint32_t depth,
65 )
66 {
67 TraceEvent event;
68 event.timestamp = timestamp;
69 event.subsystem = std::string(subsystem);
70 event.operation = std::string(operation);
71 event.details = std::string(details);
72 event.level = level;
73 event.depth = depth;
74 return event;
75 }
76
77} // namespace contur
Definition block.h:15
TraceLevel
Trace event severity.
Definition trace_level.h:13
std::uint64_t Tick
Simulation clock tick counter.
Definition types.h:18
TraceEvent makeTraceEvent(Tick timestamp, std::string_view subsystem, std::string_view operation, std::string_view details, std::uint32_t depth, TraceLevel level=TraceLevel::Info)
Convenience helper for constructing a trace event.
Definition trace_event.h:58
Structured trace event record.
Definition trace_event.h:21
std::uint64_t epoch
Runtime epoch identifier used for deterministic replay checks.
Definition trace_event.h:47
std::uint32_t depth
Current tracer nesting depth.
Definition trace_event.h:38
std::string operation
Operation name within the subsystem.
Definition trace_event.h:29
std::size_t workerId
Worker index used by concurrent dispatcher runtime.
Definition trace_event.h:41
std::string details
Optional human-readable details payload.
Definition trace_event.h:32
Tick timestamp
Simulation timestamp when the event was emitted.
Definition trace_event.h:23
TraceLevel level
Event severity level.
Definition trace_event.h:35
std::uint64_t sequence
Monotonic sequence value used for canonical ordering.
Definition trace_event.h:44
std::string subsystem
Subsystem that emitted the event.
Definition trace_event.h:26
Trace severity levels used by the tracing subsystem.
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...