|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Information about a job in the thread pool. More...
#include <job_info.h>

Public Member Functions | |
| auto | total_latency () const -> std::chrono::nanoseconds |
| Calculates total latency (wait + execution time). | |
| auto | is_finished () const -> bool |
| Checks if the job has finished execution. | |
| auto | is_active () const -> bool |
| Checks if the job is still active (pending or running). | |
| auto | wait_time_ms () const -> double |
| Converts wait_time to milliseconds. | |
| auto | execution_time_ms () const -> double |
| Converts execution_time to milliseconds. | |
| auto | to_json () const -> std::string |
| Converts the job info to a JSON string. | |
| auto | to_string () const -> std::string |
| Converts the job info to a human-readable string. | |
Public Attributes | |
| std::uint64_t | job_id {0} |
| Unique identifier for this job. | |
| std::string | job_name |
| Human-readable name or description of the job. | |
| std::chrono::steady_clock::time_point | enqueue_time |
| Time when the job was added to the queue. | |
| std::chrono::steady_clock::time_point | start_time |
| Time when the job started executing. | |
| std::optional< std::chrono::steady_clock::time_point > | end_time |
| Time when the job finished (completed, failed, or cancelled). | |
| std::chrono::nanoseconds | wait_time {0} |
| Time spent waiting in the queue before execution. | |
| std::chrono::nanoseconds | execution_time {0} |
| Time spent executing the job. | |
| job_status | status {job_status::pending} |
| Current status of the job. | |
| std::optional< std::string > | error_message |
| Error message if the job failed. | |
| std::thread::id | executed_by |
| ID of the thread that executed/is executing the job. | |
| std::optional< std::string > | stack_trace |
| Stack trace captured when the job failed. | |
Information about a job in the thread pool.
Contains comprehensive information about a job including its identity, timing information, execution status, and error details.
Definition at line 89 of file job_info.h.
|
inlinenodiscard |
Converts execution_time to milliseconds.
Definition at line 214 of file job_info.h.
References execution_time.
Referenced by to_json(), and to_string().

|
inlinenodiscard |
Checks if the job is still active (pending or running).
Definition at line 195 of file job_info.h.
References kcenon::thread::diagnostics::pending, kcenon::thread::diagnostics::running, and status.
|
inlinenodiscard |
Checks if the job has finished execution.
Definition at line 183 of file job_info.h.
References kcenon::thread::diagnostics::cancelled, kcenon::thread::diagnostics::completed, kcenon::thread::diagnostics::failed, status, and kcenon::thread::diagnostics::timed_out.
|
inlinenodiscard |
Converts the job info to a JSON string.
Output format:
Definition at line 237 of file job_info.h.
References error_message, executed_by, execution_time_ms(), job_name, kcenon::thread::diagnostics::job_status_to_string(), stack_trace, status, total_latency(), and wait_time_ms().

|
inlinenodiscard |
Converts the job info to a human-readable string.
Output format:
Definition at line 284 of file job_info.h.
References error_message, executed_by, execution_time_ms(), job_name, kcenon::thread::diagnostics::job_status_to_string(), status, total_latency(), and wait_time_ms().

|
inlinenodiscard |
Calculates total latency (wait + execution time).
Definition at line 174 of file job_info.h.
References execution_time, and wait_time.
Referenced by to_json(), and to_string().

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

| std::optional<std::chrono::steady_clock::time_point> kcenon::thread::diagnostics::job_info::end_time |
Time when the job finished (completed, failed, or cancelled).
Only has a value if the job has finished execution.
Definition at line 125 of file job_info.h.
| std::chrono::steady_clock::time_point kcenon::thread::diagnostics::job_info::enqueue_time |
Time when the job was added to the queue.
Definition at line 110 of file job_info.h.
| std::optional<std::string> kcenon::thread::diagnostics::job_info::error_message |
Error message if the job failed.
Only has a value if status == failed or status == timed_out.
Definition at line 153 of file job_info.h.
Referenced by to_json(), and to_string().
| std::thread::id kcenon::thread::diagnostics::job_info::executed_by |
ID of the thread that executed/is executing the job.
Only valid if status >= running.
Definition at line 160 of file job_info.h.
Referenced by to_json(), and to_string().
| std::chrono::nanoseconds kcenon::thread::diagnostics::job_info::execution_time {0} |
Time spent executing the job.
Calculated as: end_time - start_time. For running jobs, this is the current execution time.
Definition at line 141 of file job_info.h.
Referenced by execution_time_ms(), and total_latency().
| std::uint64_t kcenon::thread::diagnostics::job_info::job_id {0} |
Unique identifier for this job.
Generated when the job is created, unique within the lifetime of the thread pool.
Definition at line 97 of file job_info.h.
Referenced by kcenon::thread::thread_worker::get_current_job_info(), and kcenon::thread::job_queue::inspect_pending_jobs().
| std::string kcenon::thread::diagnostics::job_info::job_name |
Human-readable name or description of the job.
May be empty if the job was not named. Used for logging and debugging purposes.
Definition at line 105 of file job_info.h.
Referenced by to_json(), and to_string().
| std::optional<std::string> kcenon::thread::diagnostics::job_info::stack_trace |
Stack trace captured when the job failed.
Only has a value if status == failed and stack trace capture was enabled.
Definition at line 168 of file job_info.h.
Referenced by to_json().
| std::chrono::steady_clock::time_point kcenon::thread::diagnostics::job_info::start_time |
Time when the job started executing.
Only valid if status >= running. Will be the same as enqueue_time for pending jobs until they start.
Definition at line 118 of file job_info.h.
| job_status kcenon::thread::diagnostics::job_info::status {job_status::pending} |
Current status of the job.
Definition at line 146 of file job_info.h.
Referenced by is_active(), is_finished(), to_json(), and to_string().
| std::chrono::nanoseconds kcenon::thread::diagnostics::job_info::wait_time {0} |
Time spent waiting in the queue before execution.
Calculated as: start_time - enqueue_time. For pending jobs, this is the current wait time.
Definition at line 133 of file job_info.h.
Referenced by total_latency(), and wait_time_ms().