Skip to content

Commit e3cf82b

Browse files
hdshawkw
andcommitted
docs(console): add column descriptions for all tables (#431)
We often receive questions about the meaning of certain columns in the different views in Tokio Console. This change adds additional documentation to the `tokio-console` README - which is also used in the docs.rs main page - describing each column in the tasks, resources, and async ops tables. Where there are a fixed set of values possible in the column, those values are also described. Additionally, the 4 views are enumerated and separated into sections to aid readability and allow deep linking. Co-authored-by: Eliza Weisman <[email protected]>
1 parent cd1a277 commit e3cf82b

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

Diff for: tokio-console/README.md

+71-2
Original file line numberDiff line numberDiff line change
@@ -97,30 +97,87 @@ tokio-console http://my.instrumented.application.local:6669
9797

9898
See [here][cli-ref] for a complete list of all command-line arguments.
9999

100+
Tokio Console has a numnber of different views:
101+
* [Tasks List](#tasks-list)
102+
* [Task Details](#task-details)
103+
* [Resources List](#resources-list)
104+
* [Resource Details](#resource-details)
105+
106+
### Tasks List
107+
100108
When the console CLI is launched, it displays a list of all [asynchronous tasks]
101109
in the program:
102110

103111
![tasks list](https://raw.githubusercontent.com/tokio-rs/console/main/assets/tokio-console-0.1.8/tasks_list.png)
104112

113+
Tasks are displayed in a table.
114+
115+
* `Warn` - The number of warnings active for the task.
116+
* `ID` - The ID of the task. This is the same as the value returned by the unstable [`tokio::task::Id`](https://docs.rs/tokio/latest/tokio/task/struct.Id.html) API (see documentation for details).
117+
* `State` - The state of the task.
118+
* `RUNNING`/▶ - Task is currently being polled.
119+
* `IDLE`/⏸ - Task is waiting on some resource.
120+
* `SCHED`/⏫ - Task is scheduled (it has been woken but not yet polled).
121+
* `DONE`/⏹ - Task has completed.
122+
* `Name` - The name of the task, which can be set when spawning a task using the unstable [`tokio::task::Builder::name()`](https://docs.rs/tokio/latest/tokio/task/struct.Builder.html#method.name) API.
123+
* `Total` - Duration the task has been alive (sum of Busy, Sched, and Idle).
124+
* `Busy` - Total duration for which the task has been actively executing.
125+
* `Sched` - Total duration for which the task has been scheduled to be polled by the runtime.
126+
* `Idle` - Total duration for which the task has been idle (waiting to be woken).
127+
* `Polls` - Number of times the task has been polled.
128+
* `Target` - The target of the span used to record the task.
129+
* `tokio::task` - Async task.
130+
* `tokio::task::blocking` - A blocking task (created with [tokio::task::spawn_blocking](https://docs.rs/tokio/latest/tokio/task/fn.spawn_blocking.html)).
131+
* `Location` - The source code location where the task was spawned from.
132+
* `Fields` - Additional fields on the task span.
133+
* `kind` - may be `task` (for async tasks) or `blocking` (for blocking tasks).
134+
* `fn` - function signature for blocking tasks. Async tasks don't record this field, as it is generally very large when using `async`/`await`.
135+
105136
Using the <kbd>&#8593;</kbd> and <kbd>&#8595;</kbd> arrow keys, an individual task can be highlighted.
106137
Pressing<kbd>enter</kbd> while a task is highlighted displays details about that
107-
task:
138+
task.
139+
140+
### Task Details
141+
142+
This view shows details about a specific task:
108143

109144
![task details](https://raw.githubusercontent.com/tokio-rs/console/main/assets/tokio-console-0.1.8/task_details.png)
110145

146+
The task details view includes percentiles and a visual histogram of the polling (busy) times
147+
and scheduled times.
148+
111149
Pressing the <kbd>escape</kbd> key returns to the task list.
112150

151+
### Resources List
152+
113153
The <kbd>r</kbd> key switches from the list of tasks to a list of [resources],
114154
such as synchronization primitives, I/O resources, et cetera:
115155

116156
![resource list](https://raw.githubusercontent.com/tokio-rs/console/main/assets/tokio-console-0.1.8/resources_list.png)
117157

158+
Resources are displayed in a table similar to the task list.
159+
160+
* `ID` - The ID of the resource. This is a display ID as there is no internal resource ID to reference.
161+
* `Parent` - The ID of the parent resource if it exists.
162+
* `Kind` - The resource kind, this is a high level grouping of resources.
163+
* `Sync` - Synchronization resources from [`tokio::sync`](https://docs.rs/tokio/latest/tokio/sync/index.html) such as [`Mutex`](https://docs.rs/tokio/latest/tokio/sync/struct.Mutex.html).
164+
* `Timer` - Timer resources from [`tokio::time`](https://docs.rs/tokio/latest/tokio/time/index.html) such as [`Sleep`](https://docs.rs/tokio/latest/tokio/time/struct.Sleep.html).
165+
* `Total` - Total duration that this resource has been alive.
166+
* `Target` - The module path of the resource type.
167+
* `Type` - The specific type of the resource, possible values depend on the resources instrumented in Tokio, which may vary between versions.
168+
* `Vis` - The visibility of the resource.
169+
* `INT`/🔒 - Internal, this resource is only used by other resources.
170+
* `PUB`/✅ - Public, available in the public Tokio API.
171+
* `Location` - The source code location where the resource was created.
172+
* `Attributes` - Additional resource-dependent attributes, for example a resource of type `Sleep` record the `duration` of the sleep.
118173

119174
Pressing the <kbd>t</kbd> key switches the view back to the task list.
120175

121176
Like the task list view, the resource list view can be navigated using the
122177
<kbd>&#8593;</kbd> and <kbd>&#8595;</kbd> arrow keys. Pressing <kbd>enter</kbd>
123-
while a resource is highlighted displays details about that resource:
178+
while a resource is highlighted displays details about that resource.
179+
180+
### Resource Details
124181

125182
![resource details --- sleep](https://raw.githubusercontent.com/tokio-rs/console/main/assets/tokio-console-0.1.8/resource_details_sleep.png)
126183

@@ -130,6 +187,18 @@ a large number of tasks, such as this private `tokio::sync::batch_semaphore::Sem
130187

131188
![resource details --- semaphore](https://raw.githubusercontent.com/tokio-rs/console/main/assets/tokio-console-0.1.8/resource_details_semaphore.png)
132189

190+
The resource details view includes a table of async ops belonging to the resource.
191+
192+
* `ID` - The ID of the async op. This is a display ID similar to those recorded for resources.
193+
* `Parent` - The ID of the parent async op, if it exists.
194+
* `Task` - The ID and name of the task which performed this async op.
195+
* `Source` - The method where the async op is being called from.
196+
* `Total` - Total duration for which the async op has been alive (sum of Busy and Idle, as an async op has no scheduled state).
197+
* `Busy` - Total duration for which the async op has been busy (its future is actively being polled).
198+
* `Idle` - Total duration for which the async op has been idle (the future exists but is not being polled).
199+
* `Polls` - Number of times the async op has been polled.
200+
* `Attributes` - Additional attributes from the async op. These will vary based on the type of the async op.
201+
133202
Like the task details view, pressing the <kbd>escape</kbd> key while viewing a resource's details
134203
returns to the resource list.
135204

0 commit comments

Comments
 (0)