CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2020/08/09 19:13:28

Modified files:
        usr.bin/kstat  : kstat.c 

Log message:
add the ability to filter which kstats are displayed.

kstats are identified by a "provider:instance:name:unit" tuple,
where provider and name are strings, and instance and unit are
integers. you can pass tuples as arguments to kstat to select them
for display, eg, to see the rxq and txq stats for the first rings
on an em0 interface, you can run `kstat em0:0:rxq:0 em0:0:txq:0`.

this can be pretty tedious if you want to select a group of stats
quickly though, so there's some wildcard and pattern matching support.

firstly, empty fields in the tuple are wildcarded, eg, if you want
to see all the stats that an mcx0 interface provides then run
`kstat mcx0:::`.

secondly, strings in a tuple (ie, the provider and name fields) are
compared using fnmatch(3) so you can use shell like patterns to
match fields. to expand the last example to all mcx interfaces, you
can run `kstat mcx*:::`.

lastly, you can pass a bare name to match on all kstats with that
name. eg, to see the txq stats for all interfaces, just run
`kstat txq`.

Reply via email to