|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Event data for job execution tracing. More...
#include <execution_event.h>

Public Member Functions | |
| auto | format_timestamp () const -> std::string |
| Formats the event timestamp as ISO 8601 string. | |
| auto | wait_time_ms () const -> double |
| Converts wait_time to milliseconds. | |
| auto | execution_time_ms () const -> double |
| Converts execution_time to milliseconds. | |
| auto | is_terminal () const -> bool |
| Checks if this is a terminal event (job finished). | |
| auto | is_error () const -> bool |
| Checks if this event indicates an error. | |
| auto | to_json () const -> std::string |
| Converts the event to a JSON string. | |
| auto | to_string () const -> std::string |
| Converts the event to a human-readable string. | |
Public Attributes | |
| std::uint64_t | event_id {0} |
| Unique identifier for this event. | |
| std::uint64_t | job_id {0} |
| ID of the job this event relates to. | |
| std::string | job_name |
| Human-readable name of the job. | |
| event_type | type {event_type::enqueued} |
| Type of event that occurred. | |
| std::chrono::steady_clock::time_point | timestamp |
| Time when the event occurred. | |
| std::chrono::system_clock::time_point | system_timestamp |
| System time when the event occurred. | |
| std::thread::id | thread_id |
| ID of the thread that processed this event. | |
| std::size_t | worker_id {0} |
| Worker ID that processed this job. | |
| std::chrono::nanoseconds | wait_time {0} |
| Time spent waiting in queue before dequeue. | |
| std::chrono::nanoseconds | execution_time {0} |
| Time spent executing the job. | |
| std::optional< int > | error_code |
| Error code if the job failed. | |
| std::optional< std::string > | error_message |
| Error message if the job failed. | |
Event data for job execution tracing.
Contains detailed information about a job execution event, suitable for logging, tracing, and monitoring purposes.
Definition at line 97 of file execution_event.h.
|
inlinenodiscard |
Converts execution_time to milliseconds.
Definition at line 212 of file execution_event.h.
References execution_time.
Referenced by to_json(), and to_string().

|
inlinenodiscard |
Formats the event timestamp as ISO 8601 string.
Definition at line 185 of file execution_event.h.
References system_timestamp.
Referenced by to_json(), and to_string().

|
inlinenodiscard |
Checks if this event indicates an error.
Definition at line 232 of file execution_event.h.
References kcenon::thread::diagnostics::cancelled, kcenon::thread::diagnostics::failed, and type.
|
inlinenodiscard |
Checks if this is a terminal event (job finished).
Definition at line 221 of file execution_event.h.
References kcenon::thread::diagnostics::cancelled, kcenon::thread::diagnostics::completed, kcenon::thread::diagnostics::failed, and type.
|
inlinenodiscard |
Converts the event to a JSON string.
Output format:
Definition at line 259 of file execution_event.h.
References error_message, event_id, kcenon::thread::diagnostics::event_type_to_string(), execution_time_ms(), format_timestamp(), job_name, thread_id, type, wait_time_ms(), and worker_id.

|
inlinenodiscard |
Converts the event to a human-readable string.
Output format:
Definition at line 311 of file execution_event.h.
References error_message, event_id, kcenon::thread::diagnostics::event_type_to_string(), execution_time_ms(), format_timestamp(), job_name, thread_id, type, wait_time_ms(), and worker_id.

|
inlinenodiscard |
Converts wait_time to milliseconds.
Definition at line 203 of file execution_event.h.
References wait_time.
Referenced by to_json(), and to_string().

| std::optional<int> kcenon::thread::diagnostics::job_execution_event::error_code |
Error code if the job failed.
Definition at line 170 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work().
| std::optional<std::string> kcenon::thread::diagnostics::job_execution_event::error_message |
Error message if the job failed.
Definition at line 175 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), to_json(), and to_string().
| std::uint64_t kcenon::thread::diagnostics::job_execution_event::event_id {0} |
Unique identifier for this event.
Monotonically increasing within the thread pool lifetime.
Definition at line 104 of file execution_event.h.
Referenced by to_json(), and to_string().
| std::chrono::nanoseconds kcenon::thread::diagnostics::job_execution_event::execution_time {0} |
Time spent executing the job.
Only valid for completed, failed, cancelled events.
Definition at line 161 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), and execution_time_ms().
| std::uint64_t kcenon::thread::diagnostics::job_execution_event::job_id {0} |
ID of the job this event relates to.
Definition at line 109 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work().
| std::string kcenon::thread::diagnostics::job_execution_event::job_name |
Human-readable name of the job.
Definition at line 114 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), to_json(), and to_string().
| std::chrono::system_clock::time_point kcenon::thread::diagnostics::job_execution_event::system_timestamp |
System time when the event occurred.
Used for logging and correlation with external systems.
Definition at line 131 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), and format_timestamp().
| std::thread::id kcenon::thread::diagnostics::job_execution_event::thread_id |
ID of the thread that processed this event.
May be empty for enqueued events.
Definition at line 138 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), to_json(), and to_string().
| std::chrono::steady_clock::time_point kcenon::thread::diagnostics::job_execution_event::timestamp |
Time when the event occurred.
Definition at line 124 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work().
| event_type kcenon::thread::diagnostics::job_execution_event::type {event_type::enqueued} |
Type of event that occurred.
Definition at line 119 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), is_error(), is_terminal(), to_json(), and to_string().
| std::chrono::nanoseconds kcenon::thread::diagnostics::job_execution_event::wait_time {0} |
Time spent waiting in queue before dequeue.
Only valid for dequeued, started events and later.
Definition at line 154 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), and wait_time_ms().
| std::size_t kcenon::thread::diagnostics::job_execution_event::worker_id {0} |
Worker ID that processed this job.
Definition at line 143 of file execution_event.h.
Referenced by kcenon::thread::thread_worker::do_work(), to_json(), and to_string().