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

Classes

struct  bottleneck_report
 Analysis report of bottlenecks in the thread pool. More...
 
struct  component_health
 Health status of a single component. More...
 
struct  diagnostics_config
 Configuration options for thread pool diagnostics. More...
 
class  execution_event_listener
 Interface for receiving job execution events. More...
 
struct  health_status
 Comprehensive health status of the thread pool. More...
 
struct  health_thresholds
 Configurable thresholds for health status determination. More...
 
struct  job_execution_event
 Event data for job execution tracing. More...
 
struct  job_info
 Information about a job in the thread pool. More...
 
struct  thread_info
 Information about a worker thread in the pool. More...
 
class  thread_pool_diagnostics
 Comprehensive diagnostics API for thread pool monitoring. More...
 

Enumerations

enum class  bottleneck_type {
  bottleneck_type::none , bottleneck_type::queue_full , bottleneck_type::slow_consumer , bottleneck_type::worker_starvation ,
  bottleneck_type::lock_contention , bottleneck_type::uneven_distribution , bottleneck_type::memory_pressure
}
 Type of bottleneck detected in the thread pool. More...
 
enum class  event_type {
  event_type::enqueued , event_type::dequeued , event_type::started , event_type::completed ,
  event_type::failed , event_type::cancelled , event_type::retried
}
 Type of job execution event. More...
 
enum class  health_state { health_state::healthy , health_state::degraded , health_state::unhealthy , health_state::unknown }
 Overall health state of a component or system. More...
 
enum class  job_status {
  job_status::pending , job_status::running , job_status::completed , job_status::failed ,
  job_status::cancelled , job_status::timed_out
}
 Status of a job in the thread pool. More...
 
enum class  worker_state { worker_state::idle , worker_state::active , worker_state::stopping , worker_state::stopped }
 Current state of a worker thread. More...
 

Functions

auto bottleneck_type_to_string (bottleneck_type type) -> std::string
 Converts bottleneck_type to human-readable string.
 
auto event_type_to_string (event_type type) -> std::string
 Converts event_type to human-readable string.
 
auto health_state_to_string (health_state state) -> std::string
 Converts health_state to human-readable string.
 
auto health_state_to_http_code (health_state state) -> int
 Gets HTTP status code for health state.
 
auto job_status_to_string (job_status status) -> std::string
 Converts job_status to human-readable string.
 
auto worker_state_to_string (worker_state state) -> std::string
 Converts worker_state to human-readable string.
 

Function Documentation

◆ bottleneck_type_to_string()

auto kcenon::thread::diagnostics::bottleneck_type_to_string ( bottleneck_type type) -> std::string
inlinenodiscard

Converts bottleneck_type to human-readable string.

Parameters
typeThe bottleneck type to convert.
Returns
String representation of the bottleneck type.

Definition at line 47 of file bottleneck_report.h.

48 {
49 switch (type)
50 {
51 case bottleneck_type::none: return "none";
52 case bottleneck_type::queue_full: return "queue_full";
53 case bottleneck_type::slow_consumer: return "slow_consumer";
54 case bottleneck_type::worker_starvation: return "worker_starvation";
55 case bottleneck_type::lock_contention: return "lock_contention";
56 case bottleneck_type::uneven_distribution: return "uneven_distribution";
57 case bottleneck_type::memory_pressure: return "memory_pressure";
58 default: return "unknown";
59 }
60 }

References lock_contention, memory_pressure, none, queue_full, slow_consumer, uneven_distribution, and worker_starvation.

Referenced by kcenon::thread::diagnostics::bottleneck_report::to_json(), kcenon::thread::diagnostics::thread_pool_diagnostics::to_json(), and kcenon::thread::diagnostics::bottleneck_report::to_string().

Here is the caller graph for this function:

◆ event_type_to_string()

auto kcenon::thread::diagnostics::event_type_to_string ( event_type type) -> std::string
inlinenodiscard

Converts event_type to human-readable string.

Parameters
typeThe event type to convert.
Returns
String representation of the event type.

Definition at line 51 of file execution_event.h.

