Add ttop example
This commit is contained in:
parent
9ec1539ccc
commit
e62b592964
@ -3,18 +3,20 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"bufio"
|
"bufio"
|
||||||
"os"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"errors"
|
|
||||||
"runtime"
|
"github.com/gizak/termui"
|
||||||
"github.com/marigs/termui"
|
"github.com/gizak/termui/extra"
|
||||||
)
|
)
|
||||||
|
|
||||||
const statFilePath = "/proc/stat"
|
const statFilePath = "/proc/stat"
|
||||||
@ -211,7 +213,6 @@ func NewCpuTabElems(width int) *CpuTabElems {
|
|||||||
LChart: lc}
|
LChart: lc}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (cte *CpuTabElems) AddGauge(key string, Y int, width int) *termui.Gauge {
|
func (cte *CpuTabElems) AddGauge(key string, Y int, width int) *termui.Gauge {
|
||||||
cte.GMap[key] = termui.NewGauge()
|
cte.GMap[key] = termui.NewGauge()
|
||||||
cte.GMap[key].Width = width
|
cte.GMap[key].Width = width
|
||||||
@ -287,10 +288,10 @@ func main() {
|
|||||||
header.HasBorder = false
|
header.HasBorder = false
|
||||||
header.TextBgColor = termui.ColorBlue
|
header.TextBgColor = termui.ColorBlue
|
||||||
|
|
||||||
tabCpu := termui.NewTab("CPU")
|
tabCpu := extra.NewTab("CPU")
|
||||||
tabMem := termui.NewTab("MEM")
|
tabMem := extra.NewTab("MEM")
|
||||||
|
|
||||||
tabpane := termui.NewTabpane()
|
tabpane := extra.NewTabpane()
|
||||||
tabpane.Y = 1
|
tabpane.Y = 1
|
||||||
tabpane.Width = 30
|
tabpane.Width = 30
|
||||||
tabpane.HasBorder = false
|
tabpane.HasBorder = false
|
||||||
@ -365,4 +366,3 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user