mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-04 16:51:31 +01:00
23 lines
425 B
Bash
23 lines
425 B
Bash
#!/bin/zsh
|
|
|
|
function start_tracing {
|
|
zmodload zsh/zprof
|
|
zmodload zsh/datetime
|
|
|
|
setopt PROMPT_SUBST
|
|
PS4+='+$EPOCHREALTIME %N:%i> '
|
|
logfile=$(mktemp --tmpdir zsh_profile.XXXXXXXX)
|
|
echo "logging to $logfile"
|
|
exec 3>&2 2>$logfile
|
|
setopt XTRACE
|
|
}
|
|
|
|
function stop_tracing {
|
|
unsetopt XTRACE
|
|
exec 2>&3 3>&-
|
|
zprof | tee zprof_out.log | vim -c "set buftype=nofile" -
|
|
|
|
zmodload -u zsh/zprof
|
|
zmodload -u zsh/datetime
|
|
}
|