diff options
author | 2019-06-11 11:19:06 -0700 | |
---|---|---|
committer | 2019-06-13 11:26:06 -0700 | |
commit | 3dac80e519f330fb5025080bb1ccfa471d73e206 (patch) | |
tree | f081e78ebf99013a6a9aacf69a8c32cd06da79bd /ui/terminal/util.go | |
parent | 4355ee64a9b27713c1b7aa68d8d935fd8def484d (diff) |
Support an action table that shows longest running actions
If SOONG_UI_TABLE_HEIGHT is set, enable a new smart terminal display
that prints the normal scrolling build history in the top region of
the screen and an action table of the longest currently running
actions in the bottom region of the screen. This provides better
visibility into which are the longest running actions and when the
build parallelism is very low.
Test: manual
Change-Id: I677d7b6b008699febd259110d7f9e0f98d80c535
Diffstat (limited to 'ui/terminal/util.go')
-rw-r--r-- | ui/terminal/util.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ui/terminal/util.go b/ui/terminal/util.go index 3a11b79bb..c9377f156 100644 --- a/ui/terminal/util.go +++ b/ui/terminal/util.go @@ -35,7 +35,7 @@ func isSmartTerminal(w io.Writer) bool { return false } -func termWidth(w io.Writer) (int, bool) { +func termSize(w io.Writer) (width int, height int, ok bool) { if f, ok := w.(*os.File); ok { var winsize struct { ws_row, ws_column uint16 @@ -44,11 +44,11 @@ func termWidth(w io.Writer) (int, bool) { _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, f.Fd(), syscall.TIOCGWINSZ, uintptr(unsafe.Pointer(&winsize)), 0, 0, 0) - return int(winsize.ws_column), err == 0 + return int(winsize.ws_column), int(winsize.ws_row), err == 0 } else if f, ok := w.(*fakeSmartTerminal); ok { - return f.termWidth, true + return f.termWidth, f.termHeight, true } - return 0, false + return 0, 0, false } // stripAnsiEscapes strips ANSI control codes from a byte array in place. @@ -106,5 +106,5 @@ func stripAnsiEscapes(input []byte) []byte { type fakeSmartTerminal struct { bytes.Buffer - termWidth int + termWidth, termHeight int } |