Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::dag_job_info Struct Reference

Information about a job in the DAG. More...

#include <dag_job.h>

Collaboration diagram for kcenon::thread::dag_job_info:
Collaboration graph

Public Member Functions

auto get_wait_time () const -> std::chrono::milliseconds
 Calculate wait time (time from submit to start)
 
auto get_execution_time () const -> std::chrono::milliseconds
 Calculate execution time.
 

Public Attributes

job_id id {INVALID_JOB_ID}
 Unique job identifier.
 
std::string name
 Human-readable job name.
 
dag_job_state state {dag_job_state::pending}
 Current job state.
 
std::vector< job_iddependencies
 Jobs this job depends on.
 
std::vector< job_iddependents
 Jobs that depend on this job.
 
std::chrono::steady_clock::time_point submit_time
 When job was added to DAG.
 
std::chrono::steady_clock::time_point start_time
 When execution started.
 
std::chrono::steady_clock::time_point end_time
 When execution ended.
 
std::optional< std::string > error_message
 Error message if failed.
 
std::optional< std::any > result
 Result value for passing between jobs.
 

Detailed Description

Information about a job in the DAG.

This structure provides a snapshot of a job's state and metadata for monitoring and debugging purposes.

Definition at line 82 of file dag_job.h.

Member Function Documentation

◆ get_execution_time()

auto kcenon::thread::dag_job_info::get_execution_time ( ) const -> std::chrono::milliseconds
inlinenodiscard

Calculate execution time.

Returns
Execution duration, or zero if not completed

Definition at line 115 of file dag_job.h.

116 {
117 if (end_time == std::chrono::steady_clock::time_point{} ||
118 start_time == std::chrono::steady_clock::time_point{})
119 {
120 return std::chrono::milliseconds{0};
121 }
122 return std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
123 }
std::chrono::steady_clock::time_point end_time
When execution ended.
Definition dag_job.h:93
std::chrono::steady_clock::time_point start_time
When execution started.
Definition dag_job.h:92

References end_time, and start_time.

◆ get_wait_time()

auto kcenon::thread::dag_job_info::get_wait_time ( ) const -> std::chrono::milliseconds
inlinenodiscard

Calculate wait time (time from submit to start)

Returns
Wait duration, or zero if not started

Definition at line 102 of file dag_job.h.

103 {
104 if (start_time == std::chrono::steady_clock::time_point{})
105 {
106 return std::chrono::milliseconds{0};
107 }
108 return std::chrono::duration_cast<std::chrono::milliseconds>(start_time - submit_time);
109 }
std::chrono::steady_clock::time_point submit_time
When job was added to DAG.
Definition dag_job.h:91

References start_time, and submit_time.

Member Data Documentation

◆ dependencies

std::vector<job_id> kcenon::thread::dag_job_info::dependencies

Jobs this job depends on.

Definition at line 88 of file dag_job.h.

◆ dependents

std::vector<job_id> kcenon::thread::dag_job_info::dependents

Jobs that depend on this job.

Definition at line 89 of file dag_job.h.

◆ end_time

std::chrono::steady_clock::time_point kcenon::thread::dag_job_info::end_time

When execution ended.

Definition at line 93 of file dag_job.h.

Referenced by get_execution_time().

◆ error_message

std::optional<std::string> kcenon::thread::dag_job_info::error_message

Error message if failed.

Definition at line 95 of file dag_job.h.

◆ id

job_id kcenon::thread::dag_job_info::id {INVALID_JOB_ID}

Unique job identifier.

Definition at line 84 of file dag_job.h.

constexpr job_id INVALID_JOB_ID
Invalid job ID constant.
Definition dag_job.h:38

Referenced by kcenon::thread::dag_job::get_info().

◆ name

std::string kcenon::thread::dag_job_info::name

Human-readable job name.

Definition at line 85 of file dag_job.h.

◆ result

std::optional<std::any> kcenon::thread::dag_job_info::result

Result value for passing between jobs.

Definition at line 96 of file dag_job.h.

◆ start_time

std::chrono::steady_clock::time_point kcenon::thread::dag_job_info::start_time

When execution started.

Definition at line 92 of file dag_job.h.

Referenced by get_execution_time(), and get_wait_time().

◆ state

dag_job_state kcenon::thread::dag_job_info::state {dag_job_state::pending}

Current job state.

Definition at line 86 of file dag_job.h.

@ pending
Waiting for dependencies to complete.

◆ submit_time

std::chrono::steady_clock::time_point kcenon::thread::dag_job_info::submit_time

When job was added to DAG.

Definition at line 91 of file dag_job.h.

Referenced by get_wait_time().


The documentation for this struct was generated from the following file: