moirai_async/executor/stats.rs
1use std::sync::atomic::AtomicU64;
2
3/// Statistics for async executor performance monitoring.
4#[derive(Debug, Default)]
5pub(super) struct AsyncExecutorStats {
6 pub(super) tasks_spawned: AtomicU64,
7 pub(super) tasks_completed: AtomicU64,
8 pub(super) total_execution_time_ns: AtomicU64,
9 /// Currently untracked: no executor path increments this counter, so it
10 /// always reads 0. The increment sites belong in the waker/poll paths of
11 /// `executor/core.rs`/`executor/waker.rs`; wiring is pending there.
12 pub(super) waker_notifications: AtomicU64,
13 /// Currently untracked: no executor path increments this counter, so it
14 /// always reads 0. The increment sites belong in the reactor dispatch path
15 /// of `executor/core.rs`; wiring is pending there.
16 pub(super) io_operations: AtomicU64,
17 pub(super) tasks_pending: AtomicU64,
18}
19
20/// Public statistics structure for monitoring executor performance.
21#[derive(Debug, Clone)]
22pub struct ExecutorStats {
23 /// Total number of tasks spawned
24 pub tasks_spawned: u64,
25 /// Total number of tasks completed
26 pub tasks_completed: u64,
27 /// Number of tasks currently pending
28 pub tasks_pending: u64,
29 /// Total execution time in nanoseconds
30 pub total_execution_time_ns: u64,
31 /// Number of waker notifications sent.
32 ///
33 /// Currently untracked: the executor does not increment this counter yet,
34 /// so it always reads 0 (pending wiring in the executor core/waker paths).
35 pub waker_notifications: u64,
36 /// Number of I/O operations processed.
37 ///
38 /// Currently untracked: the executor does not increment this counter yet,
39 /// so it always reads 0 (pending wiring in the executor core).
40 pub io_operations: u64,
41}