Die Funktionalität von REPORTTIME
scheint zum Vergleich hart codiert zu sein usertime+systime
. Der relevante zsh-Quellcode für die REPORTTIME
Funktionalität:
#ifdef HAVE_GETRUSAGE reporttime -= j->procs->ti.ru_utime.tv_sec + j->procs->ti.ru_stime.tv_sec; if (j->procs->ti.ru_utime.tv_usec + j->procs->ti.ru_stime.tv_usec >= 1000000) reporttime--; return reporttime <= 0; #else { clktck = get_clktck(); return ((j->procs->ti.ut + j->procs->ti.st) / clktck >= reporttime); } #endif
Als alternative Lösung können Sie Ihre zshrc so ändern, dass REPORTTIME
die Gesamtbetriebszeit verwendet wird.
REPORTTIME_TOTAL=5 # Displays the execution time of the last command if set threshold was exceeded cmd_execution_time() { local stop=$((`date "+%s + %N / 1_000_000_000.0"`)) let local "elapsed = $ - $" (( $elapsed > $REPORTTIME_TOTAL )) && print -P "%F$s%f" } # Get the start time of the command preexec() { cmd_start_time=$((`date "+%s + %N / 1.0e9"`)) } # Output total execution precmd() { if (($+cmd_start_time)); then cmd_execution_time fi }
Leider gibt dieser Befehl nur die Gesamtlaufzeit an. Es teilt die Ausführungszeit nicht in Benutzer- und Systemzeit auf.