inputstat is a vmstat-like tool which monitors keyboard and mouse events on linux. in detail, collects and reports the activity statistics of keyboard and mouse. And it is written by rust.
```c
$ sudo inputstat -k /dev/input/event5 -m /dev/input/event6 5 # print every 5 seconds
summary counts 14676 ## keyboard counts 9460 ## mouse counts 5216 KEYBACKSPACE -> 1181 ## KEYSPACE -> 719 ## KEYJ -> 432 ## KEYLEFTCTRL -> 402 ## KEYI -> 376 ## WHEEL -> 3401 ## BTNLEFT -> 1778 ## BTNRIGHT -> 30 ## BTNMIDDLE -> 7 ##
summary counts 14676 ## keyboard counts 9460 ## mouse counts 5216 KEYBACKSPACE -> 1181 ## KEYSPACE -> 719 ## KEYJ -> 432 ## KEYLEFTCTRL -> 402 ## KEYI -> 376 ## WHEEL -> 3401 ## BTNLEFT -> 1778 ## BTNRIGHT -> 30 ## BTNMIDDLE -> 7 ##
```
shell
cargo install inputstat
k_thread m_thread collect_thread display_thread
|______|____mpsc_____7 \_____Arc______|