Simply pip install -r requirements.txt
Put the following hook into your $env.config.hooks.env_change.PWD
list
{|before, _|
if $before == null {
let file = $nu.home-path | path join ".local" "share" "nushell" "startup-times.nuon"
if not ($file | path exists) {
mkdir ($file | path dirname)
touch $file
}
let version = (version)
open $file | append {
date: (date now)
time: $nu.startup-time
build: $version.build_rust_channel
allocator: $version.allocator
version: $version.version
commit: $version.commit_hash
build_time: $version.build_time
} | save --force $file
}
}
The shape of the first positional argument should be
table<commit: string, build_time: date, avg: duration, stddev: duration>
in Nushell notation.
let startup_times = open ~/.local/share/nushell/startup-times.nuon
| group-by commit
| transpose commit data
| insert avg {|it| $it.data.time | math avg}
| insert stddev {|it|
$it.data.time | into int | into float | math stddev | into int | into duration
}
| select commit data.build_time.0 avg stddev
| rename -c {data_build_time_0: build_time}
| update build_time { into datetime }
| sort-by build_time
python plot.py ($startup_times | to json)
if there are too many labels on the x axis, you can use the --skip-timestamps (-s)
option.