mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
add pidcount,io to mock collector
This commit is contained in:
parent
288380ca8d
commit
400d9471b6
5
Makefile
5
Makefile
@ -1,7 +1,8 @@
|
||||
NAME=ctop
|
||||
VERSION=$(shell cat VERSION)
|
||||
BUILD=$(shell git rev-parse --short HEAD)
|
||||
LD_FLAGS="-w -X main.version=$(VERSION) -X main.build=$(BUILD) -extldflags=-Wl,--allow-multiple-definition"
|
||||
EXT_LD_FLAGS="-Wl,--allow-multiple-definition"
|
||||
LD_FLAGS="-w -X main.version=$(VERSION) -X main.build=$(BUILD) -extldflags=$(EXT_LD_FLAGS)"
|
||||
|
||||
clean:
|
||||
rm -rf build/ release/
|
||||
@ -11,7 +12,7 @@ build:
|
||||
CGO_ENABLED=0 go build -tags release -ldflags $(LD_FLAGS) -o ctop
|
||||
|
||||
build-dev:
|
||||
go build -ldflags "-w -X main.version=$(VERSION)-dev -X main.build=$(BUILD)"
|
||||
go build -ldflags "-w -X main.version=$(VERSION)-dev -X main.build=$(BUILD) -extldflags=$(EXT_LD_FLAGS)"
|
||||
|
||||
build-all:
|
||||
mkdir -p build
|
||||
|
@ -50,6 +50,11 @@ func (c *Mock) run() {
|
||||
rand.Seed(int64(time.Now().Nanosecond()))
|
||||
defer close(c.stream)
|
||||
|
||||
// set to random static value, once
|
||||
c.Pids = rand.Intn(12)
|
||||
c.IOBytesRead = rand.Int63n(8098) * c.aggression
|
||||
c.IOBytesWrite = rand.Int63n(8098) * c.aggression
|
||||
|
||||
for {
|
||||
c.CPUUtil += rand.Intn(2) * int(c.aggression)
|
||||
if c.CPUUtil >= 100 {
|
||||
|
12
main.go
12
main.go
@ -77,12 +77,6 @@ func main() {
|
||||
config.Toggle("sortReversed")
|
||||
}
|
||||
|
||||
defer Shutdown()
|
||||
// init grid, cursor, header
|
||||
cursor = NewGridCursor(*connectorFlag)
|
||||
cGrid = compact.NewCompactGrid()
|
||||
header = widgets.NewCTopHeader()
|
||||
|
||||
// init ui
|
||||
if *invertFlag {
|
||||
InvertColorMap()
|
||||
@ -92,6 +86,12 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
defer Shutdown()
|
||||
// init grid, cursor, header
|
||||
cursor = NewGridCursor(*connectorFlag)
|
||||
cGrid = compact.NewCompactGrid()
|
||||
header = widgets.NewCTopHeader()
|
||||
|
||||
for {
|
||||
exit := Display()
|
||||
if exit {
|
||||
|
Loading…
Reference in New Issue
Block a user