52 {
53 switch (type)
54 {
55 case event_type::enqueued: return "enqueued";
56 case event_type::dequeued: return "dequeued";
57 case event_type::started: return "started";
58 case event_type::completed: return "completed";
59 case event_type::failed: return "failed";
60 case event_type::cancelled: return "cancelled";
61 case event_type::retried: return "retried";
62 default: return "unknown";
63 }
64 }

References cancelled, completed, dequeued, enqueued, failed, retried, and started.

Referenced by kcenon::thread::diagnostics::job_execution_event::to_json(), and kcenon::thread::diagnostics::job_execution_event::to_string().

Here is the caller graph for this function:

◆ health_state_to_http_code()

auto kcenon::thread::diagnostics::health_state_to_http_code ( health_state state) -> int
inlinenodiscard

Gets HTTP status code for health state.

Useful for implementing health check HTTP endpoints.

Parameters
stateThe health state.
Returns
HTTP status code (200, 503, etc.).

Definition at line 122 of file health_status.h.

123 {
124 switch (state)
125 {
126 case health_state::healthy: return 200;
127 case health_state::degraded: return 200; // Still operational
128 case health_state::unhealthy: return 503;
129 case health_state::unknown: return 503;
130 default: return 503;
131 }
132 }

References degraded, healthy, unhealthy, and unknown.

Referenced by kcenon::thread::diagnostics::health_status::http_status_code().

Here is the caller graph for this function:

◆ health_state_to_string()

auto kcenon::thread::diagnostics::health_state_to_string ( health_state state) -> std::string
inlinenodiscard

Converts health_state to human-readable string.

Parameters
stateThe state to convert.
Returns
String representation of the health state.

Definition at line 103 of file health_status.h.

104 {
105 switch (state)
106 {
107 case health_state::healthy: return "healthy";
108 case health_state::degraded: return "degraded";
109 case health_state::unhealthy: return "unhealthy";
110 case health_state::unknown: return "unknown";
111 default: return "unknown";
112 }
113 }

References degraded, healthy, unhealthy, and unknown.

Referenced by kcenon::thread::diagnostics::health_status::to_json(), kcenon::thread::diagnostics::thread_pool_diagnostics::to_json(), and kcenon::thread::diagnostics::health_status::to_string().

Here is the caller graph for this function:

◆ job_status_to_string()

auto kcenon::thread::diagnostics::job_status_to_string ( job_status status) -> std::string
inlinenodiscard

Converts job_status to human-readable string.

Parameters
statusThe status to convert.
Returns
String representation of the status.

Definition at line 47 of file job_info.h.

48 {
49 switch (status)
50 {
51 case job_status::pending: return "pending";
52 case job_status::running: return "running";
53 case job_status::completed: return "completed";
54 case job_status::failed: return "failed";
55 case job_status::cancelled: return "cancelled";
56 case job_status::timed_out: return "timed_out";
57 default: return "unknown";
58 }
59 }

References cancelled, completed, failed, pending, running, and timed_out.

Referenced by kcenon::thread::diagnostics::job_info::to_json(), and kcenon::thread::diagnostics::job_info::to_string().

Here is the caller graph for this function:

◆ worker_state_to_string()

auto kcenon::thread::diagnostics::worker_state_to_string ( worker_state state) -> std::string
inlinenodiscard

Converts worker_state to human-readable string.

Parameters
stateThe state to convert.
Returns
String representation of the state.

Definition at line 47 of file thread_info.h.

48 {
49 switch (state)
50 {
51 case worker_state::idle: return "IDLE";
52 case worker_state::active: return "ACTIVE";
53 case worker_state::stopping: return "STOPPING";
54 case worker_state::stopped: return "STOPPED";
55 default: return "UNKNOWN";
56 }
57 }

References active, idle, stopped, and stopping.

Referenced by kcenon::thread::diagnostics::thread_pool_diagnostics::format_thread_dump(), kcenon::thread::diagnostics::thread_info::to_json(), and kcenon::thread::diagnostics::thread_info::to_string().

Here is the caller graph for this function: