mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Log CPU time of external commands in addition to wall-clock time
For certain kinds of performance investigations it is useful to see this, and doesn't terribly pollute the log, so just do this always.
This commit is contained in:
parent
04d62e072b
commit
d81b6d9e1d
|
|
@ -105,12 +105,18 @@ func (self *cmdObjRunner) RunWithOutputAux(cmdObj *CmdObj) (string, error) {
|
|||
}
|
||||
|
||||
t := time.Now()
|
||||
output, err := sanitisedCommandOutput(cmdObj.GetCmd().CombinedOutput())
|
||||
cmd := cmdObj.GetCmd()
|
||||
output, err := sanitisedCommandOutput(cmd.CombinedOutput())
|
||||
if err != nil {
|
||||
self.log.WithField("command", cmdObj.ToString()).Error(output)
|
||||
}
|
||||
|
||||
self.log.Infof("%s (%s)", cmdObj.ToString(), time.Since(t))
|
||||
wall := time.Since(t)
|
||||
if ps := cmd.ProcessState; ps != nil {
|
||||
self.log.Infof("%s (wall %s, cpu %s)", cmdObj.ToString(), wall, ps.UserTime()+ps.SystemTime())
|
||||
} else {
|
||||
self.log.Infof("%s (wall %s)", cmdObj.ToString(), wall)
|
||||
}
|
||||
|
||||
return output, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue