Notgnoshi / dotfiles

Personal dotfiles and shell scripts
https://agill.xyz
0 stars 0 forks source link

More CSV statistics helpers #114

Closed Notgnoshi closed 9 months ago

Notgnoshi commented 9 months ago

Closes #109 Closes #110 Closes #111 Closes #112 Closes #106 Closes #117

Use case: Given a candump filtered to a specific message, understand the latency distribution.

$ sudo ip link add dev can0 type vcan
$ sudo ip link set up can0
$ cangen can0 &
$ candump -l can0
# wait
$ can2csv candump.log >candump.csv
$ csvdelta -c timestamp --inplace candump.csv
$ csvstats -c "timestamp deltas" candump.csv --histogram 3
num: 539
min: 0.20007610321044922 index: 103
max: 0.6002910137176514 index: 199
sum: 117.06238389015198
mean: 0.21718438569601473
stddev: 0.0572751643876145

image

This isn't a very good example because cangen doesn't have enough variance. Here's a real one

image

Also note that if you don't specify the number of histogram bins yourself, seaborn took way too long (I gave up) to calculate an appropriate number of bins.

Notgnoshi commented 9 months ago

What if instead of a histogram, I make a timeseries plot with the timestamps as the x-axis, and the time-since-last message as the y-axis?

$ csvplot -y time-since-last-das -y time-since-last-sas --ylim 0 0.2 --xlim 20000 60000  sas.csv

image

image

image

image