diff options
author | Valery Piashchynski <[email protected]> | 2021-06-06 20:43:16 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-06 20:43:16 +0300 |
commit | 0a48df5e5e44aaefa503669d7fb75490f1be103f (patch) | |
tree | 7aa0761a34d04e521582f3b8e891282a58993205 | |
parent | 5879cf656302375ce751fd8a0de9dd9633ceb6f4 (diff) |
Remove tools folder
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 6 | ||||
-rw-r--r-- | tools/worker_table.go | 91 |
3 files changed, 0 insertions, 99 deletions
@@ -6,7 +6,6 @@ require ( github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect github.com/alicebob/miniredis/v2 v2.14.5 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b - github.com/dustin/go-humanize v1.0.0 github.com/fasthttp/websocket v1.4.3 github.com/fatih/color v1.12.0 github.com/go-ole/go-ole v1.2.5 // indirect @@ -17,7 +16,6 @@ require ( github.com/google/uuid v1.2.0 github.com/json-iterator/go v1.1.11 github.com/klauspost/compress v1.13.0 - github.com/olekukonko/tablewriter v0.0.5 github.com/prometheus/client_golang v1.10.0 github.com/savsgio/gotils v0.0.0-20210316171653-c54912823645 // indirect github.com/shirou/gopsutil v3.21.3+incompatible @@ -86,8 +86,6 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= @@ -252,8 +250,6 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -286,8 +282,6 @@ github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtb github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= diff --git a/tools/worker_table.go b/tools/worker_table.go deleted file mode 100644 index 799f045f..00000000 --- a/tools/worker_table.go +++ /dev/null @@ -1,91 +0,0 @@ -package tools - -import ( - "io" - "strconv" - "time" - - "github.com/dustin/go-humanize" - "github.com/fatih/color" - "github.com/olekukonko/tablewriter" - "github.com/spiral/roadrunner/v2/pkg/process" -) - -// WorkerTable renders table with information about rr server workers. -func WorkerTable(writer io.Writer, workers []process.State) *tablewriter.Table { - tw := tablewriter.NewWriter(writer) - tw.SetHeader([]string{"PID", "Status", "Execs", "Memory", "CPU%", "Created"}) - tw.SetColMinWidth(0, 7) - tw.SetColMinWidth(1, 9) - tw.SetColMinWidth(2, 7) - tw.SetColMinWidth(3, 7) - tw.SetColMinWidth(4, 7) - tw.SetColMinWidth(5, 18) - - for i := 0; i < len(workers); i++ { - tw.Append([]string{ - strconv.Itoa(workers[i].Pid), - renderStatus(workers[i].Status), - renderJobs(workers[i].NumJobs), - humanize.Bytes(workers[i].MemoryUsage), - renderCPU(workers[i].CPUPercent), - renderAlive(time.Unix(0, workers[i].Created)), - }) - } - - return tw -} - -// ServiceWorkerTable renders table with information about rr server workers. -func ServiceWorkerTable(writer io.Writer, workers []process.State) *tablewriter.Table { - tw := tablewriter.NewWriter(writer) - tw.SetAutoWrapText(false) - tw.SetHeader([]string{"PID", "Memory", "CPU%", "Command"}) - tw.SetColMinWidth(0, 7) - tw.SetColMinWidth(1, 7) - tw.SetColMinWidth(2, 7) - tw.SetColMinWidth(3, 18) - tw.SetAlignment(tablewriter.ALIGN_LEFT) - - for i := 0; i < len(workers); i++ { - tw.Append([]string{ - strconv.Itoa(workers[i].Pid), - humanize.Bytes(workers[i].MemoryUsage), - renderCPU(workers[i].CPUPercent), - workers[i].Command, - }) - } - - return tw -} - -//go:inline -func renderCPU(cpu float64) string { - return strconv.FormatFloat(cpu, 'f', 2, 64) -} - -func renderStatus(status string) string { - switch status { - case "inactive": - return color.YellowString("inactive") - case "ready": - return color.CyanString("ready") - case "working": - return color.GreenString("working") - case "invalid": - return color.YellowString("invalid") - case "stopped": - return color.RedString("stopped") - case "errored": - return color.RedString("errored") - } - return status -} - -func renderJobs(number uint64) string { - return humanize.Comma(int64(number)) -} - -func renderAlive(t time.Time) string { - return humanize.RelTime(t, time.Now(), "ago", "") -} |