未验证 提交 b85b2814 编写于 作者: X Xie Yanbo 提交者: GitHub

update profiling pause function (#458)

* fix the hit of pause function

* display the paused status

* display refresh interval in header
上级 796a7126
......@@ -198,16 +198,17 @@ func (p *profiler) flush(timeStamp time.Time, keyStats []keyStat, done bool) {
}
}
output := make([]string, 3)
output[0] = fmt.Sprintf("> JuiceFS Profiling %13s %45s", head, timeStamp.Format("2006-01-02T15:04:05"))
output[0] = fmt.Sprintf("> JuiceFS Profiling %13s Refresh: %.0f seconds %20s",
head, p.interval.Seconds(), timeStamp.Format("2006-01-02T15:04:05"))
output[2] = fmt.Sprintf("%-14s %10s %15s %18s %14s", "Operation", "Count", "Average(us)", "Total(us)", "Percent(%)")
for _, s := range keyStats {
output = append(output, fmt.Sprintf("%-14s %10d %15.0f %18d %14.1f",
s.key, s.sPtr.count, float64(s.sPtr.total)/float64(s.sPtr.count), s.sPtr.total, float64(s.sPtr.total)/float64(p.interval.Microseconds())*100.0))
}
printLines(output, p.tty)
if p.replay {
output[1] = fmt.Sprintln("\n[enter]Pause/Continue")
}
printLines(output, p.tty)
}
func (p *profiler) flusher() {
......@@ -245,6 +246,7 @@ func (p *profiler) flusher() {
os.Exit(0)
}
case paused = <-p.pause:
fmt.Printf("\n\033[97mPaused. Press [enter] to continue.\n\033[0m")
<-p.pause
case done = <-p.done:
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册