Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

counters: add --ipcs command for showing IPC counters by interface #452

Merged
merged 31 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ef56e31
working `humility counters` command
hawkw Mar 6, 2024
8706de3
okay i feel good about this
hawkw Mar 7, 2024
230aeae
sort IPC counters
hawkw Mar 7, 2024
c690126
fail if no IPC counters were found
hawkw Mar 7, 2024
6122ec8
cleanup
hawkw Mar 8, 2024
badd61c
add colors to IPC counters
hawkw Mar 8, 2024
69da326
tweak format
hawkw Mar 8, 2024
71ff8fb
add docs
hawkw Mar 8, 2024
6c715a6
wip add tests
hawkw Mar 9, 2024
444632b
update test expected statuses
hawkw Mar 9, 2024
cbf9de2
make arrow directions more @cbiffle-friendly
hawkw Mar 10, 2024
b5943f1
fix `--full` skipping ifaces that are all 0
hawkw Mar 10, 2024
52232ff
add test for --ipc --full
hawkw Mar 10, 2024
fe56f03
refactor `populate` back into a method
hawkw Mar 11, 2024
007df21
tweak naming again
hawkw Mar 11, 2024
9f5563d
blargh i broke it
hawkw Mar 11, 2024
d849d07
whoops this isn't supposed to fail
hawkw Mar 11, 2024
9417676
WIP redo output format
hawkw Mar 11, 2024
0e7d03e
back to math class
hawkw Mar 12, 2024
a26b4d1
cleanup
hawkw Mar 12, 2024
e88987d
more
hawkw Mar 12, 2024
ce765ec
okay it finally looks good
hawkw Mar 12, 2024
dd1cf07
don't tabulate err variants separately if there's only one client
hawkw Mar 12, 2024
d4c9862
also show zero errors in running sum
hawkw Mar 12, 2024
7adf26b
more tweaks
hawkw Mar 12, 2024
3f7fa5a
update docs
hawkw Mar 12, 2024
669c336
add `--client` for filtering on client task namess
hawkw Mar 12, 2024
52ddcb0
update tests & readme
hawkw Mar 12, 2024
2643ba2
move IPC stuff to its own module
hawkw Mar 12, 2024
7997afb
try to make implementation a bit more understandable
hawkw Mar 12, 2024
5931e7e
whoops forgot a license header
hawkw Mar 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

140 changes: 140 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,146 @@ thermal
6 FanAdded
```

##### IPC counters

The `--ipc` argument shows IPC client counters generated automatically by
`idol`, showing the total request count for a given IPC and per-client-task
breakdowns. For example:`

```console
$ humility -d ./hubris.core.0 counters --ipc`
humility: attached to dump
drv_gimlet_hf_api::__HOSTFLASH_CLIENT_COUNTERS
fn HostFlash::get_mux() .............................................. 6 calls
clients:
task host_sp_comms (0 restarts) .................... = 0 ........... = 6 ok

fn HostFlash::set_mux() .............................................. 2 calls
clients:
task gimlet_seq (0 restarts) ....................... + 0 ........... + 1 ok
task host_sp_comms (0 restarts) .................... + 0 ........... + 1 ok
--- ---
totals: = 0 err = 2 ok

fn HostFlash::get_dev() .............................................. 1 calls
clients:
task host_sp_comms (0 restarts) .................... = 0 ........... = 1 ok


drv_gimlet_seq_api::__SEQUENCER_CLIENT_COUNTERS
fn Sequencer::get_state() ......................................... 2017 calls
clients:
task thermal (0 restarts) .......................... + 0 ........ + 1386 ok
task power (0 restarts) ............................ + 0 ......... + 626 ok
task host_sp_comms (0 restarts) .................... + 0 ........... + 5 ok
--- ------
totals: = 0 err = 2017 ok
...
```

When displaying counters by IPC, substring filtering is performed on the
counters variable, but *not* on the client task name. This allows filtering
the output based on the IPC interface. For example:

```console
$ humility -d ./hubris.core.0 counters --ipc sensors
humility: attached to dump
task_sensor_api::__SENSOR_CLIENT_COUNTERS
fn Sensor::post() ................................................ 76717 calls
clients:
task power (0 restarts) ............................ + 0 ....... + 50300 ok
task thermal (0 restarts) .......................... + 0 ....... + 26417 ok
--- -------
totals: = 0 err = 76717 ok

fn Sensor::get_reading() ......................................... 19804 calls
clients:
task thermal (0 restarts) ...................................... = 18101 ok
- Err(NotPresent) ............................... + 1701 ..................
- Err(DeviceError) ................................. + 2 ..................
------ -------
totals: = 1703 err = 18101 ok

fn Sensor::nodata() ............................................... 6225 calls
clients:
task power (0 restarts) ............................ + 0 ........ + 3536 ok
task thermal (0 restarts) .......................... + 0 ........ + 2689 ok
--- ------
totals: = 0 err = 6225 ok

```

Instead, to show only the IPC counters _recorded_ by specific client tasks,
use the `--client` argument, which will filter the output counters to those
recorded in tasks whose names match the provided strings. For example, to
show only IPC counters recorded by the `gimlet_seq` task, use:

```console
$ humility -d ./hubris.core.0 counters --ipc --client gimlet_seq
humility: attached to dump
drv_gimlet_hf_api::__HOSTFLASH_CLIENT_COUNTERS
fn HostFlash::set_mux() .............................................. 1 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ........... = 1 ok


drv_spi_api::__SPI_CLIENT_COUNTERS
fn Spi::exchange() ............................................... 67580 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ....... = 67580 ok

fn Spi::write() .................................................... 530 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ......... = 530 ok

fn Spi::lock() ....................................................... 4 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ........... = 4 ok

fn Spi::release() .................................................... 1 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ........... = 1 ok


drv_stm32xx_sys_api::__SYS_CLIENT_COUNTERS
fn Sys::gpio_read_input() ........................................ 16796 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ....... = 16796 ok

fn Sys::gpio_set_reset() ............................................ 15 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 .......... = 15 ok

fn Sys::gpio_configure_raw() ........................................ 14 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 .......... = 14 ok


task_jefe_api::__JEFE_CLIENT_COUNTERS
fn Jefe::set_state() ................................................. 5 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ........... = 5 ok


task_packrat_api::__PACKRAT_CLIENT_COUNTERS
fn Packrat::set_spd_eeprom() ........................................ 32 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 .......... = 32 ok

fn Packrat::set_mac_address_block() .................................. 1 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ........... = 1 ok

fn Packrat::set_identity() ........................................... 1 calls
clients:
task gimlet_seq (0 restarts) ....................... = 0 ........... = 1 ok
```

Multiple `--client` arguments may be provided, to show IPCs from any of a
set of client tasks.

`--client` may be combined with a filter matching counter variable names, to
show only the calls to specific IPC interfaces from specific tasks.


### `humility dashboard`
Expand Down
2 changes: 2 additions & 0 deletions cmd/counters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ description = "display event counters"

[dependencies]
anyhow = { workspace = true }
colored = { workspace = true }
clap = { workspace = true }
indexmap = { workspace = true }

humility = { workspace = true }
humility-doppel = { workspace = true }
Expand Down
Loading
Loading