mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 19:11:30 +01:00
zsh: add tracing module
This commit is contained in:
parent
b96f0a6f86
commit
e32676922e
18
functions/tracing.zsh
Normal file
18
functions/tracing.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/zsh
|
||||
|
||||
function start_tracing {
|
||||
zmodload zsh/zprof
|
||||
zmodload zsh/datetime
|
||||
setopt PROMPT_SUBST
|
||||
PS4+='+$EPOCHREALTIME %N:%i> '
|
||||
logfile=$(mktemp 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 | vimscratch -
|
||||
}
|
Loading…
Reference in New Issue
Block a user