From 81f829b1b9ff3febdf01134711ffbdca5d2dc8d3 Mon Sep 17 00:00:00 2001 From: mikael <mikael@FreeBSD.org> Date: Wed, 29 Apr 2020 17:32:00 +0200 Subject: [PATCH 01/46] Use dup2 on FreeBSD aarch64 --- logging/logging_arm64.go | 2 +- logging/logging_other.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/logging/logging_arm64.go b/logging/logging_arm64.go index 03848bb..339d108 100644 --- a/logging/logging_arm64.go +++ b/logging/logging_arm64.go @@ -1,4 +1,4 @@ -// +build arm64 +// +build linux,arm64 package logging diff --git a/logging/logging_other.go b/logging/logging_other.go index fd88b83..792ae1e 100644 --- a/logging/logging_other.go +++ b/logging/logging_other.go @@ -1,5 +1,5 @@ // +build linux openbsd freebsd darwin -// +build !arm64 +// +build !linux,arm64 package logging From bca073bfce83371944dec1aa0ef8a259f577d3b8 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Fri, 1 May 2020 20:37:38 -0500 Subject: [PATCH 02/46] Translation file with help text. --- translations/en_US.toml | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 translations/en_US.toml diff --git a/translations/en_US.toml b/translations/en_US.toml new file mode 100644 index 0000000..05cde16 --- /dev/null +++ b/translations/en_US.toml @@ -0,0 +1,44 @@ +configfile="Config file" +usage="Usage: {0} [options]\n\nOptions:\n" + + +[help] +paths="Loadable colorschemes & layouts, and the config file, are searched for, in order:" +log="The log file is in {0}" +written="Config written to {0}" + + +[args] +help="Show this screen." +color="Set a colorscheme." +scale="Graph scale factor, >0" +version="Print version and exit." +percpu="Show each CPU in the CPU widget." +cpuavg="Show average CPU in the CPU widget." +temp="Show temperatures in fahrenheit.Show temperatures in fahrenheit." +statusbar="Show a statusbar with the time." +rate="Refresh frequency. Most time units accepted. \"1m\" = refresh every minute. \"100ms\" = refresh every 100ms." +layout="Name of layout spec file for the UI. Use \"-\" to pipe." +net="Select network interface. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using \"!\"" +export="Enable metrics for export on the specified port." +mbps="Show network rate as mbps." +test="Runs tests and exits with success/failure code." +conffile="Config file to use instead of default (MUST BE FIRST ARGUMENT)" +list=""" +List <devices|layouts|colorschemes|paths|keys> + devices: Prints out device names for filterable widgets + layouts: Lists build-in layouts + colorschemes: Lists built-in colorschemes + paths: List out configuration file search paths + widgets: Widgets that can be used in a layout + keys: Show the keyboard bindings.""" +write="Write out a default config file." + + +[errors] +configparse="failed to parse config file: {0}" +cliparse="parsing CLI args: {0}" +logsetup="failed to setup log file: {0}" +unknownopt="Unknown option \"{0}\"; try layouts, colorschemes, keys, paths, or devices\n" +writefail="Failed to write configuration file: {0}" +checklog="errors encountered; from {0}:" From 91284adcf77cd6bfeee4b36973f39ef7734b287a Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 5 May 2020 08:18:35 -0500 Subject: [PATCH 03/46] Fixes #115; makes instructions more brief. --- README.md | 93 ++++++++++--------------------------------------------- 1 file changed, 16 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index fd37437..1880298 100644 --- a/README.md +++ b/README.md @@ -23,56 +23,25 @@ Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, b If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run. -### Arch +- **Arch**: Install from AUR, e.g. `yay -S gotop-bin`. There is also `gotop` and `gotop-git` +- **Gentoo**: gotop is available on [guru](https://gitweb.gentoo.org/repo/proj/guru.git) overlay. + ```shell + sudo layman -a guru + sudo emerge gotop + ``` +- OSX: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps. +- **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided. +- **Source**: This requires Go >= 1.14. `go get -u github.com/xxxserxxx/gotop/cmd/gotop` -AUR contains entries for `gotop` and `gotop-bin`. `gotop-git` still points at the old, unmaintained, repository for the moment. +### Console Users Note -``` -yay -S gotop-bin -``` - -There is also a build-from-source package: - -``` -yay -S gotop -``` - -### Gentoo - -`gotop` is available on [guru](https://gitweb.gentoo.org/repo/proj/guru.git) overlay. It's currently required to add this overlay in order to install `gotop`: +gotop requires a font that has braille and block character Unicode code points; some distributions do not provide this. In the gotop repository is a `pcf` font that has these points, and setting this font may improve how gotop renders in your console. To use this, run these commands: ```shell -sudo layman -a guru -sudo emerge gotop +$ curl -O -L https://raw.githubusercontent.com/xxxserxxx/gotop/master/fonts/Lat15-VGA16-braille.psf +$ setfont Lat15-VGA16-braille.psf ``` -### OSX - -gotop can be installed with [Homebrew](https://brew.sh/); you'll need to tap the recipe. If you'd previously tapped cjbassi's recipe, you'll want to untap that first. The old version of gotop is also included in Homebrew's core library, and that will always be chosen before any taps, so you have to specify the tap specifically. - -``` -brew uninstall gotop # If previously installed -brew untap cjbassi/gotop # If previously tapped -brew tap xxxserxxx/gotop -brew install xxxserxxx/gotop/gotop -``` - -### Prebuilt binaries - -This doesn't require Go, is easy, and works across distributions. You have to manually upgrade the executable yourself, though, so using your distribution's package (if one is available) is a better approach. - -Visit [the releases page](https://github.com/xxxserxxx/gotop/releases) with your web browser and download the appropriate file for your OS and architecture. Unzip it (the archive contains a single file) and then move the resulting `gotop` binary into your `$PATH` somewhere. If you're on a Debian or Redhat derivative, you can download an `.rpm` or `.deb` and install that. - -### Source - -This requires Go, and at the moment, Go 1.14 specifically. - -```bash -go get -u github.com/xxxserxxx/gotop/cmd/gotop -``` - -If you don't have Go 1.14, you will want to follow the Building instructions in the next section. - ### Building This is the download & compile approach. @@ -90,44 +59,14 @@ Move `gotop` to somewhere in your `$PATH`. ## Usage -### Keybinds +Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command. -- Quit: `q` or `<C-c>` -- Process navigation: - - `k` and `<Up>`: up - - `j` and `<Down>`: down - - `<C-u>`: half page up - - `<C-d>`: half page down - - `<C-b>`: full page up - - `<C-f>`: full page down - - `gg` and `<Home>`: jump to top - - `G` and `<End>`: jump to bottom -- Process actions: - - `<Tab>`: toggle process grouping - - `dd`: kill selected process or group of processes with SIGTERM - - `d3`: kill selected process or group of processes with SIGQUIT - - `d9`: kill selected process or group of processes with SIGKILL -- Process sorting - - `c`: CPU - - `m`: Mem - - `p`: PID -- Process filtering: - - `/`: start editing filter - - (while editing): - - `<Enter>` accept filter - - `<C-c>` and `<Escape>`: clear filter -- CPU and Mem graph scaling: - - `h`: scale in - - `l`: scale out -- `?`: toggles keybind help menu -- `b`: toggles display of network traffic in mbps or TX (or RX) per second - -### Mouse +In addition to the key bindings, the mouse can be used to control the process list: - click to select process - mouse wheel to scroll through processes -### Config file +## Config file Most command-line settings can be persisted into a configuration file. The config file is named `gotop.conf` and can be located in several places. The first place gotop will look is in the current directory; after this, the locations depend on the OS and distribution. On Linux using XDG, for instance, the home location of `~/.config/gotop/gotop.conf` is the second location. The last location is a system-wide global location, such as `/etc/gotop/gotop.conf`. The `-h` help command will print out all of the locations, in order. Command-line options override values in any config files, and only the first config file found is loaded. From 292c4c1bf381016b6674db279cfd111e5368b572 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 5 May 2020 09:33:37 -0500 Subject: [PATCH 04/46] Homebrew update --- .github/workflows/release.yml | 7 +++++++ README.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6390f46..a90118a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,3 +29,10 @@ jobs: repository: xxxserxxx/gotop-linux event-type: my-release client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}' + + - name: Update and inform Homebrew + uses: dawidd6/action-homebrew-bump-formula@v3 + with: + token: ${{ secrets.homebrew }} + formula: gotop + revision: ${{ steps.tag_name.outputs.tag }} diff --git a/README.md b/README.md index 1880298..8a3e55e 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ If you install gotop by hand, or you download or create new layouts or colorsche sudo layman -a guru sudo emerge gotop ``` -- OSX: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps. +- **OSX**: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps. - **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided. - **Source**: This requires Go >= 1.14. `go get -u github.com/xxxserxxx/gotop/cmd/gotop` From b0e1e9a20ad2c198b65df420aef5821c7be7208c Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 6 May 2020 20:00:13 -0500 Subject: [PATCH 05/46] FIXMEs --- devices/cpu_cpu.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devices/cpu_cpu.go b/devices/cpu_cpu.go index 42eff2e..a959e32 100644 --- a/devices/cpu_cpu.go +++ b/devices/cpu_cpu.go @@ -7,6 +7,8 @@ import ( psCpu "github.com/shirou/gopsutil/cpu" ) +// FIXME: broken % under Linux. Doesn't reflect reality *at all*. +// FIXME: gotop CPU use high -- gopsutils again? Try rolling back. func init() { f := func(cpus map[string]int, iv time.Duration, l bool) map[string]error { cpuCount, err := psCpu.Counts(l) From 310a6d084d5ff56ebb26cd667f46f578b39c737a Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 12 May 2020 18:42:45 -0500 Subject: [PATCH 06/46] Replaces the Prometheus client with VictoriaMetrics/metrics --- CHANGELOG.md | 1 + README.md | 1 + cmd/gotop/main.go | 6 +- go.mod | 16 ++-- go.sum | 168 +++++----------------------------------- widgets/battery.go | 23 +++--- widgets/batterygauge.go | 29 ++----- widgets/cpu.go | 42 ++++------ widgets/disk.go | 22 +----- widgets/mem.go | 41 +++++----- widgets/metrics.go | 19 +++++ widgets/net.go | 25 ++---- widgets/temp.go | 21 ++--- 13 files changed, 114 insertions(+), 300 deletions(-) create mode 100644 widgets/metrics.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 316e451..318c4f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Extensions are now built with a build tool; this is an interim solution until issues with the Go plugin API are resolved. - Command line help text is cleaned up. - Version bump of gopsutil +- Prometheus client replaced by [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics). This eliminated 6 indirect package dependencies and saved 3.5MB (25%) of the compiled binary size. ### Removed diff --git a/README.md b/README.md index 8a3e55e..4d3e571 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,7 @@ Run `gotop -h` to see the list of all command line options. - [shirou/gopsutil](https://github.com/shirou/gopsutil) - [goreleaser/nfpm](https://github.com/goreleaser/nfpm) - [distatus/battery](https://github.com/distatus/battery) +- [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) Check this out! The API is clean, elegant, introduces many fewer indirect dependencies than the Prometheus client, and adds 50% less size to binaries. ## History diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 25dd5b8..dc869ce 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -17,8 +17,8 @@ import ( //_ "net/http/pprof" + "github.com/VictoriaMetrics/metrics" ui "github.com/gizak/termui/v3" - "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/shibukawa/configdir" "github.com/xxxserxxx/opflag" @@ -447,7 +447,9 @@ func run() int { if conf.ExportPort != "" { go func() { - http.Handle("/metrics", promhttp.Handler()) + http.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) { + metrics.WritePrometheus(w, true) + }) http.ListenAndServe(conf.ExportPort, nil) }() } diff --git a/go.mod b/go.mod index 975ca3d..1763e3d 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,19 @@ module github.com/xxxserxxx/gotop/v4 require ( - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect + github.com/VictoriaMetrics/metrics v1.11.2 github.com/distatus/battery v0.9.0 - github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815 github.com/gizak/termui/v3 v3.0.0 - github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-ole/go-ole v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.4 - github.com/mitchellh/go-wordwrap v1.0.0 // indirect - github.com/prometheus/client_golang v1.4.1 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 github.com/shirou/gopsutil v2.20.3+incompatible - github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 - golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect - golang.org/x/tools v0.0.0-20200425043458-8463f397d07c // indirect - golang.org/x/tools/gopls v0.4.0 // indirect - howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect - mvdan.cc/xurls/v2 v2.2.0 // indirect + golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 // indirect + howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect ) go 1.14 diff --git a/go.sum b/go.sum index 2e2c454..d698b71 100644 --- a/go.sum +++ b/go.sum @@ -1,52 +1,18 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/metrics v1.11.2 h1:t/ceLP6SvagUqypCKU7cI7+tQn54+TIV/tGoxihHvx8= +github.com/VictoriaMetrics/metrics v1.11.2/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ= github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd h1:XtfPmj9tQRilnrEmI1HjQhxXWRhEM+m8CACtaMJE/kM= github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd/go.mod h1:vjcQJUZJYD3MeVGhtZXSMnCHfUNZxsyYzJt90eCYxK4= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distatus/battery v0.9.0 h1:8NS5o00/j3Oh2xgocA6pQROTp5guoR+s8CZlWzHC4QM= github.com/distatus/battery v0.9.0/go.mod h1:gGO7GxHTi1zlRT+cAj8uGG0/8HFiqAeH0TJvoipnuPs= -github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815 h1:HMAfwOa33y82IaQEKQDfUCiwNlxtM1iw7HLM9ru0RNc= -github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:l7JNRynTRuqe45tpIyItHNqZWTxywYjp87MWTOnU5cg= github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE= github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= +github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -55,134 +21,38 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -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/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a h1:P0QSyHOubLI2e6hccBBEjVX0vPWXoXui5QCAVNWdJSk= github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a/go.mod h1:u8Q8dpnMAam0MElxP2KjEROzXMk9G8X168RTpAZ9tPc= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.1 h1:FFSuS004yOQEtDdTq+TAOLP5xUq63KqAFYyOi8zA+Y8= -github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w= github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y= -github.com/shirou/gopsutil v2.18.11+incompatible h1:PMFTKnFTr/YTRW5rbLK4vWALV3a+IGXse5nvhSjztmg= -github.com/shirou/gopsutil v2.18.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v2.20.3+incompatible h1:0JVooMPsT7A7HqEYdydp/OfjSOYSjhXV7w1hkKj/NPQ= github.com/shirou/gopsutil v2.20.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= -github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/xxxserxxx/gotop v0.0.0-20200228201131-d16cf1c6d2b9 h1:Sn+TuKkfF+CVaJjm4oVmeADtrOaHtrWpgqVLtsMpUqg= -github.com/xxxserxxx/gotop/v3 v3.5.1 h1:aBf++Oxg7qCZpKqYpPPnXKFOxT1KYLPtiEXRh57ywu0= -github.com/xxxserxxx/gotop/v3 v3.5.1/go.mod h1:DGPTiAmUhqE21xvokK64BuMxW+EmnOptaxpdOlqiH6s= +github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI= +github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ= +github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg= +github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto= github.com/xxxserxxx/iSMC v1.0.1 h1:M9Gkwnnkl+evvnugoB5yRYrbUP+cRIVOPM+xrHZc3Hs= github.com/xxxserxxx/iSMC v1.0.1/go.mod h1:TGgNjU7BF2DZSuxiTft+BdzxzcujFJYqFfMCzcTl/aY= -github.com/xxxserxxx/opflag v1.0.0 h1:NabxbubvejqcdzQUHnsU8pBMAiWM+a/Rh2IJe56moiU= -github.com/xxxserxxx/opflag v1.0.0/go.mod h1:Zf9bGkOcA35ypGfN25KX0iujVpZB5XwauEFjcfSKcBo= -github.com/xxxserxxx/opflag v1.0.2 h1:TanW4Ck/RNal4fP2VVAvhEu7eBq4z+9hhGq9Q8OTq68= -github.com/xxxserxxx/opflag v1.0.2/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= -github.com/xxxserxxx/opflag v1.0.3 h1:ugsBWZtSXUaMLEjPLW0WKGjq/gsrc0GpZYbCJY6ZHVY= -github.com/xxxserxxx/opflag v1.0.3/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= -github.com/xxxserxxx/opflag v1.0.4 h1:g979b8oReAERfDKFTTwdvAYIarFxpVYOzYrHa/hMvNs= -github.com/xxxserxxx/opflag v1.0.4/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90= github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200407041343-bf15fae40dea h1:DUwLyMDMUauGMd9kSLIlhhYJNELm06HuxeBdkFkeax4= -golang.org/x/tools v0.0.0-20200407041343-bf15fae40dea/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200425043458-8463f397d07c h1:iHhCR0b26amDCiiO+kBguKZom9aMF+NrFxh9zeKR/XU= -golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools/gopls v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik= -golang.org/x/tools/gopls v0.4.0/go.mod h1:fdOZ8zb6nqlePvfek79JCskQXI4W+i2e1xT+xOPKMcY= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 h1:OKbAoGs4fGM5cPLlVQLZGYkFC8OnOfgo6tt0Smf9XhM= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M= -howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= -mvdan.cc/xurls/v2 v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA= -mvdan.cc/xurls/v2 v2.1.0/go.mod h1:5GrSd9rOnKOpZaji1OZLYL/yeAAtGDlo/cFe+8K5n8E= -mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A= -mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8= +howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 h1:AQkaJpH+/FmqRjmXZPELom5zIERYZfwTjnHpfoVMQEc= +howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= diff --git a/widgets/battery.go b/widgets/battery.go index 7167668..77b102f 100644 --- a/widgets/battery.go +++ b/widgets/battery.go @@ -7,8 +7,8 @@ import ( "strconv" "time" + "github.com/VictoriaMetrics/metrics" "github.com/distatus/battery" - "github.com/prometheus/client_golang/prometheus" ui "github.com/xxxserxxx/gotop/v4/termui" ) @@ -16,7 +16,6 @@ import ( type BatteryWidget struct { *ui.LineGraph updateInterval time.Duration - metric []prometheus.Gauge } func NewBatteryWidget(horizontalScale int) *BatteryWidget { @@ -49,16 +48,14 @@ func (b *BatteryWidget) EnableMetric() { log.Printf("error setting up metrics: %v", err) return } - b.metric = make([]prometheus.Gauge, len(bats)) - for i, bat := range bats { - gauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "gotop", - Subsystem: "battery", - Name: fmt.Sprintf("%d", i), + for i, _ := range bats { + id := makeID(i) + metrics.NewGauge(makeName("battery", i), func() float64 { + if ds, ok := b.Data[id]; ok { + return ds[len(ds)-1] + } + return 0.0 }) - gauge.Set(bat.Current / bat.Full) - b.metric[i] = gauge - prometheus.MustRegister(gauge) } } @@ -97,10 +94,8 @@ func (b *BatteryWidget) update() { id := makeID(i) perc := battery.Current / battery.Full percentFull := math.Abs(perc) * 100.0 + // TODO: look into this sort of thing; doesn't the array grow forever? Is the widget library truncating it? b.Data[id] = append(b.Data[id], percentFull) b.Labels[id] = fmt.Sprintf("%3.0f%% %.0f/%.0f", percentFull, math.Abs(battery.Current), math.Abs(battery.Full)) - if b.metric != nil { - b.metric[i].Set(perc) - } } } diff --git a/widgets/batterygauge.go b/widgets/batterygauge.go index 45fec1c..3a89707 100644 --- a/widgets/batterygauge.go +++ b/widgets/batterygauge.go @@ -6,15 +6,15 @@ import ( "time" + "github.com/VictoriaMetrics/metrics" "github.com/distatus/battery" - "github.com/prometheus/client_golang/prometheus" "github.com/xxxserxxx/gotop/v4/termui" ) type BatteryGauge struct { *termui.Gauge - metric prometheus.Gauge + metric *metrics.Gauge } func NewBatteryGauge() *BatteryGauge { @@ -35,25 +35,9 @@ func NewBatteryGauge() *BatteryGauge { } func (b *BatteryGauge) EnableMetric() { - bats, err := battery.GetAll() - if err != nil { - log.Printf("error setting up metrics: %v", err) - return - } - mx := 0.0 - cu := 0.0 - for _, bat := range bats { - mx += bat.Full - cu += bat.Current - gauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "gotop", - Subsystem: "battery", - Name: "total", - }) - gauge.Set(cu / mx) - b.metric = gauge - prometheus.MustRegister(gauge) - } + metrics.NewGauge(makeName("battery", "total"), func() float64 { + return float64(b.Percent) + }) } func (b *BatteryGauge) update() { @@ -80,7 +64,4 @@ func (b *BatteryGauge) update() { d, _ := time.ParseDuration(fmt.Sprintf("%fh", tn)) b.Percent = int((cu / mx) * 100.0) b.Label = fmt.Sprintf(charging, b.Percent, d.Truncate(time.Minute)) - if b.metric != nil { - b.metric.Set(cu / mx) - } } diff --git a/widgets/cpu.go b/widgets/cpu.go index 03346bf..d8d9a50 100644 --- a/widgets/cpu.go +++ b/widgets/cpu.go @@ -2,11 +2,10 @@ package widgets import ( "fmt" - "log" "sync" "time" - "github.com/prometheus/client_golang/prometheus" + "github.com/VictoriaMetrics/metrics" "github.com/xxxserxxx/gotop/v4/devices" ui "github.com/xxxserxxx/gotop/v4/termui" @@ -19,7 +18,7 @@ type CPUWidget struct { ShowPerCPULoad bool updateInterval time.Duration updateLock sync.Mutex - metric map[string]prometheus.Gauge + cpuLoads map[string]float64 } var cpuLabels []string @@ -31,6 +30,7 @@ func NewCPUWidget(updateInterval time.Duration, horizontalScale int, showAverage updateInterval: updateInterval, ShowAverageLoad: showAverageLoad, ShowPerCPULoad: showPerCPULoad, + cpuLoads: make(map[string]float64), } self.Title = " CPU Usage " self.HorizontalScale = horizontalScale @@ -66,26 +66,22 @@ func NewCPUWidget(updateInterval time.Duration, horizontalScale int, showAverage return self } +const AVRG = "AVRG" + func (cpu *CPUWidget) EnableMetric() { if cpu.ShowAverageLoad { - cpu.metric = make(map[string]prometheus.Gauge) - cpu.metric["AVRG"] = prometheus.NewGauge(prometheus.GaugeOpts{ - Subsystem: "cpu", - Name: "avg", + metrics.NewGauge(makeName("cpu", " avg"), func() float64 { + return cpu.cpuLoads[AVRG] }) } else { cpus := make(map[string]int) devices.UpdateCPU(cpus, cpu.updateInterval, cpu.ShowPerCPULoad) - cpu.metric = make(map[string]prometheus.Gauge) for key, perc := range cpus { - gauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "gotop", - Subsystem: "cpu", - Name: key, + kc := key + cpu.cpuLoads[key] = float64(perc) + metrics.NewGauge(makeName("cpu", key), func() float64 { + return cpu.cpuLoads[kc] }) - gauge.Set(float64(perc)) - prometheus.MustRegister(gauge) - cpu.metric[key] = gauge } } } @@ -108,11 +104,9 @@ func (cpu *CPUWidget) update() { val = float64(v) break } - cpu.Data["AVRG"] = append(cpu.Data["AVRG"], val) - cpu.Labels["AVRG"] = fmt.Sprintf("%3.0f%%", val) - if cpu.metric != nil { - cpu.metric["AVRG"].Set(val) - } + cpu.Data[AVRG] = append(cpu.Data[AVRG], val) + cpu.Labels[AVRG] = fmt.Sprintf("%3.0f%%", val) + cpu.cpuLoads[AVRG] = val }() } @@ -127,13 +121,7 @@ func (cpu *CPUWidget) update() { for key, percent := range cpus { cpu.Data[key] = append(cpu.Data[key], float64(percent)) cpu.Labels[key] = fmt.Sprintf("%d%%", percent) - if cpu.metric != nil { - if cpu.metric[key] == nil { - log.Printf("no metrics for %s", key) - } else { - cpu.metric[key].Set(float64(percent)) - } - } + cpu.cpuLoads[key] = float64(percent) } }() } diff --git a/widgets/disk.go b/widgets/disk.go index fb77ace..dd49b9a 100644 --- a/widgets/disk.go +++ b/widgets/disk.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/prometheus/client_golang/prometheus" + "github.com/VictoriaMetrics/metrics" psDisk "github.com/shirou/gopsutil/disk" ui "github.com/xxxserxxx/gotop/v4/termui" @@ -29,7 +29,6 @@ type DiskWidget struct { *ui.Table updateInterval time.Duration Partitions map[string]*Partition - metric map[string]prometheus.Gauge } // TODO: Add filtering @@ -65,17 +64,11 @@ func NewDiskWidget() *DiskWidget { } func (disk *DiskWidget) EnableMetric() { - disk.metric = make(map[string]prometheus.Gauge) for key, part := range disk.Partitions { - gauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "gotop", - Subsystem: "disk", - Name: strings.ReplaceAll(key, "/", ":"), - //Name: strings.Replace(strings.Replace(part.Device, "/dev/", "", -1), "mapper/", "", -1), + pc := part + metrics.NewGauge(makeName("disk", strings.ReplaceAll(key, "/", ":")), func() float64 { + return float64(pc.UsedPercent) / 100.0 }) - gauge.Set(float64(part.UsedPercent) / 100.0) - prometheus.MustRegister(gauge) - disk.metric[key] = gauge } } @@ -176,12 +169,5 @@ func (disk *DiskWidget) update() { disk.Rows[i][3] = partition.Free disk.Rows[i][4] = partition.BytesReadRecently disk.Rows[i][5] = partition.BytesWrittenRecently - if disk.metric != nil { - if disk.metric[key] == nil { - log.Printf("ERROR: missing metric %s", key) - } else { - disk.metric[key].Set(float64(partition.UsedPercent) / 100.0) - } - } } } diff --git a/widgets/mem.go b/widgets/mem.go index 6b5d326..b994276 100644 --- a/widgets/mem.go +++ b/widgets/mem.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/prometheus/client_golang/prometheus" + "github.com/VictoriaMetrics/metrics" "github.com/xxxserxxx/gotop/v4/devices" ui "github.com/xxxserxxx/gotop/v4/termui" @@ -14,52 +14,47 @@ import ( type MemWidget struct { *ui.LineGraph updateInterval time.Duration - metrics map[string]prometheus.Gauge } func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget { - self := &MemWidget{ + widg := &MemWidget{ LineGraph: ui.NewLineGraph(), updateInterval: updateInterval, } - self.Title = " Memory Usage " - self.HorizontalScale = horizontalScale + widg.Title = " Memory Usage " + widg.HorizontalScale = horizontalScale mems := make(map[string]devices.MemoryInfo) devices.UpdateMem(mems) for name, mem := range mems { - self.Data[name] = []float64{0} - self.renderMemInfo(name, mem) + widg.Data[name] = []float64{0} + widg.renderMemInfo(name, mem) } go func() { - for range time.NewTicker(self.updateInterval).C { - self.Lock() + for range time.NewTicker(widg.updateInterval).C { + widg.Lock() devices.UpdateMem(mems) for label, mi := range mems { - self.renderMemInfo(label, mi) - if self.metrics != nil && self.metrics[label] != nil { - self.metrics[label].Set(mi.UsedPercent) - } + widg.renderMemInfo(label, mi) } - self.Unlock() + widg.Unlock() } }() - return self + return widg } func (mem *MemWidget) EnableMetric() { - mem.metrics = make(map[string]prometheus.Gauge) mems := make(map[string]devices.MemoryInfo) devices.UpdateMem(mems) - for l, m := range mems { - mem.metrics[l] = prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "gotop", - Subsystem: "memory", - Name: l, + for l, _ := range mems { + lc := l + metrics.NewGauge(makeName("memory", l), func() float64 { + if ds, ok := mem.Data[lc]; ok { + return ds[len(ds)-1] + } + return 0.0 }) - mem.metrics[l].Set(m.UsedPercent) - prometheus.MustRegister(mem.metrics[l]) } } diff --git a/widgets/metrics.go b/widgets/metrics.go new file mode 100644 index 0000000..683b196 --- /dev/null +++ b/widgets/metrics.go @@ -0,0 +1,19 @@ +package widgets + +import ( + "fmt" + "strings" +) + +// makeName creates a prometheus metric name in the gotop space +// This function doesn't have to be very efficient because it's only +// called at init time, and only a few dozen times... and it isn't +// (very efficient). +func makeName(parts ...interface{}) string { + args := make([]string, len(parts)+1) + args[0] = "gotop" + for i, v := range parts { + args[i+1] = fmt.Sprintf("%v", v) + } + return strings.Join(args, "_") +} diff --git a/widgets/net.go b/widgets/net.go index 9cd4211..b76d6b4 100644 --- a/widgets/net.go +++ b/widgets/net.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/prometheus/client_golang/prometheus" + "github.com/VictoriaMetrics/metrics" psNet "github.com/shirou/gopsutil/net" ui "github.com/xxxserxxx/gotop/v4/termui" @@ -28,8 +28,8 @@ type NetWidget struct { totalBytesRecv uint64 totalBytesSent uint64 NetInterface []string - sentMetric prometheus.Counter - recvMetric prometheus.Counter + sentMetric *metrics.Counter + recvMetric *metrics.Counter Mbps bool } @@ -66,19 +66,8 @@ func NewNetWidget(netInterface string) *NetWidget { } func (net *NetWidget) EnableMetric() { - net.recvMetric = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: "gotop", - Subsystem: "net", - Name: "recv", - }) - prometheus.MustRegister(net.recvMetric) - - net.sentMetric = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: "gotop", - Subsystem: "net", - Name: "sent", - }) - prometheus.MustRegister(net.sentMetric) + net.recvMetric = metrics.NewCounter(makeName("net", "recv")) + net.sentMetric = metrics.NewCounter(makeName("net", "sent")) } func (net *NetWidget) update() { @@ -138,8 +127,8 @@ func (net *NetWidget) update() { net.Lines[0].Data = append(net.Lines[0].Data, int(recentBytesRecv)) net.Lines[1].Data = append(net.Lines[1].Data, int(recentBytesSent)) if net.sentMetric != nil { - net.sentMetric.Add(float64(recentBytesSent)) - net.recvMetric.Add(float64(recentBytesRecv)) + net.sentMetric.Add(int(recentBytesSent)) + net.recvMetric.Add(int(recentBytesRecv)) } } diff --git a/widgets/temp.go b/widgets/temp.go index f2b0f93..5a22897 100644 --- a/widgets/temp.go +++ b/widgets/temp.go @@ -6,8 +6,8 @@ import ( "sort" "time" + "github.com/VictoriaMetrics/metrics" ui "github.com/gizak/termui/v3" - "github.com/prometheus/client_golang/prometheus" "github.com/xxxserxxx/gotop/v4/devices" "github.com/xxxserxxx/gotop/v4/utils" @@ -28,7 +28,7 @@ type TempWidget struct { TempLowColor ui.Color TempHighColor ui.Color TempScale TempScale - tempsMetric map[string]prometheus.Gauge + temps map[string]float64 } func NewTempWidget(tempScale TempScale, filter []string) *TempWidget { @@ -68,16 +68,12 @@ func NewTempWidget(tempScale TempScale, filter []string) *TempWidget { } func (temp *TempWidget) EnableMetric() { - temp.tempsMetric = make(map[string]prometheus.Gauge) - for k, v := range temp.Data { - gauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "gotop", - Subsystem: "temp", - Name: k, + temp.temps = make(map[string]float64) + for k, _ := range temp.Data { + kc := k + metrics.NewGauge(makeName("temp", k), func() float64 { + return float64(temp.Data[kc]) }) - gauge.Set(float64(v)) - prometheus.MustRegister(gauge) - temp.tempsMetric[k] = gauge } } @@ -109,9 +105,6 @@ func (temp *TempWidget) Draw(buf *ui.Buffer) { image.Pt(temp.Inner.Min.X, temp.Inner.Min.Y+y), ) - if temp.tempsMetric != nil { - temp.tempsMetric[key].Set(float64(temp.Data[key])) - } temperature := fmt.Sprintf("%3d°%c", temp.Data[key], temp.TempScale) buf.SetString( From f5fc8b18547bcd71e60190a9c408d482c33bcb00 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 10:08:43 -0500 Subject: [PATCH 07/46] Missed a no-longer-used attribute --- widgets/batterygauge.go | 1 - 1 file changed, 1 deletion(-) diff --git a/widgets/batterygauge.go b/widgets/batterygauge.go index 3a89707..c2cab1d 100644 --- a/widgets/batterygauge.go +++ b/widgets/batterygauge.go @@ -14,7 +14,6 @@ import ( type BatteryGauge struct { *termui.Gauge - metric *metrics.Gauge } func NewBatteryGauge() *BatteryGauge { From 2401d63362709091e616c95418c62ab19be19783 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 10:22:48 -0500 Subject: [PATCH 08/46] gopsutil 2.20 doesn't compile on FreeBSD; rolling back. --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 1763e3d..fdda298 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-ole/go-ole v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.4 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 - github.com/shirou/gopsutil v2.20.3+incompatible + github.com/shirou/gopsutil v2.18.11+incompatible github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 From 0406a680e0e69d20d0cf17e37059bb69e57cb901 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 10:29:33 -0500 Subject: [PATCH 09/46] Revert "gopsutil 2.20 doesn't compile on FreeBSD; rolling back." This wasn't gopsutil's issue; it was a change in x/sys/util that broke the API. This reverts commit 2401d63362709091e616c95418c62ab19be19783. --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fdda298..1763e3d 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-ole/go-ole v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.4 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 - github.com/shirou/gopsutil v2.18.11+incompatible + github.com/shirou/gopsutil v2.20.3+incompatible github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 From 28df77fe42f4c78e51e62a99c467ff6c37c513d4 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 12:29:09 -0500 Subject: [PATCH 10/46] Have the build workflow ignore commits containing only doc changes. --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c87949b..6de087d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,11 @@ name: Build Go binaries -on: push +on: + push: + paths-ignore: + - 'docs/release.svg' + - 'README.md' + - 'CHANGELOG.md' jobs: build: From 9e4750f7ff5accb610053014155958cb5b7956bd Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 12:31:51 -0500 Subject: [PATCH 11/46] Adds a current-release badge to the README --- .github/workflows/release.yml | 18 ++++++++++++++++++ README.md | 11 ++++++++--- docs/release.svg | 8 ++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 docs/release.svg diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a90118a..b158768 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,3 +36,21 @@ jobs: token: ${{ secrets.homebrew }} formula: gotop revision: ${{ steps.tag_name.outputs.tag }} + + - name: Update current release badge + shell: bash + run: sed -i "s/v[0-9]*\.[0-9]*\.[0-9]*/${{steps.tag_name.outputs.tag}}/g" docs/release.svg + + - name: Commit current release badge + uses: stefanzweifel/git-auto-commit-action@v4.1.0 + with: + branch: 'master' + commit_message: Update release badge to version "${{ steps.tag_name.outputs.tag }}" + + # Optional glob pattern of files which should be added to the commit + file_pattern: docs/release.svg + + # Optional commit user and author settings + commit_user_name: Badge Updater + commit_user_email: ser@ser1.net + commit_author: Badge Updater <ser@ser1.net> diff --git a/README.md b/README.md index 4d3e571..d2c4b0c 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,14 @@ Another terminal based graphical activity monitor, inspired by [gtop](https://gi Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([matrix clients](https://matrix.to/#/#gotop:matrix.org)). + + + + + +See the [mini-blog](/xxxserxxx/gotop/wiki/blog) for updates on the build status, and the [change log](/xxxserxxx/gotop/blob/master/CHANGELOG.md) for release updates. + + <img src="./assets/screenshots/demo.gif" /> <img src="./assets/screenshots/kitchensink.gif" /> @@ -16,9 +24,6 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([ ## Installation - - - Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided. If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run. diff --git a/docs/release.svg b/docs/release.svg new file mode 100644 index 0000000..cb7132a --- /dev/null +++ b/docs/release.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="164" height="20"> + <a href="/xxxserxxx/gotop/releases/tag/v3.5.2"> + <text font-size="14pt" fill="#000000" x="5" y="15"> + Current release: <tspan font-weight="bold">v3.5.2</tspan> + </text> + </a> +</svg> + From 63c69872f8d64121ccd2cd81568b74495bd88e35 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 12:35:54 -0500 Subject: [PATCH 12/46] Fixes the release version badge. --- README.md | 2 +- docs/release.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2c4b0c..9ec4b3d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([   - + See the [mini-blog](/xxxserxxx/gotop/wiki/blog) for updates on the build status, and the [change log](/xxxserxxx/gotop/blob/master/CHANGELOG.md) for release updates. diff --git a/docs/release.svg b/docs/release.svg index cb7132a..a586423 100644 --- a/docs/release.svg +++ b/docs/release.svg @@ -1,4 +1,4 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="164" height="20"> +<svg xmlns="http://www.w3.org/2000/svg" width="184" height="20"> <a href="/xxxserxxx/gotop/releases/tag/v3.5.2"> <text font-size="14pt" fill="#000000" x="5" y="15"> Current release: <tspan font-weight="bold">v3.5.2</tspan> From 76192092a74637fad21159f834ed5b9ec0d37491 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 12:40:29 -0500 Subject: [PATCH 13/46] Getting the text width right is difficult with github in the way. --- docs/release.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.svg b/docs/release.svg index a586423..52723c1 100644 --- a/docs/release.svg +++ b/docs/release.svg @@ -1,4 +1,4 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="184" height="20"> +<svg xmlns="http://www.w3.org/2000/svg" width="224" height="20"> <a href="/xxxserxxx/gotop/releases/tag/v3.5.2"> <text font-size="14pt" fill="#000000" x="5" y="15"> Current release: <tspan font-weight="bold">v3.5.2</tspan> From b47acdc8f2e037af1461805d9cd6dc1dcc71f5c1 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 13 May 2020 12:43:53 -0500 Subject: [PATCH 14/46] Release badge width --- docs/release.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/release.svg b/docs/release.svg index 52723c1..d42dd25 100644 --- a/docs/release.svg +++ b/docs/release.svg @@ -1,6 +1,6 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="224" height="20"> +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="20"> <a href="/xxxserxxx/gotop/releases/tag/v3.5.2"> - <text font-size="14pt" fill="#000000" x="5" y="15"> + <text text-anchor="middle" font-size="14pt" fill="#000000" x="150" y="15"> Current release: <tspan font-weight="bold">v3.5.2</tspan> </text> </a> From b8f3683f07015f0c6fbf3090aecd5ba1457ebe39 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Mon, 18 May 2020 07:35:48 -0500 Subject: [PATCH 15/46] Release SVG a bit taller, and add the size test bisect script. --- docs/release.svg | 2 +- scripts/size.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 scripts/size.sh diff --git a/docs/release.svg b/docs/release.svg index d42dd25..5f08114 100644 --- a/docs/release.svg +++ b/docs/release.svg @@ -1,4 +1,4 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="300" height="20"> +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="30"> <a href="/xxxserxxx/gotop/releases/tag/v3.5.2"> <text text-anchor="middle" font-size="14pt" fill="#000000" x="150" y="15"> Current release: <tspan font-weight="bold">v3.5.2</tspan> diff --git a/scripts/size.sh b/scripts/size.sh new file mode 100755 index 0000000..f772a77 --- /dev/null +++ b/scripts/size.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# size.sh is used to bisect the repository and find changes that negatively +# impacted the gotop binary size. It does this by building gotop and exiting +# successfully if the binary size is under a defined amount. +# +# Example: +# ``` +# git bisect start +# git bisect bad master +# git bisect good 755037d211cc8e58e9ce43ee74a95a3036053dee +# git bisect run ./size +# ``` + +GOODSIZE=6000000 + +# Caleb's directory structure was different from the current structure, so +# we have to find the main package first. +pt=$(dirname $(find . -name main.go)) +# Give the executable a unique-ish name +fn=gotop_$(git rev-list -1 HEAD) +go build -o $fn $pt +sz=$(ls -l $fn | awk '{print $5}') +git checkout -- . +[[ $sz -gt $GOODSIZE ]] && exit 1 +exit 0 From 6807f54e8080707e1cd3edf399e606376b3d7b63 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 19 May 2020 13:49:19 -0500 Subject: [PATCH 16/46] Closes #36 -- switch to MIT license. --- LICENSE | 690 +++---------------------------------------------- devices/cpu.go | 3 + 2 files changed, 32 insertions(+), 661 deletions(-) diff --git a/LICENSE b/LICENSE index dbbe355..0a126e1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,661 +1,29 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -<http://www.gnu.org/licenses/>. +The MIT License (MIT) + +Copyright (c) 2020 Sean E. Russell <ser@ser1.net> 87651D71 + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/devices/cpu.go b/devices/cpu.go index 1d8d23d..7ecb553 100644 --- a/devices/cpu.go +++ b/devices/cpu.go @@ -1,6 +1,9 @@ package devices // TODO: https://github.com/elastic/go-sysinfo +// TODO: https://github.com/mackerelio/go-osstat +// TODO: https://github.com/akhenakh/statgo +// TODO: https://github.com/jaypipes/ghw import ( "log" From d1d8ac272b750e17abf8c17116b04c047cfa08f0 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 19 May 2020 14:03:06 -0500 Subject: [PATCH 17/46] Cleans up and removes the smc.c code, which was forcing a license dependency and has since been replaced. --- devices/include/smc.c | 700 ------------------------------------------ devices/include/smc.h | 254 --------------- 2 files changed, 954 deletions(-) delete mode 100644 devices/include/smc.c delete mode 100644 devices/include/smc.h diff --git a/devices/include/smc.c b/devices/include/smc.c deleted file mode 100644 index 0c200d6..0000000 --- a/devices/include/smc.c +++ /dev/null @@ -1,700 +0,0 @@ -/* - * Apple System Management Controller (SMC) API from user space for Intel based - * Macs. Works by talking to the AppleSMC.kext (kernel extension), the driver - * for the SMC. - * - * smc.c - * libsmc - * - * Copyright (C) 2014 beltex <https://github.com/beltex> - * - * Based off of fork from: - * osx-cpu-temp <https://github.com/lavoiesl/osx-cpu-temp> - * - * With credits to: - * - * Copyright (C) 2006 devnull - * Apple System Management Control (SMC) Tool - * - * Copyright (C) 2006 Hendrik Holtmann - * smcFanControl <https://github.com/hholtmann/smcFanControl> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdio.h> -#include <string.h> -#include "smc.h" - - -//------------------------------------------------------------------------------ -// MARK: MACROS -//------------------------------------------------------------------------------ - - -/** -Name of the SMC IOService as seen in the IORegistry. You can view it either via -command line with ioreg or through the IORegistryExplorer app (found on Apple's -developer site - Hardware IO Tools for Xcode) -*/ -#define IOSERVICE_SMC "AppleSMC" - - -/** -IOService for getting machine model name -*/ -#define IOSERVICE_MODEL "IOPlatformExpertDevice" - - -/** -SMC data types - 4 byte multi-character constants - -Sources: See TMP SMC keys in smc.h - -http://stackoverflow.com/questions/22160746/fpe2-and-sp78-data-types -*/ -#define DATA_TYPE_UINT8 "ui8 " -#define DATA_TYPE_UINT16 "ui16" -#define DATA_TYPE_UINT32 "ui32" -#define DATA_TYPE_FLAG "flag" -#define DATA_TYPE_FPE2 "fpe2" -#define DATA_TYPE_SFDS "{fds" -#define DATA_TYPE_SP78 "sp78" - - -//------------------------------------------------------------------------------ -// MARK: GLOBAL VARS -//------------------------------------------------------------------------------ - - -/** -Our connection to the SMC -*/ -static io_connect_t conn; - - -/** -Number of characters in an SMC key -*/ -static const int SMC_KEY_SIZE = 4; - - -/** -Number of characters in a data type "key" returned from the SMC. See data type -macros. -*/ -static const int DATA_TYPE_SIZE = 4; - - -//------------------------------------------------------------------------------ -// MARK: ENUMS -//------------------------------------------------------------------------------ - - -/** -Defined by AppleSMC.kext. See SMCParamStruct. - -These are SMC specific return codes -*/ -typedef enum { - kSMCSuccess = 0, - kSMCError = 1, - kSMCKeyNotFound = 0x84 -} kSMC_t; - - -/** -Defined by AppleSMC.kext. See SMCParamStruct. - -Function selectors. Used to tell the SMC which function inside it to call. -*/ -typedef enum { - kSMCUserClientOpen = 0, - kSMCUserClientClose = 1, - kSMCHandleYPCEvent = 2, - kSMCReadKey = 5, - kSMCWriteKey = 6, - kSMCGetKeyCount = 7, - kSMCGetKeyFromIndex = 8, - kSMCGetKeyInfo = 9 -} selector_t; - - -//------------------------------------------------------------------------------ -// MARK: STRUCTS -//------------------------------------------------------------------------------ - - -/** -Defined by AppleSMC.kext. See SMCParamStruct. -*/ -typedef struct { - unsigned char major; - unsigned char minor; - unsigned char build; - unsigned char reserved; - unsigned short release; -} SMCVersion; - - -/** -Defined by AppleSMC.kext. See SMCParamStruct. -*/ -typedef struct { - uint16_t version; - uint16_t length; - uint32_t cpuPLimit; - uint32_t gpuPLimit; - uint32_t memPLimit; -} SMCPLimitData; - - -/** -Defined by AppleSMC.kext. See SMCParamStruct. - -- dataSize : How many values written to SMCParamStruct.bytes -- dataType : Type of data written to SMCParamStruct.bytes. This lets us know how - to interpret it (translate it to human readable) -*/ -typedef struct { - IOByteCount dataSize; - uint32_t dataType; - uint8_t dataColors; -} SMCKeyInfoData; - - -/** -Defined by AppleSMC.kext. - -This is the predefined struct that must be passed to communicate with the -AppleSMC driver. While the driver is closed source, the definition of this -struct happened to appear in the Apple PowerManagement project at around -version 211, and soon after disappeared. It can be seen in the PrivateLib.c -file under pmconfigd. - -https://www.opensource.apple.com/source/PowerManagement/PowerManagement-211/ -*/ -typedef struct { - uint32_t key; - SMCVersion vers; - SMCPLimitData pLimitData; - SMCKeyInfoData keyInfo; - uint8_t result; - uint8_t status; - uint8_t data8; - uint32_t data32; - uint8_t bytes[32]; -} SMCParamStruct; - - -/** -Used for returning data from the SMC. -*/ -typedef struct { - uint8_t data[32]; - uint32_t dataType; - uint32_t dataSize; - kSMC_t kSMC; -} smc_return_t; - - -//------------------------------------------------------------------------------ -// MARK: HELPERS - TYPE CONVERSION -//------------------------------------------------------------------------------ - - -/** -Convert data from SMC of fpe2 type to human readable. - -:param: data Data from the SMC to be converted. Assumed data size of 2. -:returns: Converted data -*/ -static unsigned int from_fpe2(uint8_t data[32]) -{ - unsigned int ans = 0; - - // Data type for fan calls - fpe2 - // This is assumend to mean floating point, with 2 exponent bits - // http://stackoverflow.com/questions/22160746/fpe2-and-sp78-data-types - ans += data[0] << 6; - ans += data[1] << 2; - - return ans; -} - - -/** -Convert to fpe2 data type to be passed to SMC. - -:param: val Value to convert -:param: data Pointer to data array to place result -*/ -static void to_fpe2(unsigned int val, uint8_t *data) -{ - data[0] = val >> 6; - data[1] = (val << 2) ^ (data[0] << 8); -} - - -/** -Convert SMC key to uint32_t. This must be done to pass it to the SMC. - -:param: key The SMC key to convert -:returns: uint32_t translation. - Returns zero if key is not 4 characters in length. -*/ -static uint32_t to_uint32_t(char *key) -{ - uint32_t ans = 0; - uint32_t shift = 24; - - // SMC key is expected to be 4 bytes - thus 4 chars - if (strlen(key) != SMC_KEY_SIZE) { - return 0; - } - - for (int i = 0; i < SMC_KEY_SIZE; i++) { - ans += key[i] << shift; - shift -= 8; - } - - return ans; -} - - -/** -For converting the dataType return from the SMC to human readable 4 byte -multi-character constant. -*/ -static void to_string(uint32_t val, char *dataType) -{ - int shift = 24; - - for (int i = 0; i < DATA_TYPE_SIZE; i++) { - // To get each char, we shift it into the lower 8 bits, and then & by - // 255 to insolate it - dataType[i] = (val >> shift) & 0xff; - shift -= 8; - } -} - - -//------------------------------------------------------------------------------ -// MARK: HELPERS - TMP CONVERSION -//------------------------------------------------------------------------------ - - -/** -Celsius to Fahrenheit -*/ -static double to_fahrenheit(double tmp) -{ - // http://en.wikipedia.org/wiki/Fahrenheit#Definition_and_conversions - return (tmp * 1.8) + 32; -} - - -/** -Celsius to Kelvin -*/ -static double to_kelvin(double tmp) -{ - // http://en.wikipedia.org/wiki/Kelvin - return tmp + 273.15; -} - - -//------------------------------------------------------------------------------ -// MARK: "PRIVATE" FUNCTIONS -//------------------------------------------------------------------------------ - - -/** -Make a call to the SMC - -:param: inputStruct Struct that holds data telling the SMC what you want -:param: outputStruct Struct holding the SMC's response -:returns: I/O Kit return code -*/ -static kern_return_t call_smc(SMCParamStruct *inputStruct, - SMCParamStruct *outputStruct) -{ - kern_return_t result; - size_t inputStructCnt = sizeof(SMCParamStruct); - size_t outputStructCnt = sizeof(SMCParamStruct); - - result = IOConnectCallStructMethod(conn, kSMCHandleYPCEvent, - inputStruct, - inputStructCnt, - outputStruct, - &outputStructCnt); - - if (result != kIOReturnSuccess) { - // IOReturn error code lookup. See "Accessing Hardware From Applications - // -> Handling Errors" Apple doc - result = err_get_code(result); - } - - return result; -} - - -/** -Read data from the SMC - -:param: key The SMC key -*/ -static kern_return_t read_smc(char *key, smc_return_t *result_smc) -{ - kern_return_t result; - SMCParamStruct inputStruct; - SMCParamStruct outputStruct; - - memset(&inputStruct, 0, sizeof(SMCParamStruct)); - memset(&outputStruct, 0, sizeof(SMCParamStruct)); - memset(result_smc, 0, sizeof(smc_return_t)); - - // First call to AppleSMC - get key info - inputStruct.key = to_uint32_t(key); - inputStruct.data8 = kSMCGetKeyInfo; - - result = call_smc(&inputStruct, &outputStruct); - result_smc->kSMC = outputStruct.result; - - if (result != kIOReturnSuccess || outputStruct.result != kSMCSuccess) { - return result; - } - - // Store data for return - result_smc->dataSize = outputStruct.keyInfo.dataSize; - result_smc->dataType = outputStruct.keyInfo.dataType; - - - // Second call to AppleSMC - now we can get the data - inputStruct.keyInfo.dataSize = outputStruct.keyInfo.dataSize; - inputStruct.data8 = kSMCReadKey; - - result = call_smc(&inputStruct, &outputStruct); - result_smc->kSMC = outputStruct.result; - - if (result != kIOReturnSuccess || outputStruct.result != kSMCSuccess) { - return result; - } - - memcpy(result_smc->data, outputStruct.bytes, sizeof(outputStruct.bytes)); - - return result; -} - - -/** -Write data to the SMC. - -:returns: IOReturn IOKit return code -*/ -static kern_return_t write_smc(char *key, smc_return_t *result_smc) -{ - kern_return_t result; - SMCParamStruct inputStruct; - SMCParamStruct outputStruct; - - memset(&inputStruct, 0, sizeof(SMCParamStruct)); - memset(&outputStruct, 0, sizeof(SMCParamStruct)); - - // First call to AppleSMC - get key info - inputStruct.key = to_uint32_t(key); - inputStruct.data8 = kSMCGetKeyInfo; - - result = call_smc(&inputStruct, &outputStruct); - result_smc->kSMC = outputStruct.result; - - if (result != kIOReturnSuccess || outputStruct.result != kSMCSuccess) { - return result; - } - - // Check data is correct - if (result_smc->dataSize != outputStruct.keyInfo.dataSize || - result_smc->dataType != outputStruct.keyInfo.dataType) { - return kIOReturnBadArgument; - } - - // Second call to AppleSMC - now we can write the data - inputStruct.data8 = kSMCWriteKey; - inputStruct.keyInfo.dataSize = outputStruct.keyInfo.dataSize; - - // Set data to write - memcpy(inputStruct.bytes, result_smc->data, sizeof(result_smc->data)); - - result = call_smc(&inputStruct, &outputStruct); - result_smc->kSMC = outputStruct.result; - - return result; -} - - -/** -Get the model name of the machine. -*/ -static kern_return_t get_machine_model(io_name_t model) -{ - io_service_t service; - kern_return_t result; - - service = IOServiceGetMatchingService(kIOMasterPortDefault, - IOServiceMatching(IOSERVICE_MODEL)); - - if (service == 0) { - printf("ERROR: %s NOT FOUND\n", IOSERVICE_MODEL); - return kIOReturnError; - } - - // Get the model name - result = IORegistryEntryGetName(service, model); - IOObjectRelease(service); - - return result; -} - - -//------------------------------------------------------------------------------ -// MARK: "PUBLIC" FUNCTIONS -//------------------------------------------------------------------------------ - - -kern_return_t open_smc(void) -{ - kern_return_t result; - io_service_t service; - - service = IOServiceGetMatchingService(kIOMasterPortDefault, - IOServiceMatching(IOSERVICE_SMC)); - - if (service == 0) { - // NOTE: IOServiceMatching documents 0 on failure - printf("ERROR: %s NOT FOUND\n", IOSERVICE_SMC); - return kIOReturnError; - } - - result = IOServiceOpen(service, mach_task_self(), 0, &conn); - IOObjectRelease(service); - - return result; -} - - -kern_return_t close_smc(void) -{ - return IOServiceClose(conn); -} - - -bool is_key_valid(char *key) -{ - bool ans = false; - kern_return_t result; - smc_return_t result_smc; - - if (strlen(key) != SMC_KEY_SIZE) { - printf("ERROR: Invalid key size - must be 4 chars\n"); - return ans; - } - - // Try a read and see if it succeeds - result = read_smc(key, &result_smc); - - if (result == kIOReturnSuccess && result_smc.kSMC == kSMCSuccess) { - ans = true; - } - - return ans; -} - - -double get_tmp(char *key, tmp_unit_t unit) -{ - kern_return_t result; - smc_return_t result_smc; - - result = read_smc(key, &result_smc); - - if (!(result == kIOReturnSuccess && - result_smc.dataSize == 2 && - result_smc.dataType == to_uint32_t(DATA_TYPE_SP78))) { - // Error - return 0.0; - } - - // TODO: Create from_sp78() convert function - double tmp = result_smc.data[0]; - - switch (unit) { - case CELSIUS: - break; - case FAHRENHEIT: - tmp = to_fahrenheit(tmp); - break; - case KELVIN: - tmp = to_kelvin(tmp); - break; - } - - return tmp; -} - - -bool is_battery_powered(void) -{ - kern_return_t result; - smc_return_t result_smc; - - result = read_smc(BATT_PWR, &result_smc); - - if (!(result == kIOReturnSuccess && - result_smc.dataSize == 1 && - result_smc.dataType == to_uint32_t(DATA_TYPE_FLAG))) { - // Error - return false; - } - - return result_smc.data[0]; -} - - -bool is_optical_disk_drive_full(void) -{ - kern_return_t result; - smc_return_t result_smc; - - result = read_smc(ODD_FULL, &result_smc); - - if (!(result == kIOReturnSuccess && - result_smc.dataSize == 1 && - result_smc.dataType == to_uint32_t(DATA_TYPE_FLAG))) { - // Error - return false; - } - - return result_smc.data[0]; -} - - -//------------------------------------------------------------------------------ -// MARK: FAN FUNCTIONS -//------------------------------------------------------------------------------ - - -bool get_fan_name(unsigned int fan_num, fan_name_t name) -{ - char key[5]; - kern_return_t result; - smc_return_t result_smc; - - sprintf(key, "F%dID", fan_num); - result = read_smc(key, &result_smc); - - if (!(result == kIOReturnSuccess && - result_smc.dataSize == 16 && - result_smc.dataType == to_uint32_t(DATA_TYPE_SFDS))) { - return false; - } - - - /* - We know the data size is 16 bytes and the type is "{fds", a custom - struct defined by the AppleSMC.kext. See TMP enum sources for the - struct. - - The last 12 bytes contain the name of the fan, an array of chars, hence - the loop range. - */ - int index = 0; - for (int i = 4; i < 16; i++) { - // Check if at the end (name may not be full 12 bytes) - // Could check for 0 (null), but instead we check for 32 (space). This - // is a hack to remove whitespace. :) - if (result_smc.data[i] == 32) { - break; - } - - name[index] = result_smc.data[i]; - index++; - } - - return true; -} - - -int get_num_fans(void) -{ - kern_return_t result; - smc_return_t result_smc; - - result = read_smc(NUM_FANS, &result_smc); - - if (!(result == kIOReturnSuccess && - result_smc.dataSize == 1 && - result_smc.dataType == to_uint32_t(DATA_TYPE_UINT8))) { - // Error - return -1; - } - - return result_smc.data[0]; -} - - -unsigned int get_fan_rpm(unsigned int fan_num) -{ - char key[5]; - kern_return_t result; - smc_return_t result_smc; - - sprintf(key, "F%dAc", fan_num); - result = read_smc(key, &result_smc); - - if (!(result == kIOReturnSuccess && - result_smc.dataSize == 2 && - result_smc.dataType == to_uint32_t(DATA_TYPE_FPE2))) { - // Error - return 0; - } - - return from_fpe2(result_smc.data); -} - - -bool set_fan_min_rpm(unsigned int fan_num, unsigned int rpm, bool auth) -{ - // TODO: Add rpm val safety check - char key[5]; - bool ans = false; - kern_return_t result; - smc_return_t result_smc; - - memset(&result_smc, 0, sizeof(smc_return_t)); - - // TODO: Don't use magic number - result_smc.dataSize = 2; - result_smc.dataType = to_uint32_t(DATA_TYPE_FPE2); - to_fpe2(rpm, result_smc.data); - - sprintf(key, "F%dMn", fan_num); - result = write_smc(key, &result_smc); - - if (result == kIOReturnSuccess && result_smc.kSMC == kSMCSuccess) { - ans = true; - } - - return ans; -} diff --git a/devices/include/smc.h b/devices/include/smc.h deleted file mode 100644 index d837e11..0000000 --- a/devices/include/smc.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Apple System Management Controller (SMC) API from user space for Intel based - * Macs. Works by talking to the AppleSMC.kext (kernel extension), the driver - * for the SMC. - * - * smc.h - * libsmc - * - * Copyright (C) 2014 beltex <https://github.com/beltex> - * - * Based off of fork from: - * osx-cpu-temp <https://github.com/lavoiesl/osx-cpu-temp> - * - * With credits to: - * - * Copyright (C) 2006 devnull - * Apple System Management Control (SMC) Tool - * - * Copyright (C) 2006 Hendrik Holtmann - * smcFanControl <https://github.com/hholtmann/smcFanControl> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <IOKit/IOKitLib.h> - - -//------------------------------------------------------------------------------ -// MARK: MACROS -//------------------------------------------------------------------------------ - - -/** -SMC keys for temperature sensors - 4 byte multi-character constants - -Not applicable to all Mac's of course. In adition, the definition of the codes -may not be 100% accurate necessarily. Finally, list is incomplete. - -Presumed letter translations: - -- T = Temperature (if first char) -- C = CPU -- G = GPU -- P = Proximity -- D = Diode -- H = Heatsink - -Sources: - -- https://www.apple.com/downloads/dashboard/status/istatpro.html -- https://github.com/hholtmann/smcFanControl -- https://github.com/jedda/OSX-Monitoring-Tools -- http://www.parhelia.ch/blog/statics/k3_keys.html -*/ -#define AMBIENT_AIR_0 "TA0P" -#define AMBIENT_AIR_1 "TA1P" -#define CPU_0_DIODE "TC0D" -#define CPU_0_HEATSINK "TC0H" -#define CPU_0_PROXIMITY "TC0P" -#define ENCLOSURE_BASE_0 "TB0T" -#define ENCLOSURE_BASE_1 "TB1T" -#define ENCLOSURE_BASE_2 "TB2T" -#define ENCLOSURE_BASE_3 "TB3T" -#define GPU_0_DIODE "TG0D" -#define GPU_0_HEATSINK "TG0H" -#define GPU_0_PROXIMITY "TG0P" -#define HARD_DRIVE_BAY "TH0P" -#define MEMORY_SLOT_0 "TM0S" -#define MEMORY_SLOTS_PROXIMITY "TM0P" -#define NORTHBRIDGE "TN0H" -#define NORTHBRIDGE_DIODE "TN0D" -#define NORTHBRIDGE_PROXIMITY "TN0P" -#define THUNDERBOLT_0 "TI0P" -#define THUNDERBOLT_1 "TI1P" -#define WIRELESS_MODULE "TW0P" - - -/** -SMC keys for fans - 4 byte multi-character constants - -Number of fans on Macs vary of course, thus not all keys will be applicable. - -Presumed letter translations: - -- F = Fan -- Ac = Acutal -- Mn = Min -- Mx = Max -- Sf = Safe -- Tg = Target - -Sources: See TMP SMC keys -*/ -#define FAN_0 "F0Ac" -#define FAN_0_MIN_RPM "F0Mn" -#define FAN_0_MAX_RPM "F0Mx" -#define FAN_0_SAFE_RPM "F0Sf" -#define FAN_0_TARGET_RPM "F0Tg" -#define FAN_1 "F1Ac" -#define FAN_1_MIN_RPM "F1Mn" -#define FAN_1_MAX_RPM "F1Mx" -#define FAN_1_SAFE_RPM "F1Sf" -#define FAN_1_TARGET_RPM "F1Tg" -#define FAN_2 "F2Ac" -#define FAN_2_MIN_RPM "F2Mn" -#define FAN_2_MAX_RPM "F2Mx" -#define FAN_2_SAFE_RPM "F2Sf" -#define FAN_2_TARGET_RPM "F2Tg" -#define NUM_FANS "FNum" -#define FORCE_BITS "FS! " - - -/** -Misc SMC keys - 4 byte multi-character constants - -Sources: See TMP SMC keys -*/ -#define BATT_PWR "BATP" -#define NUM_KEYS "#KEY" -#define ODD_FULL "MSDI" - - -//------------------------------------------------------------------------------ -// MARK: TYPES -//------------------------------------------------------------------------------ - - -typedef char fan_name_t[13]; - - -//------------------------------------------------------------------------------ -// MARK: ENUMS -//------------------------------------------------------------------------------ - - -typedef enum { - CELSIUS, - FAHRENHEIT, - KELVIN -} tmp_unit_t; - - -//------------------------------------------------------------------------------ -// MARK: PROTOTYPES -//------------------------------------------------------------------------------ - - -/** -Open a connection to the SMC - -:returns: kIOReturnSuccess on successful connection to the SMC. -*/ -kern_return_t open_smc(void); - - -/** -Close connection to the SMC - -:returns: kIOReturnSuccess on successful close of connection to the SMC. -*/ -kern_return_t close_smc(void); - - -/** -Check if an SMC key is valid. Useful for determining if a certain machine has -particular sensor or fan for example. - -:param: key The SMC key to check. 4 byte multi-character constant. Must be 4 - characters in length. -:returns: True if the key is found, false otherwise -*/ -bool is_key_valid(char *key); - - -/** -Get the current temperature from a sensor - -:param: key The temperature sensor to read from -:param: unit The unit for the temperature value. -:returns: Temperature of sensor. If the sensor is not found, or an error - occurs, return will be zero -*/ -double get_tmp(char *key, tmp_unit_t unit); - - -/** -Is the machine being powered by the battery? - -:returns: True if it is, false otherwise -*/ -bool is_battery_powered(void); - - -/** -Is there a CD in the optical disk drive (ODD)? - -:returns: True if there is, false otherwise -*/ -bool is_optical_disk_drive_full(void); - - -/** -Get the name of a fan. - -:param: fanNum The number of the fan to check -:param: name The name of the fan. Return will be empty on error. -:returns: True if successful, false otherwise. -*/ -bool get_fan_name(unsigned int fan_num, fan_name_t name); - - -/** -Get the number of fans on this machine. - -:returns: The number of fans. If an error occurs, return will be -1. -*/ -int get_num_fans(void); - - -/** -Get the current speed (RPM - revolutions per minute) of a fan. - -:param: fan_num The number of the fan to check -:returns: The fan RPM. If the fan is not found, or an error occurs, return - will be zero -*/ -UInt get_fan_rpm(UInt fan_num); - - -/** -Set the minimum speed (RPM - revolutions per minute) of a fan. This method -requires root privileges. By minimum we mean that OS X can interject and -raise the fan speed if needed, however it will not go below this. - -WARNING: You are playing with hardware here, BE CAREFUL. - -:param: fan_num The number of the fan to set -:param: rpm The speed you would like to set the fan to. -:param: auth Should the function do authentication? -:return: True if successful, false otherwise -*/ -bool set_fan_min_rpm(unsigned int fan_num, unsigned int rpm, bool auth); From 76236a0993013788573fc53dc8b0a563b2fc1639 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 24 May 2020 13:56:25 -0500 Subject: [PATCH 18/46] Documentation clean-up. --- CHANGELOG.md | 1 + cmd/gotop/main.go | 2 -- devices/cpu_cpu.go | 1 - devices/temp_darwin.go | 1 + 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 318c4f0..dbc0077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Command line help text is cleaned up. - Version bump of gopsutil - Prometheus client replaced by [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics). This eliminated 6 indirect package dependencies and saved 3.5MB (25%) of the compiled binary size. +- Relicensed to MIT-3 ### Removed diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index dc869ce..089d47a 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -72,8 +72,6 @@ func parseArgs() error { opflag.StringVarP(&conf.NetInterface, "interface", "i", "all", "Select network interface. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using `!`") opflag.StringVarP(&conf.ExportPort, "export", "x", conf.ExportPort, "Enable metrics for export on the specified port.") opflag.BoolVarP(&conf.Mbps, "mbps", "", conf.Mbps, "Show network rate as mbps.") - // FIXME Where did this go?? - //conf.Band = opflag.IntP("bandwidth", "B", 100, "Specify the number of bits per seconds.") opflag.BoolVar(&conf.Test, "test", conf.Test, "Runs tests and exits with success/failure code.") opflag.StringP("", "C", "", "Config file to use instead of default (MUST BE FIRST ARGUMENT)") list := opflag.String("list", "", `List <devices|layouts|colorschemes|paths|keys> diff --git a/devices/cpu_cpu.go b/devices/cpu_cpu.go index a959e32..187d9fd 100644 --- a/devices/cpu_cpu.go +++ b/devices/cpu_cpu.go @@ -8,7 +8,6 @@ import ( ) // FIXME: broken % under Linux. Doesn't reflect reality *at all*. -// FIXME: gotop CPU use high -- gopsutils again? Try rolling back. func init() { f := func(cpus map[string]int, iv time.Duration, l bool) map[string]error { cpuCount, err := psCpu.Counts(l) diff --git a/devices/temp_darwin.go b/devices/temp_darwin.go index 37559d1..1111943 100644 --- a/devices/temp_darwin.go +++ b/devices/temp_darwin.go @@ -2,6 +2,7 @@ package devices +// TODO gopsutil team reports this is not needed; try getting rid of this dep import smc "github.com/xxxserxxx/iSMC" func init() { From 06ee1ad9491f762d28fb1a748a1af6f8c37eec90 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 24 May 2020 14:19:10 -0500 Subject: [PATCH 19/46] Merges #125 from @wcdawn, with some minor modifications. --- README.md | 2 ++ scripts/install_without_root.sh | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 scripts/install_without_root.sh diff --git a/README.md b/README.md index 9ec4b3d..f773c1c 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ go build -o gotop ./cmd/gotop Move `gotop` to somewhere in your `$PATH`. +If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`. + ## Usage Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command. diff --git a/scripts/install_without_root.sh b/scripts/install_without_root.sh new file mode 100755 index 0000000..9bdf839 --- /dev/null +++ b/scripts/install_without_root.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Builds the gotop executable on machines where Go isn't installed, +# or is the wrong version, and you don't have root access to upgrade or +# install Go. +# +# You can run this without cloning the entire gotop repository (the script +# will do this for you.) + +set -x + +VERSION='1.14.2' # Go version needed to build +OS='linux' +ARCH='amd64' +BUILDDIR=/tmp/gotop-build +INSTALLDIR=${HOME}/bin + +GO_NAME=go${VERSION}.${OS}-${ARCH} + +mkdir -p $BUILDDIR +cd $BUILDDIR + +curl https://dl.google.com/go/${GO_NAME}.tar.gz --output ./${GO_NAME}.tar.gz + +tar -vxzf ${GO_NAME}.tar.gz +rm ${GO_NAME}.tar.gz + +PATH=$BUILDDIR/go/bin:$PATH + +go env -w GOPATH=$BUILDDIR # otherwise go would create a directory in $HOME + +rm -rf ./gotop +git clone https://github.com/xxxserxxx/gotop.git +cd ./gotop +go build -o gotop ./cmd/gotop + +go clean -modcache # otherwise $BUILDDIR/pkg would need sudo permissions to remove + +mkdir -p $INSTALLDIR +mv gotop ${INSTALLDIR}/gotop + +rm -rf $BUILDDIR + +printf "gotop installed in ${INSTALLDIR}/gotop\n" + From 9fd6764acfa81be0b28458fd62844ad341c96740 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 24 May 2020 14:36:24 -0500 Subject: [PATCH 20/46] Update changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbc0077..4e3966f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Command line option to list layouts, paths, colorschemes, hotkeys, and filterable devices - Adds ability to write out a configuration file - Adds a command for specifying the configuration file to use +- Added contribution from @wcdawn for building on machines w/ no Go/root access ### Changed From d1cabfdc6f595248633fa4fa504aedf4e296a6ef Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Thu, 28 May 2020 13:37:44 -0500 Subject: [PATCH 21/46] Fixes #95 Update termui and pin termbox-go to newer version. This commit is broken because of the merge from master. --- go.mod | 3 ++- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 1763e3d..07b0ad1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/VictoriaMetrics/metrics v1.11.2 github.com/distatus/battery v0.9.0 - github.com/gizak/termui/v3 v3.0.0 + github.com/gizak/termui/v3 v3.1.0 github.com/go-ole/go-ole v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.4 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 @@ -14,6 +14,7 @@ require ( github.com/xxxserxxx/opflag v1.0.5 golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 // indirect howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect + github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 ) go 1.14 diff --git a/go.sum b/go.sum index d698b71..16e6630 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/distatus/battery v0.9.0 h1:8NS5o00/j3Oh2xgocA6pQROTp5guoR+s8CZlWzHC4Q github.com/distatus/battery v0.9.0/go.mod h1:gGO7GxHTi1zlRT+cAj8uGG0/8HFiqAeH0TJvoipnuPs= github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE= github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY= +github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= +github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -25,6 +27,8 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzC github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= +github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 h1:lh3PyZvY+B9nFliSGTn5uFuqQQJGuNrD0MLCokv09ag= +github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a h1:P0QSyHOubLI2e6hccBBEjVX0vPWXoXui5QCAVNWdJSk= github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a/go.mod h1:u8Q8dpnMAam0MElxP2KjEROzXMk9G8X168RTpAZ9tPc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= From 0a7c4d82e4cbf05ee28549e7e6ef19aa4f262325 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Thu, 28 May 2020 17:50:47 -0500 Subject: [PATCH 22/46] Always use Dup2 on FreeBSD. Clears up the FreeBSD dup2 patch issues; the build flags were causing compile failures on other target OSes. --- logging/logging_arm64.go | 2 +- logging/logging_other.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/logging/logging_arm64.go b/logging/logging_arm64.go index 03848bb..b88c479 100644 --- a/logging/logging_arm64.go +++ b/logging/logging_arm64.go @@ -1,4 +1,4 @@ -// +build arm64 +// +build !freebsd,arm64 package logging diff --git a/logging/logging_other.go b/logging/logging_other.go index fd88b83..e910821 100644 --- a/logging/logging_other.go +++ b/logging/logging_other.go @@ -1,5 +1,4 @@ -// +build linux openbsd freebsd darwin -// +build !arm64 +// +build linux,!arm64 openbsd,!arm64 freebsd darwin,!arm64 package logging From 66bc1919ea4fccd1c7a58808a2294b200d3439e6 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Thu, 28 May 2020 17:51:34 -0500 Subject: [PATCH 23/46] Fixes #95. When termui updates to the termbox-go with the FreeBSD fix, this can be reverted. --- go.mod | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 38e1380..c48467f 100644 --- a/go.mod +++ b/go.mod @@ -7,10 +7,9 @@ require ( github.com/gizak/termui/v3 v3.0.0 github.com/go-ole/go-ole v1.2.1 // indirect github.com/mattn/go-runewidth v0.0.4 - github.com/mitchellh/go-wordwrap v1.0.0 // indirect - github.com/prometheus/client_golang v1.4.1 - github.com/shirou/gopsutil v2.18.11+incompatible - github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect + github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 + github.com/shirou/gopsutil v2.20.3+incompatible + github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 github.com/stretchr/testify v1.4.0 howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect ) From 0900e98abbb47773f0b2ab889158613af9c1a943 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Thu, 28 May 2020 18:16:39 -0500 Subject: [PATCH 24/46] Update CHANGELOG --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4ca11c..9b30507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. +## [3.5.3] - NOT YET RELEASED + +### Fixed + +- Compile errors on FreeBSD due to golang.org/x/sys API breakages +- Key bindings now work in FreeBSD (#95) + ## [3.5.2] - 2020-04-28 ### Fixed From 8a4261203136f27c6941f5f2034d8b64f2896723 Mon Sep 17 00:00:00 2001 From: mikael <mikael@FreeBSD.org> Date: Wed, 29 Apr 2020 17:32:00 +0200 Subject: [PATCH 25/46] Use dup2 on FreeBSD aarch64 Update changelog. Clears up the FreeBSD dup2 patch issues; the build flags were causing compile failures on other target OSes. --- CHANGELOG.md | 1 + logging/logging_arm64.go | 2 +- logging/logging_other.go | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbc0077..4e3966f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Command line option to list layouts, paths, colorschemes, hotkeys, and filterable devices - Adds ability to write out a configuration file - Adds a command for specifying the configuration file to use +- Added contribution from @wcdawn for building on machines w/ no Go/root access ### Changed diff --git a/logging/logging_arm64.go b/logging/logging_arm64.go index 03848bb..b88c479 100644 --- a/logging/logging_arm64.go +++ b/logging/logging_arm64.go @@ -1,4 +1,4 @@ -// +build arm64 +// +build !freebsd,arm64 package logging diff --git a/logging/logging_other.go b/logging/logging_other.go index fd88b83..e910821 100644 --- a/logging/logging_other.go +++ b/logging/logging_other.go @@ -1,5 +1,4 @@ -// +build linux openbsd freebsd darwin -// +build !arm64 +// +build linux,!arm64 openbsd,!arm64 freebsd darwin,!arm64 package logging From a1bd0cc9eeec86dac382c4b027fc738b96bfa2fe Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Thu, 28 May 2020 17:51:34 -0500 Subject: [PATCH 26/46] Fixes #95. When termui updates to the termbox-go with the FreeBSD fix, this can be reverted. Update changelog --- CHANGELOG.md | 2 ++ go.mod | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3966f..1b8d983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Temperatures on Darwin were all over the place, and wrong (#48) - Config file loading from `~/.config/gotop` wasn't working - There were a number of minor issues with the config file that have been cleaned up. +- Compile errors on FreeBSD due to golang.org/x/sys API breakages +- Key bindings now work in FreeBSD (#95) ## [3.5.2] - 2020-04-28 diff --git a/go.mod b/go.mod index 1763e3d..cb5cb3c 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/mattn/go-runewidth v0.0.4 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 github.com/shirou/gopsutil v2.20.3+incompatible + github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 From 11e412c29ccfec59bea80d3acc87072b4ea0a67f Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sat, 30 May 2020 05:32:26 -0500 Subject: [PATCH 27/46] Fixes #97 Updating the modules files for FreeBSD log fix --- devices/temp_freebsd.go | 24 ++++++++++++++++++++++++ go.mod | 6 +++++- go.sum | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/devices/temp_freebsd.go b/devices/temp_freebsd.go index 0916122..6686c32 100644 --- a/devices/temp_freebsd.go +++ b/devices/temp_freebsd.go @@ -3,6 +3,7 @@ package devices import ( + "log" "os/exec" "strconv" "strings" @@ -11,6 +12,10 @@ import ( ) func init() { + if len(devs()) == 0 { + log.Println("temp: no thermal sensors found") + return + } RegisterTemp(update) } @@ -43,3 +48,22 @@ func update(temps map[string]int) map[string]error { return errors } + +func devs() []string { + rv := make([]string, 0, len(sensorOIDS)) + // Check that thermal sensors are really available; they aren't in VMs + bs, err := exec.Command("sysctl", "-a").Output() + if err != nil { + log.Printf("temp: failure to get system information %s", err.Error()) + return []string{} + } + for k, _ := range sensorOIDS { + idx := strings.Index(string(bs), k) + if idx < 0 { + log.Printf("temp: no device %s found", k) + } else { + rv = append(rv, k) + } + } + return rv +} diff --git a/go.mod b/go.mod index c48467f..10145b3 100644 --- a/go.mod +++ b/go.mod @@ -6,11 +6,15 @@ require ( github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815 github.com/gizak/termui/v3 v3.0.0 github.com/go-ole/go-ole v1.2.1 // indirect + github.com/golang/protobuf v1.4.0 // indirect github.com/mattn/go-runewidth v0.0.4 + github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 + github.com/prometheus/client_golang v1.5.1 + github.com/prometheus/procfs v0.0.11 // indirect github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 github.com/shirou/gopsutil v2.20.3+incompatible - github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 github.com/stretchr/testify v1.4.0 + golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect ) diff --git a/go.sum b/go.sum index 3cf7498..1a33e20 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,13 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -53,6 +60,7 @@ github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= 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/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= @@ -63,6 +71,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= +github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 h1:lh3PyZvY+B9nFliSGTn5uFuqQQJGuNrD0MLCokv09ag= +github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -72,6 +82,10 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.1 h1:FFSuS004yOQEtDdTq+TAOLP5xUq63KqAFYyOi8zA+Y8= github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= +github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= @@ -83,8 +97,13 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI= +github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y= github.com/shirou/gopsutil v2.18.11+incompatible h1:PMFTKnFTr/YTRW5rbLK4vWALV3a+IGXse5nvhSjztmg= github.com/shirou/gopsutil v2.18.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v2.20.3+incompatible h1:0JVooMPsT7A7HqEYdydp/OfjSOYSjhXV7w1hkKj/NPQ= +github.com/shirou/gopsutil v2.20.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -108,12 +127,25 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 h1:4Khi5GeNOkZS5DqSBRn4Sy7BE6GuxwOqARPqfurkdNk= +golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 7b09b909366ed45736a4230986aa5fe687cc0170 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Fri, 29 May 2020 19:27:39 -0500 Subject: [PATCH 28/46] Closes #111, which was a bogus issue. --- config.go | 1 - 1 file changed, 1 deletion(-) diff --git a/config.go b/config.go index 758b8c2..5da6f32 100644 --- a/config.go +++ b/config.go @@ -162,7 +162,6 @@ func load(in io.Reader, conf *Config) error { } conf.Statusbar = bv case netinterface: - // FIXME this should be a comma-separated list conf.NetInterface = kv[1] case layout: conf.Layout = kv[1] From dcfa280166ff73690484de60e48e389eb4488f39 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Fri, 29 May 2020 20:38:27 -0500 Subject: [PATCH 29/46] Work-around for https://github.com/shirou/gopsutil/issues/853, FreeBSD build failures. --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index cb5cb3c..0dd1170 100644 --- a/go.mod +++ b/go.mod @@ -7,13 +7,13 @@ require ( github.com/gizak/termui/v3 v3.0.0 github.com/go-ole/go-ole v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.4 + github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 github.com/shirou/gopsutil v2.20.3+incompatible - github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 - golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 // indirect + golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 // indirect howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect ) diff --git a/go.sum b/go.sum index d698b71..63de1cb 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,8 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzC github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= +github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 h1:lh3PyZvY+B9nFliSGTn5uFuqQQJGuNrD0MLCokv09ag= +github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a h1:P0QSyHOubLI2e6hccBBEjVX0vPWXoXui5QCAVNWdJSk= github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a/go.mod h1:u8Q8dpnMAam0MElxP2KjEROzXMk9G8X168RTpAZ9tPc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -45,6 +47,8 @@ github.com/xxxserxxx/iSMC v1.0.1/go.mod h1:TGgNjU7BF2DZSuxiTft+BdzxzcujFJYqFfMCz github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90= github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= +golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 h1:4Khi5GeNOkZS5DqSBRn4Sy7BE6GuxwOqARPqfurkdNk= +golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 h1:OKbAoGs4fGM5cPLlVQLZGYkFC8OnOfgo6tt0Smf9XhM= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= From 30f59c43dab191f39a9f6a9bf966365f9de99d68 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sat, 30 May 2020 05:35:27 -0500 Subject: [PATCH 30/46] Fixes #97 --- devices/temp_freebsd.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/devices/temp_freebsd.go b/devices/temp_freebsd.go index 196a6d7..d246c0e 100644 --- a/devices/temp_freebsd.go +++ b/devices/temp_freebsd.go @@ -3,6 +3,7 @@ package devices import ( + "log" "os/exec" "strconv" "strings" @@ -11,6 +12,10 @@ import ( ) func init() { + if len(devs()) == 0 { + log.Println("temp: no thermal sensors found") + return + } RegisterTemp(update) RegisterDeviceList(Temperatures, devs, devs) } @@ -50,8 +55,19 @@ func update(temps map[string]int) map[string]error { func devs() []string { rv := make([]string, 0, len(sensorOIDS)) + // Check that thermal sensors are really available; they aren't in VMs + bs, err := exec.Command("sysctl", "-a").Output() + if err != nil { + log.Printf("temp: failure to get system information %s", err.Error()) + return []string{} + } for k, _ := range sensorOIDS { - rv = append(rv, k) + idx := strings.Index(string(bs), k) + if idx < 0 { + log.Println("temp: no device %s found", k) + } else { + rv = append(rv, k) + } } return rv } From 14a49e86a2f2defed639533926053b5234a00bfd Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sat, 30 May 2020 10:03:56 -0500 Subject: [PATCH 31/46] Changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b30507..d2e55fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. -## [3.5.3] - NOT YET RELEASED +## [3.5.3] - 2020-06-?? + +The FreeBSD bugfix release. While there are non-FreeBSD fixes in here, the focus was getting gotop to work properly on FreeBSD. ### Fixed - Compile errors on FreeBSD due to golang.org/x/sys API breakages - Key bindings now work in FreeBSD (#95) +- Eliminate repeated logging about missing sensor data on FreeBSD VMs (#97) +- Investigated #14, a report about gotop's memory not matching `top`'s numbers, and came to the conclusions that (a) `gotop` is more correct in some cases (swap) than `top`, and (b) that the metric `gotop` is using (`hw.physmem`) is probably correct -- or that there's no obviously superior metric. So no change. ## [3.5.2] - 2020-04-28 From 5840773ec6637c94f7eba17d7c11d6d2e7eebd8c Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sat, 30 May 2020 19:59:50 -0500 Subject: [PATCH 32/46] Actually commit the version change. --- CHANGELOG.md | 4 ++-- cmd/gotop/main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e55fd..b582b73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,13 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. -## [3.5.3] - 2020-06-?? +## [3.5.3] - 2020-05-30 The FreeBSD bugfix release. While there are non-FreeBSD fixes in here, the focus was getting gotop to work properly on FreeBSD. ### Fixed -- Compile errors on FreeBSD due to golang.org/x/sys API breakages +- Address FreeBSD compile errors resulting to `golang.org/x/sys` API breakages - Key bindings now work in FreeBSD (#95) - Eliminate repeated logging about missing sensor data on FreeBSD VMs (#97) - Investigated #14, a report about gotop's memory not matching `top`'s numbers, and came to the conclusions that (a) `gotop` is more correct in some cases (swap) than `top`, and (b) that the metric `gotop` is using (`hw.physmem`) is probably correct -- or that there's no obviously superior metric. So no change. diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 81a6d07..293e6b2 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -39,7 +39,7 @@ const ( var ( // TODO: Set this at compile time; having to check this in sucks. - Version = "3.5.2" + Version = "3.5.3" conf gotop.Config help *w.HelpMenu bar *w.StatusBar From e72e7be141846948d02da4ec58fe6f1166030e26 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sat, 30 May 2020 17:23:03 -0500 Subject: [PATCH 33/46] Bring 3.5.3 change log forward; pin golang.org/x/sys version Changelog and Readme updates --- CHANGELOG.md | 11 +++++++++++ README.md | 8 +++++--- go.mod | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b8d983..d4f6f77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Compile errors on FreeBSD due to golang.org/x/sys API breakages - Key bindings now work in FreeBSD (#95) +## [3.5.3] - 2020-05-30 + +The FreeBSD bugfix release. While there are non-FreeBSD fixes in here, the focus was getting gotop to work properly on FreeBSD. + +### Fixed + +- Compile errors on FreeBSD due to `golang.org/x/sys` API breakages +- Key bindings now work in FreeBSD (#95) +- Eliminate repeated logging about missing sensor data on FreeBSD VMs (#97) +- Investigated #14, a report about gotop's memory not matching `top`'s numbers, and came to the conclusions that (a) `gotop` is more correct in some cases (swap) than `top`, and (b) that the metric `gotop` is using (`hw.physmem`) is probably correct -- or that there's no obviously superior metric. So no change. + ## [3.5.2] - 2020-04-28 ### Fixed diff --git a/README.md b/README.md index f773c1c..f788221 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,10 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([  -See the [mini-blog](/xxxserxxx/gotop/wiki/blog) for updates on the build status, and the [change log](/xxxserxxx/gotop/blob/master/CHANGELOG.md) for release updates. +See the [mini-blog](/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/xxxserxxx/gotop/blob/master/CHANGELOG.md) for release updates. <img src="./assets/screenshots/demo.gif" /> -<img src="./assets/screenshots/kitchensink.gif" /> </div> @@ -219,6 +218,9 @@ Run `gotop -h` to see the list of all command line options. ## More screen shots +#### '-l kitchensink' + colorscheme +<img src="./assets/screenshots/kitchensink.gif" /> + #### "-l battery" <img src="./assets/screenshots/battery.png" /> @@ -240,7 +242,7 @@ Run `gotop -h` to see the list of all command line options. ## History -The original author of gotop started a new tool in Rust, called [ytop](https://github.com/cjbassi/ytop). This repository is a fork of original gotop project with a new maintainer. +**ca. 2020-01-25** The original author of gotop started a new tool in Rust, called [ytop](https://github.com/cjbassi/ytop), and deprecated his Go version. This repository is a fork of original gotop project with a new maintainer to keep the project alive and growing. An objective of the fork is to maintain a small, focused core while providing a path to extend functionality for less universal use cases; examples of this is sensor support for NVidia graphics cards, and for aggregating data from remote gotop instances. ## Stargazers over time diff --git a/go.mod b/go.mod index 0dd1170..b98bdf5 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 - golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 // indirect + golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect ) From 5123568b923991f9fba318954ea3e8cf6785e252 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 31 May 2020 14:45:24 -0500 Subject: [PATCH 34/46] Only report battery sensor errors once; closes #117 --- CHANGELOG.md | 1 + widgets/batterygauge.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53b5a2c..b5ae31c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - There were a number of minor issues with the config file that have been cleaned up. - Compile errors on FreeBSD due to golang.org/x/sys API breakages - Key bindings now work in FreeBSD (#95) +- Only report battery sensor errors once (reduce noise in the log, #117) ## [3.5.3] - 2020-05-30 diff --git a/widgets/batterygauge.go b/widgets/batterygauge.go index f28dd34..135f223 100644 --- a/widgets/batterygauge.go +++ b/widgets/batterygauge.go @@ -39,11 +39,16 @@ func (b *BatteryGauge) EnableMetric() { }) } +// Only report battery errors once. +var errLogged = false + func (b *BatteryGauge) update() { - // FIXME: Getting a lot of these in the logs bats, err := battery.GetAll() if err != nil { - log.Printf("error setting up batteries: %v", err) + if !errLogged { + log.Printf("error setting up batteries: %v", err) + errLogged = true + } return } mx := 0.0 From 44b5d2d6eca94aa2329f07e2e5525577344ece7d Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 31 May 2020 15:48:14 -0500 Subject: [PATCH 35/46] Fixes #128 for LineGraph; there's probably another leak in Sparkline Fixes #128 for Sparkline. Also, the amount of data held is tiny so bumped the buffer to 4x to reduce collections. Minor comment change --- termui/linegraph.go | 17 ++++++++++++++--- termui/sparkline.go | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/termui/linegraph.go b/termui/linegraph.go index 55aacbd..db15822 100644 --- a/termui/linegraph.go +++ b/termui/linegraph.go @@ -8,11 +8,18 @@ import ( drawille "github.com/xxxserxxx/gotop/v4/termui/drawille-go" ) -// LineGraph implements a line graph of data points. +// LineGraph draws a graph like this ⣀⡠⠤⠔⣁ of data points. type LineGraph struct { *Block - Data map[string][]float64 + // Data is a size-managed data set for the graph. Each entry is a line; + // each sub-array are points in the line. The maximum size of the + // sub-arrays is controlled by the size of the canvas. This + // array is **not** thread-safe. Do not modify this array, or it's + // sub-arrays in threads different than the thread that calls `Draw()` + Data map[string][]float64 + // The labels drawn on the graph for each of the lines; the key is shared + // by Data; the value is the text that will be rendered. Labels map[string]string HorizontalScale int @@ -67,8 +74,9 @@ func (self *LineGraph) Draw(buf *Buffer) { // coordinates of last point lastY, lastX := -1, -1 // assign colors to `colors` and lines/points to the canvas + dx := self.Inner.Dx() for i := len(seriesData) - 1; i >= 0; i-- { - x := ((self.Inner.Dx() + 1) * 2) - 1 - (((len(seriesData) - 1) - i) * self.HorizontalScale) + x := ((dx + 1) * 2) - 1 - (((len(seriesData) - 1) - i) * self.HorizontalScale) y := ((self.Inner.Dy() + 1) * 4) - 1 - int((float64((self.Inner.Dy())*4)-1)*(seriesData[i]/100)) if x < 0 { // render the line to the last point up to the wall @@ -80,6 +88,9 @@ func (self *LineGraph) Draw(buf *Buffer) { } } } + if len(seriesData) > 4*dx { + self.Data[seriesName] = seriesData[dx-1:] + } break } if lastY == -1 { // if this is the first point diff --git a/termui/sparkline.go b/termui/sparkline.go index 2f27d9e..3b3ad75 100644 --- a/termui/sparkline.go +++ b/termui/sparkline.go @@ -98,5 +98,9 @@ func (self *SparklineGroup) Draw(buf *Buffer) { image.Pt(self.Inner.Min.X+x-1, self.Inner.Min.Y+sparkY-1), ) } + dx := self.Inner.Dx() + if len(line.Data) > 4*dx { + line.Data = line.Data[dx-1:] + } } } From a1d276aa53236aed2ca19afbcc8d16d2bd571bea Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 31 May 2020 20:05:54 -0500 Subject: [PATCH 36/46] Update instructions and current release badge. --- docs/release.svg | 4 ++-- docs/releasing.md | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/release.svg b/docs/release.svg index 5f08114..6f3fd31 100644 --- a/docs/release.svg +++ b/docs/release.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" width="300" height="30"> - <a href="/xxxserxxx/gotop/releases/tag/v3.5.2"> + <a href="/xxxserxxx/gotop/releases/tag/v3.5.3"> <text text-anchor="middle" font-size="14pt" fill="#000000" x="150" y="15"> - Current release: <tspan font-weight="bold">v3.5.2</tspan> + Current release: <tspan font-weight="bold">v3.5.3</tspan> </text> </a> </svg> diff --git a/docs/releasing.md b/docs/releasing.md index e87e4de..93e096f 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -3,10 +3,11 @@ Current steps for a release: ### gotop 1. Update Version in main.go 2. Update CHANGELOG.md -3. Tag -4. Push everything -5. When the github workflows complete, finish the draft release and publish. -6. Wait for the [Homebrew](https://github.com/xxxserxxx/homebrew-gotop) and [AUR](https://github.com/xxxserxxx/gotop-linux] projects to finish building. +3. Update docs/release.svg +4. Tag +5. Push everything +6. When the github workflows complete, finish the draft release and publish. +7. Wait for the [Homebrew](https://github.com/xxxserxxx/homebrew-gotop) and [AUR](https://github.com/xxxserxxx/gotop-linux] projects to finish building. 1. check out gotop-linux and run `aurpublish aur` and `aurpublish aur-bin` 2. update the hashes in the Nix package (see below), test build, push a pull request 3. notify Homebrew From b24cd05fcc08bdd902925876c37b22add1c11b8d Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 31 May 2020 20:08:40 -0500 Subject: [PATCH 37/46] Fixing github's inconsistent reference handling. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f788221..20ef3c9 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,7 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([  -See the [mini-blog](/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/xxxserxxx/gotop/blob/master/CHANGELOG.md) for release updates. - +See the [mini-blog](/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates. <img src="./assets/screenshots/demo.gif" /> From dcec8a53b748efa0f5eae0124a343d47541cae63 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Mon, 1 Jun 2020 11:08:19 -0500 Subject: [PATCH 38/46] Doc changes --- README.md | 2 +- docs/releasing.md | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 20ef3c9..543561c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([  -See the [mini-blog](/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates. +See the [mini-blog](https://github.com/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates. <img src="./assets/screenshots/demo.gif" /> diff --git a/docs/releasing.md b/docs/releasing.md index 93e096f..b9efc70 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,24 +1,26 @@ -Current steps for a release: +# Current steps for a release -### gotop 1. Update Version in main.go 2. Update CHANGELOG.md 3. Update docs/release.svg 4. Tag 5. Push everything 6. When the github workflows complete, finish the draft release and publish. -7. Wait for the [Homebrew](https://github.com/xxxserxxx/homebrew-gotop) and [AUR](https://github.com/xxxserxxx/gotop-linux] projects to finish building. - 1. check out gotop-linux and run `aurpublish aur` and `aurpublish aur-bin` - 2. update the hashes in the Nix package (see below), test build, push a pull request +7. Wait for the [AUR](https://github.com/xxxserxxx/gotop-linux] project to finish building. + 1. update arch (gotop-linux) and run `aurpublish aur` and `aurpublish aur-bin` + 2. notify Nix 3. notify Homebrew -Homebrew is automatically updated. The AUR project still needs secret -credentials to aurpublish to the AUR repository, so the final publish step is -still currently manual. +The AUR project still needs secret credentials to aurpublish to the AUR +repository, so the final publish step is still currently manual. Oh, what a tangled web. +## Nix + +I haven't yet figured this out, so currently just file a ticket and hope somebody on that end updates the package. + Nix adds new and interesting complexities to the release. 0. Download the gotop src package; run sha256 on it to get the hash From d6be10bcd88b45899fef9b66ead2ebf507743c39 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 2 Jun 2020 09:09:23 -0500 Subject: [PATCH 39/46] Closes #100, breaks up the README --- .github/workflows/release.yml | 18 ++-- README.md | 164 ++++------------------------------ docs/colorschemes.md | 12 +++ docs/configuration.md | 12 +++ docs/devices.md | 37 ++++++++ docs/layouts.md | 79 ++++++++++++++++ 6 files changed, 171 insertions(+), 151 deletions(-) create mode 100644 docs/colorschemes.md create mode 100644 docs/configuration.md create mode 100644 docs/devices.md create mode 100644 docs/layouts.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b158768..c212991 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,13 @@ jobs: event-type: my-release client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}' + - name: Update and inform Homebrew + uses: dawidd6/action-homebrew-bump-formula@v3 + with: + token: ${{ secrets.homebrew }} + formula: gotop + revision: ${{ steps.tag_name.outputs.tag }} + - name: Update Arch AURs uses: peter-evans/repository-dispatch@v1 with: @@ -30,12 +37,13 @@ jobs: event-type: my-release client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}' - - name: Update and inform Homebrew - uses: dawidd6/action-homebrew-bump-formula@v3 + - name: Trigger extensions build + uses: peter-evans/repository-dispatch@v1 with: - token: ${{ secrets.homebrew }} - formula: gotop - revision: ${{ steps.tag_name.outputs.tag }} + token: ${{ secrets.REPO_ACCESS_TOKEN }} + repository: xxxserxxx/gotop-builder + event-type: my-release + client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}' - name: Update current release badge shell: bash diff --git a/README.md b/README.md index 543561c..44a9891 100644 --- a/README.md +++ b/README.md @@ -36,22 +36,29 @@ If you install gotop by hand, or you download or create new layouts or colorsche - **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided. - **Source**: This requires Go >= 1.14. `go get -u github.com/xxxserxxx/gotop/cmd/gotop` -### Console Users Note +### Extension builds + +An evolving mechanism in gotop are extensions. This is designed to allow gotop to support feature sets that are not universally needed without blowing up the application for average users with usused features. Examples are support for specific hardware sets like video cards, or things that are just obviously not a core objective of the application, like remote server monitoring. + +The path to these extensions is a tool called [gotop-builder](https://github.com/xxxserxxx/gotop-builder). It is easy to use and depends only on having Go installed. You can read more about it on the project page, where you can also find binaries for Linux that have *all* extensions built in. If you want less than an all-inclusive build, or one for a different OS/architecture, you can use gotop-builder itself to create your own. + + +### Console Users gotop requires a font that has braille and block character Unicode code points; some distributions do not provide this. In the gotop repository is a `pcf` font that has these points, and setting this font may improve how gotop renders in your console. To use this, run these commands: ```shell -$ curl -O -L https://raw.githubusercontent.com/xxxserxxx/gotop/master/fonts/Lat15-VGA16-braille.psf -$ setfont Lat15-VGA16-braille.psf +curl -O -L https://raw.githubusercontent.com/xxxserxxx/gotop/master/fonts/Lat15-VGA16-braille.psf +setfont Lat15-VGA16-braille.psf ``` ### Building This is the download & compile approach. -gotop should build with most versions of Go. If you have a version other than 1.14 installed, remove the `go` line at the end of `go.mod`. +gotop should build with most versions of Go. If you have a version other than 1.14 installed, remove the `go` line at the end of `go.mod` and it should work. -``` +```shell git clone https://github.com/xxxserxxx/gotop.git cd gotop sed -i '/^go/d' go.mod # Do this if you have go != 1.14 @@ -71,149 +78,14 @@ In addition to the key bindings, the mouse can be used to control the process li - click to select process - mouse wheel to scroll through processes -## Config file +For more information on other topics, see: -Most command-line settings can be persisted into a configuration file. The config file is named `gotop.conf` and can be located in several places. The first place gotop will look is in the current directory; after this, the locations depend on the OS and distribution. On Linux using XDG, for instance, the home location of `~/.config/gotop/gotop.conf` is the second location. The last location is a system-wide global location, such as `/etc/gotop/gotop.conf`. The `-h` help command will print out all of the locations, in order. Command-line options override values in any config files, and only the first config file found is loaded. +- [Layouts](docs/layouts.md) +- [Configuration](docs/configuration.md) +- [Color schemes](docs/colorschemes.md) +- [Device filtering](docs/devices.md) +- [Extensions](docs/extensions.md) -A configuration file can be created using the `--write-config` command-line argument. This will try to place the config file in the home config directory (the second location), but if it's unable to do so it'll write a file to the current directory. - -Config file changes can be made by combining command-line arguments with `--write-config`. For example, to persist the `solarized` theme, call: - -``` -gotop -c solarized --write-config -``` - -### Colorschemes - -gotop ships with a few colorschemes which can be set with the `-c` flag followed by the name of one. You can find all the colorschemes in the [colorschemes folder](./colorschemes). - -To make a custom colorscheme, check out the [template](./colorschemes/template.go) for instructions and then use [default.json](./colorschemes/default.json) as a starter. Then put the file at `~/.config/gotop/<name>.json` and load it with `gotop -c <name>`. Colorschemes PR's are welcome! - -To list all built-in color schemes, call: - -``` -gotop --list colorschemes -``` - -### Layouts - -gotop can parse and render layouts from a specification file. The format is -intentionally simple. The amount of nesting levels is limited. Some examples -are in the `layouts` directory; you can try each of these with, e.g., -`gotop --layout-file layouts/procs`. If you stick your layouts in -`$XDG_CONFIG_HOME/gotop`, you can reference them on the command line with the -`-l` argument, e.g. `gotop -l procs`. - -The syntax for each widget in a row is: -``` -(rowspan:)?widget(/weight)? -``` -and these are separated by spaces. - -1. Each line is a row -2. Empty lines are skipped -3. Spaces are compressed (so you can do limited visual formatting) -4. Legal widget names are: cpu, disk, mem, temp, batt, net, procs -5. Widget names are not case sensitive -4. The simplest row is a single widget, by name, e.g. `cpu` -5. **Weights** - 1. Widgets with no weights have a weight of 1. - 2. If multiple widgets are put on a row with no weights, they will all have - the same width. - 3. Weights are integers - 4. A widget will have a width proportional to its weight divided by the - total weight count of the row. E.g., - - ``` - cpu net - disk/2 mem/4 - ``` - - The first row will have two widgets: the CPU and network widgets; each - will be 50% of the total width wide. The second row will have two - widgets: disk and memory; the first will be 2/6 ~= 33% wide, and the - second will be 5/7 ~= 67% wide (or, memory will be twice as wide as disk). -9. If prefixed by a number and colon, the widget will span that number of - rows downward. E.g. - - ``` - mem 2:cpu - net - ``` - - Here, memory and network will be in the same row as CPU, one over the other, - and each half as high as CPU; it'll look like this: - - ``` - +------+------+ - | Mem | | - +------+ CPU | - | Net | | - +------+------+ - ``` - -10. Negative, 0, or non-integer weights will be recorded as "1". Same for row - spans. -11. Unrecognized widget names will cause the application to abort. -12. In rows with multi-row spanning widgets **and** weights, weights in - lower rows are ignored. Put the weight on the widgets in that row, not - in later (spanned) rows. -13. Widgets are filled in top down, left-to-right order. -14. The larges row span in a row defines the top-level row span; all smaller - row spans constitude sub-rows in the row. For example, `cpu mem/3 net/5` - means that net/5 will be 5 rows tall overall, and mem will compose 3 of - them. If following rows do not have enough widgets to fill the gaps, - spacers will be used. - -Yes, you're clever enough to break the layout algorithm, but if you try to -build massive edifices, you're in for disappointment. - -To list all built-in color schemes, call: - -``` -gotop --list layouts -``` - -### Device filtering - -Some devices have quite a number of data points; on OSX, for instance, there are dozens of temperature readings. These can be filtered through a configuration file. There is no command-line argument for this filter. - -The list will grow, but for now the only device that supports filtering is the temperature widget. The configuration entry is called `temperature`, and it contains an exact-match list of comma-separated values with no spaces. To see the list of valid values, run gotop with the `--list devices` command. Gotop will print out the type of device and the legal values. For example, on Linux: - -``` -$ gotop --list devices -Temperatures: - acpitz - nvme_composite - nvme_sensor1 - nvme_sensor2 - pch_cannonlake - coretemp_packageid0 - coretemp_core0 - coretemp_core1 - coretemp_core2 - coretemp_core3 - ath10k_hwmon -``` -You might then add the following line to the config file. First, find where gotop looks for config files: -``` -$ gotop -h | tail -n 6 -Colorschemes & layouts that are not built-in are searched for (in order) in: -/home/USER/workspace/gotop.d/gotop, /home/USER/.config/gotop, /etc/xdg/gotop -The first path in this list is always the cwd. The config file -'gotop.config' can also reside in one of these directories. - -Log files are stored in /home/ser/.cache/gotop/errors.log -``` -So you might use `/home/YOU/.config/gotop.conf`, and add (or modify) this line: -``` -temperatures=acpitz,coretemp_core0,ath10k_hwmon -``` -This will cause the temp widget to show only four of the eleven temps. - -### CLI Options - -Run `gotop -h` to see the list of all command line options. ## More screen shots diff --git a/docs/colorschemes.md b/docs/colorschemes.md new file mode 100644 index 0000000..430a372 --- /dev/null +++ b/docs/colorschemes.md @@ -0,0 +1,12 @@ +# Colorschemes + +gotop ships with a few colorschemes which can be set with the `-c` flag followed by the name of one. You can find all the colorschemes in the [colorschemes folder](./colorschemes). + +To make a custom colorscheme, check out the [template](./colorschemes/template.go) for instructions and then use [default.json](./colorschemes/default.json) as a starter. Then put the file at `~/.config/gotop/<name>.json` and load it with `gotop -c <name>`. Colorschemes PR's are welcome! + +To list all built-in color schemes, call: + +``` +gotop --list colorschemes +``` + diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..f452106 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,12 @@ +# Config file + +Most command-line settings can be persisted into a configuration file. The config file is named `gotop.conf` and can be located in several places. The first place gotop will look is in the current directory; after this, the locations depend on the OS and distribution. On Linux using XDG, for instance, the home location of `~/.config/gotop/gotop.conf` is the second location. The last location is a system-wide global location, such as `/etc/gotop/gotop.conf`. The `-h` help command will print out all of the locations, in order. Command-line options override values in any config files, and only the first config file found is loaded. + +A configuration file can be created using the `--write-config` command-line argument. This will try to place the config file in the home config directory (the second location), but if it's unable to do so it'll write a file to the current directory. + +Config file changes can be made by combining command-line arguments with `--write-config`. For example, to persist the `solarized` theme, call: + +``` +gotop -c solarized --write-config +``` + diff --git a/docs/devices.md b/docs/devices.md new file mode 100644 index 0000000..4f9e34c --- /dev/null +++ b/docs/devices.md @@ -0,0 +1,37 @@ +# Device filtering + +Some devices have quite a number of data points; on OSX, for instance, there are dozens of temperature readings. These can be filtered through a configuration file. There is no command-line argument for this filter. + +The list will grow, but for now the only device that supports filtering is the temperature widget. The configuration entry is called `temperature`, and it contains an exact-match list of comma-separated values with no spaces. To see the list of valid values, run gotop with the `--list devices` command. Gotop will print out the type of device and the legal values. For example, on Linux: + +``` +$ gotop --list devices +Temperatures: + acpitz + nvme_composite + nvme_sensor1 + nvme_sensor2 + pch_cannonlake + coretemp_packageid0 + coretemp_core0 + coretemp_core1 + coretemp_core2 + coretemp_core3 + ath10k_hwmon +``` +You might then add the following line to the config file. First, find where gotop looks for config files: +``` +➜ gotop --list paths +Loadable colorschemes & layouts, and the config file, are searched for, in order: +/home/ser/workspace/gotop.d/gotop +/home/ser/.config/gotop +/etc/xdg/gotop + +The log file is in /home/ser/.cache/gotop/errors.log +``` +So you might use `${HOME}/.config/gotop/gotop.conf`, and add (or modify) this line: +``` +temperatures=acpitz,coretemp_core0,ath10k_hwmon +``` +This will cause the temp widget to show only four of the eleven temps. + diff --git a/docs/layouts.md b/docs/layouts.md new file mode 100644 index 0000000..c2f4a8b --- /dev/null +++ b/docs/layouts.md @@ -0,0 +1,79 @@ +# Layouts + +gotop can parse and render layouts from a specification file. The format is +intentionally simple. The amount of nesting levels is limited. Some examples +are in the `layouts` directory; you can try each of these with, e.g., +`gotop --layout-file layouts/procs`. If you stick your layouts in +`$XDG_CONFIG_HOME/gotop`, you can reference them on the command line with the +`-l` argument, e.g. `gotop -l procs`. + +The syntax for each widget in a row is: +``` +(rowspan:)?widget(/weight)? +``` +and these are separated by spaces. + +1. Each line is a row +2. Empty lines are skipped +3. Spaces are compressed (so you can do limited visual formatting) +4. Legal widget names are: cpu, disk, mem, temp, batt, net, procs +5. Widget names are not case sensitive +4. The simplest row is a single widget, by name, e.g. `cpu` +5. **Weights** + 1. Widgets with no weights have a weight of 1. + 2. If multiple widgets are put on a row with no weights, they will all have + the same width. + 3. Weights are integers + 4. A widget will have a width proportional to its weight divided by the + total weight count of the row. E.g., + + ``` + cpu net + disk/2 mem/4 + ``` + + The first row will have two widgets: the CPU and network widgets; each + will be 50% of the total width wide. The second row will have two + widgets: disk and memory; the first will be 2/6 ~= 33% wide, and the + second will be 5/7 ~= 67% wide (or, memory will be twice as wide as disk). +9. If prefixed by a number and colon, the widget will span that number of + rows downward. E.g. + + ``` + mem 2:cpu + net + ``` + + Here, memory and network will be in the same row as CPU, one over the other, + and each half as high as CPU; it'll look like this: + + ``` + +------+------+ + | Mem | | + +------+ CPU | + | Net | | + +------+------+ + ``` + +10. Negative, 0, or non-integer weights will be recorded as "1". Same for row + spans. +11. Unrecognized widget names will cause the application to abort. +12. In rows with multi-row spanning widgets **and** weights, weights in + lower rows are ignored. Put the weight on the widgets in that row, not + in later (spanned) rows. +13. Widgets are filled in top down, left-to-right order. +14. The larges row span in a row defines the top-level row span; all smaller + row spans constitude sub-rows in the row. For example, `cpu mem/3 net/5` + means that net/5 will be 5 rows tall overall, and mem will compose 3 of + them. If following rows do not have enough widgets to fill the gaps, + spacers will be used. + +Yes, you're clever enough to break the layout algorithm, but if you try to +build massive edifices, you're in for disappointment. + +To list all built-in color schemes, call: + +``` +gotop --list layouts +``` + From 5274d20897ac441d1948ec74667c0ea9d308c2d4 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 2 Jun 2020 10:30:03 -0500 Subject: [PATCH 40/46] Prep for v4.0.0 release --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5ae31c..01fb540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. -## [4.0.0] PENDING +## [4.0.0] 2020-06-07 (PENDING) **Command line options have changed.** @@ -42,7 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Command line help text is cleaned up. - Version bump of gopsutil - Prometheus client replaced by [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics). This eliminated 6 indirect package dependencies and saved 3.5MB (25%) of the compiled binary size. -- Relicensed to MIT-3 +- Relicensed to MIT-3 (see [#36](https://github.com/xxxserxxx/gotop/issues/36)) ### Removed From dbaab87e718ad31e1a6b430e255e83eb5b3952a4 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 3 Jun 2020 08:34:31 -0500 Subject: [PATCH 41/46] Add peers section to README --- README.md | 25 +++++++++++++++++++++++++ cmd/gotop/main.go | 1 + docs/bashtop.md | 7 +++++++ 3 files changed, 33 insertions(+) create mode 100644 docs/bashtop.md diff --git a/README.md b/README.md index 44a9891..ac97f32 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,31 @@ For more information on other topics, see: **ca. 2020-01-25** The original author of gotop started a new tool in Rust, called [ytop](https://github.com/cjbassi/ytop), and deprecated his Go version. This repository is a fork of original gotop project with a new maintainer to keep the project alive and growing. An objective of the fork is to maintain a small, focused core while providing a path to extend functionality for less universal use cases; examples of this is sensor support for NVidia graphics cards, and for aggregating data from remote gotop instances. +## Alternatives + +I obviously think gotop is the Bee's Knees, but there are many alternatives. Many of these have been around for years. All of them are terminal-based tools. + +- Grandpa [top](http://sourceforge.net/projects/unixtop/). Written 36 years ago, C, installed by default on almost every Unix decendant. +- [htop](https://hisham.hm/htop/). A prettier top. Similar functionality. 16 years old! +- [atop](https://www.atoptool.nl/). Detailed process-focused inspection with a table-like view. Been around for 9 long years. +- [iftop](http://www.ex-parrot.com/~pdw/iftop/), a top for network connections. More than just data transfer, iftop will show what interfaces are connecting to what IP addresses. Requires root access to run. +- [iotop](http://guichaz.free.fr/iotop/), top for disk access. Tells you *which* processes are writing to and from disk space, and how much. Also requires root access to run. +- [nmon](http://nmon.sourceforge.net) a dashboard style top; widgets can be dynamically enabled and disabled, pure ASCII rendering, so it doesn't rely on fancy character sets to draw bars. +- [bashtop](https://github.com/aristocratos/bashtop), in pure bash! Beautiful and space efficient, and [deserves special comment](docs/bashtop.md). If you use anything other than gotop, I'd recommend bashtop. +- [ytop](https://github.com/cjbassi/ytop), a rewrite of gotop (ca. 3.0) in Rust. Same great UI, different programming language. +- [slabtop](https://gitlab.com/procps-ng/procps), part of procps-ng, looks like top but provides kernel slab cache information! Requires root. +- [systemd-cgtop](https://www.github.com/systemd/systemd), comes with systemd (odds are your system uses systemd, so this is already installed), provides a resource use view of control groups -- basically, which services are using what resources. Does *not* require root to run. +- [virt-top](https://libvirt.org/) top for virtualized containers (VMs, like QEMU). +- [ctop](https://bcicen.github.io/ctop/) top for containers (LXC, like docker) + + +### A comment on clones + +In a chat room I heard someone refer to gotop as "another one of those fancy language rewrites people do." I'm not the original author of gotop, so it's easy to not take offense, but I'm going on record as saying that I think these are valuable and useful. They increase software diversity at very little cost, and are a sort of evolutionary mechanism: as people do rewrites, some are worse, but some are better, and users benefit. As importantly, most developers are really only fluent in a couple of programming languages. We all have *familiarity* with a dozen, and may even have extensive experience with a half-dozen, but if you don't constantly use a language, you start to forget the extended library APIs, your development environment isn't tuned, you're rusty with using the tool sets, and you may have forgotten a lot of the language peculiarities and gotchas. The barrier to entry for contributing to a software project -- to just finding and fixing a bug -- in a language you're not intimate with can be very high. It gets much worse if the project owner is a stickler for quality and style. So the original gotop author's decision to rewrite his project in Rust is a great thing. He probably made fewer design mistakes in ytop (we always do, on the second rewrite), and Rust developers -- who may have hesitated learning or brushing up on Go to submit an improvement -- have another project to which they can contribute. + +Diversity is good. Don't knock free stuff. + + ## Stargazers over time [](https://starcharts.herokuapp.com/xxxserxxx/gotop) diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 040c8b2..07847f5 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -433,6 +433,7 @@ func run() int { ui.Render(bar) } + // TODO https://godoc.org/github.com/VictoriaMetrics/metrics#Set if conf.ExportPort != "" { go func() { http.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) { diff --git a/docs/bashtop.md b/docs/bashtop.md new file mode 100644 index 0000000..2a63f3f --- /dev/null +++ b/docs/bashtop.md @@ -0,0 +1,7 @@ +# A comment about bashtop + +Among tops, bashtop deserves extra recognition. It's one of the most impressive pieces of work I've encountered, on a couple of levels. For one, it is full of interesting, uncommon, and *useful* features. For another, it was accomplished with pure bash. In other words, it does far more with a far less sophisticated tool than it's peers. bashtop has a thoughtful and intelligent design of how information is presented. It has an attractive interface, with features like greyscale coloring in the process list that draw your eye to the heaviest processes. It's a beautiful, pleasant terminal UI, and I haven't yet seen anything as good, even among GUIs with all of the tools at their disposal. + +bashtop is also utterly insane. It is a single, 140KB, 3,508-line bash script. The author claims to be doing a rewrite in Python, but that will never undo the admiration I have for what he accomplished with bash. Respect, Aristocratos. + +If bashtop is so great, then why am I maintaining gotop? Two reasons. First, because I can't contribute to bashtop. I'm not that good with bash - not at the astronomic level Aristocratos is working at -) and I really don't *want* to be that good. I've been there, and bash -- while universal, very useful, and probably my go-to scripting tool -- is hell to maintain at any scale. 3,500 lines of bash is a headache, no matter how you slice it. And second, because it's relatively heavy on the CPU for a tool that's supposed to sit off to the side and be glanced at occasionally. But it is an inspiration, and I sincerely believe we all -- all of us developers -- can learn something about good UI design from bashtop. From b13fd2833c081d6d187b80d7d43f358e9e7d2009 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Wed, 3 Jun 2020 08:43:58 -0500 Subject: [PATCH 42/46] Spelling. --- docs/bashtop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bashtop.md b/docs/bashtop.md index 2a63f3f..d985874 100644 --- a/docs/bashtop.md +++ b/docs/bashtop.md @@ -4,4 +4,4 @@ Among tops, bashtop deserves extra recognition. It's one of the most impressive bashtop is also utterly insane. It is a single, 140KB, 3,508-line bash script. The author claims to be doing a rewrite in Python, but that will never undo the admiration I have for what he accomplished with bash. Respect, Aristocratos. -If bashtop is so great, then why am I maintaining gotop? Two reasons. First, because I can't contribute to bashtop. I'm not that good with bash - not at the astronomic level Aristocratos is working at -) and I really don't *want* to be that good. I've been there, and bash -- while universal, very useful, and probably my go-to scripting tool -- is hell to maintain at any scale. 3,500 lines of bash is a headache, no matter how you slice it. And second, because it's relatively heavy on the CPU for a tool that's supposed to sit off to the side and be glanced at occasionally. But it is an inspiration, and I sincerely believe we all -- all of us developers -- can learn something about good UI design from bashtop. +If bashtop is so great, then why am I maintaining gotop? Two reasons. First, because I can't contribute to bashtop. I'm not that good with bash - not at the astronomic level Aristocratos is working at - and I really don't *want* to be that good. I've been there, and bash -- while universal, very useful, and probably my go-to scripting tool -- is hell to maintain at any scale. 3,500 lines of bash is a headache, no matter how you slice it. And second, because it's relatively heavy on the CPU for a tool that's supposed to sit off to the side and be glanced at occasionally. But it is an inspiration, and I sincerely believe we all -- all of us developers -- can learn something about good UI design from bashtop. From b20f47738953c9f2a1c3e483976104bc3cbfcbba Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 7 Jun 2020 16:40:03 -0500 Subject: [PATCH 43/46] linting & documentation Updated versioning and dates for release. --- CHANGELOG.md | 3 ++- README.md | 6 ++--- cmd/gotop/main.go | 2 +- colorschemes/registry.go | 3 +++ colorschemes/template.go | 54 ++++++++++++++++++++++++++++------------ config_test.go | 29 ++++++--------------- docs/release.svg | 8 ------ docs/releasing.md | 1 - logging/logging.go | 4 +++ logging/logging_test.go | 15 ++++++----- scripts/quality.sh | 8 ++++++ 11 files changed, 74 insertions(+), 59 deletions(-) delete mode 100644 docs/release.svg create mode 100755 scripts/quality.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 01fb540..6143d9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. -## [4.0.0] 2020-06-07 (PENDING) +## [4.0.0] 2020-06-07 **Command line options have changed.** @@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Compile errors on FreeBSD due to golang.org/x/sys API breakages - Key bindings now work in FreeBSD (#95) - Only report battery sensor errors once (reduce noise in the log, #117) +- Fixes a very small memory leak from the spark and histograph widgets (#128) ## [3.5.3] - 2020-05-30 diff --git a/README.md b/README.md index ac97f32..17e2b05 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([   - +<div align="center">Current release: <a href="https://github.com/xxxserxxx/gotop/releases/tag/v4.0.0">v4.0.0</a></div> See the [mini-blog](https://github.com/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates. @@ -135,9 +135,9 @@ I obviously think gotop is the Bee's Knees, but there are many alternatives. Man ### A comment on clones -In a chat room I heard someone refer to gotop as "another one of those fancy language rewrites people do." I'm not the original author of gotop, so it's easy to not take offense, but I'm going on record as saying that I think these are valuable and useful. They increase software diversity at very little cost, and are a sort of evolutionary mechanism: as people do rewrites, some are worse, but some are better, and users benefit. As importantly, most developers are really only fluent in a couple of programming languages. We all have *familiarity* with a dozen, and may even have extensive experience with a half-dozen, but if you don't constantly use a language, you start to forget the extended library APIs, your development environment isn't tuned, you're rusty with using the tool sets, and you may have forgotten a lot of the language peculiarities and gotchas. The barrier to entry for contributing to a software project -- to just finding and fixing a bug -- in a language you're not intimate with can be very high. It gets much worse if the project owner is a stickler for quality and style. So the original gotop author's decision to rewrite his project in Rust is a great thing. He probably made fewer design mistakes in ytop (we always do, on the second rewrite), and Rust developers -- who may have hesitated learning or brushing up on Go to submit an improvement -- have another project to which they can contribute. +In a chat room I heard someone refer to gotop as "another one of those fancy language rewrites people do." I'm not the original author of gotop, so it's easy to not take offense, but I'm going on record as saying that I disagree with that sentiment: I think these rewrites are valuable, useful, and healthy to the community. They increase software diversity at very little [cost to users](https://en.wikipedia.org/wiki/Information_overload), and are a sort of evolutionary mechanism: as people do rewrites, some are worse, but some are better, and users benefit. Rewrites provide options, which fight against [monocultures](https://github.com). As importantly, most developers are really only fluent in a couple of programming languages. We all have *familiarity* with a dozen, and may even have extensive experience with a half-dozen, but if you don't constantly use a language, you tend to forget the extended library APIs, your development environment isn't tuned, you're rusty with using the tool sets, and you may have forgotten a lot of the language peculiarities and gotchas. The barrier to entry for contributing to a software project -- to simply finding and fixing a bug -- in a language you're not intimate with can be very high. It gets much worse if the project owner is a stickler for quality and style. So I believe that gotop's original author's decision to rewrite his project in Rust is a net positive. He probably made fewer design mistakes in ytop (we always do, on the second rewrite), and Rust developers -- who may have hesitated learning or brushing up on Go to submit an improvement -- have another project to which they can contribute. -Diversity is good. Don't knock free stuff. +Diversity is good. Don't knock the free stuff. ## Stargazers over time diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 07847f5..c917fc7 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -478,7 +478,7 @@ func getLayout(conf gotop.Config) (io.Reader, error) { } } -func runTests(conf gotop.Config) int { +func runTests(_ gotop.Config) int { fmt.Printf("PASS") return 0 } diff --git a/colorschemes/registry.go b/colorschemes/registry.go index d120eb8..baa4bda 100644 --- a/colorschemes/registry.go +++ b/colorschemes/registry.go @@ -17,6 +17,9 @@ func init() { } } +// FromName loads a Colorscheme by name; confDir is used to search +// directories for a scheme matching the name. The search order +// is the same as for config files. func FromName(confDir configdir.ConfigDir, c string) (Colorscheme, error) { if cs, ok := registry[c]; ok { return cs, nil diff --git a/colorschemes/template.go b/colorschemes/template.go index af4b792..514a063 100644 --- a/colorschemes/template.go +++ b/colorschemes/template.go @@ -1,46 +1,68 @@ package colorschemes -/* - The standard 256 terminal colors are supported. - - -1 = clear - - You can combine a color with 'Bold', 'Underline', or 'Reverse' by using bitwise OR ('|') and the name of the Color. - For example, to get Bold red Labels, you would do 'Labels: 2 | Bold'. - - Once you've created a colorscheme, add an entry for it in the `handleColorscheme` function in 'main.go'. -*/ - +//revive:disable const ( Bold int = 1 << (iota + 9) Underline Reverse ) +//revive:enable + +/* +Colorscheme defines colors and fonts used by TUI elements. The standard +256 terminal colors are supported. + +For int values, -1 = clear + +Colors may be combined with 'Bold', 'Underline', or 'Reverse' by using +bitwise OR ('|') and the name of the Color. For example, to get bold red +labels, you would use 'Labels: 2 | Bold' +*/ type Colorscheme struct { - Name string + // Name is the key used to look up the colorscheme, e.g. as provided by the user + Name string + // Who created the color scheme Author string + // Foreground color Fg int + // Background color Bg int + // BorderLabel is the color of the widget title label BorderLabel int - BorderLine int + // BorderLine is the color of the widget border + BorderLine int - // should add at least 8 here + // CPULines define the colors used for the CPU activity graph, in + // order, for each core. Should add at least 8 here; they're + // selected in order, with wrapping. CPULines []int + // BattLines define the colors used for the battery history graph. + // Should add at least 2; they're selected in order, with wrapping. BattLines []int + // MemLines define the colors used for the memory histograph. + // Should add at least 2 (physical & swap); they're selected in order, + // with wrapping. MemLines []int + // ProcCursor is used as the color for the color bar in the process widget ProcCursor int + // SparkLine determines the color of the data line in spark graphs Sparkline int + // DiskBar is the color of the disk gauge bars (currently unused, + // as there's no disk gauge widget) DiskBar int - // colors the temperature number a different color if it's over a certain threshold - TempLow int + // TempLow determines the color of the temperature number when it's under + // a certain threshold + TempLow int + // TempHigh determines the color of the temperature number when it's over + // a certain threshold TempHigh int } diff --git a/config_test.go b/config_test.go index 5699444..4afb44d 100644 --- a/config_test.go +++ b/config_test.go @@ -16,35 +16,22 @@ func TestParse(t *testing.T) { f func(c Config, e error) }{ { - i: "logdir", + i: "graphhorizontalscale", f: func(c Config, e error) { - assert.Error(t, e, "invalid config syntax") + assert.Error(t, e, "invalid graphhorizontalscale syntax") }, }, { - i: "logdir=foo=bar", + i: "helpvisible=true=false", f: func(c Config, e error) { assert.NotNil(t, e) }, }, { - i: "foo=bar", - f: func(c Config, e error) { - assert.NotNil(t, e) - }, - }, - { - i: "configdir=abc\nlogdir=bar\nlogfile=errors", + i: "GRAPHHORIZONTALSCALE=1\nhelpVisible=true", f: func(c Config, e error) { assert.Nil(t, e, "unexpected error") - assert.Equal(t, "abc", c.ConfigDir) - }, - }, - { - i: "CONFIGDIR=abc\nloGdir=bar\nlogFILe=errors", - f: func(c Config, e error) { - assert.Nil(t, e, "unexpected error") - assert.Equal(t, "abc", c.ConfigDir) + assert.Equal(t, 1, c.GraphHorizontalScale) }, }, { @@ -60,14 +47,14 @@ func TestParse(t *testing.T) { }, }, { - i: "helpvisible=true\nupdateinterval=30\naveragecpu=true\nPerCPULoad=true\ntempscale=100\nstatusbar=true\nnetinterface=eth0\nlayout=minimal\nmaxlogsize=200", + i: "helpvisible=true\nupdateinterval=30\naveragecpu=true\nPerCPULoad=true\ntempscale=F\nstatusbar=true\nnetinterface=eth0\nlayout=minimal\nmaxlogsize=200", f: func(c Config, e error) { assert.Nil(t, e, "unexpected error") assert.Equal(t, true, c.HelpVisible) assert.Equal(t, time.Duration(30), c.UpdateInterval) assert.Equal(t, true, c.AverageLoad) assert.Equal(t, true, c.PercpuLoad) - assert.Equal(t, widgets.TempScale(100), c.TempScale) + assert.Equal(t, widgets.TempScale(70), c.TempScale) assert.Equal(t, true, c.Statusbar) assert.Equal(t, "eth0", c.NetInterface) assert.Equal(t, "minimal", c.Layout) @@ -77,7 +64,7 @@ func TestParse(t *testing.T) { } for _, tc := range tests { in := strings.NewReader(tc.i) - c := Config{} + c := NewConfig() e := load(in, &c) tc.f(c, e) } diff --git a/docs/release.svg b/docs/release.svg deleted file mode 100644 index 6f3fd31..0000000 --- a/docs/release.svg +++ /dev/null @@ -1,8 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="300" height="30"> - <a href="/xxxserxxx/gotop/releases/tag/v3.5.3"> - <text text-anchor="middle" font-size="14pt" fill="#000000" x="150" y="15"> - Current release: <tspan font-weight="bold">v3.5.3</tspan> - </text> - </a> -</svg> - diff --git a/docs/releasing.md b/docs/releasing.md index b9efc70..d71f1fa 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -2,7 +2,6 @@ 1. Update Version in main.go 2. Update CHANGELOG.md -3. Update docs/release.svg 4. Tag 5. Push everything 6. When the github workflows complete, finish the draft release and publish. diff --git a/logging/logging.go b/logging/logging.go index 7bc1f9e..5195b82 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -15,6 +15,10 @@ const ( LOGFILE = "errors.log" ) +// New creates a new logger in the default cache directory; the returned +// WriteCloser should be closed when the program exits. If an error is +// encountered during file creation, a nil WriteCloser and appropriate +// error are returned. func New(c gotop.Config) (io.WriteCloser, error) { // create the log directory cache := c.ConfigDir.QueryCacheFolder() diff --git a/logging/logging_test.go b/logging/logging_test.go index 1ea7484..902028a 100644 --- a/logging/logging_test.go +++ b/logging/logging_test.go @@ -2,22 +2,21 @@ package logging import ( "io/ioutil" - //"log" "os" - "path/filepath" "testing" + "github.com/shibukawa/configdir" "github.com/stretchr/testify/assert" - "github.com/xxxserxxx/gotop/v4" + gotop "github.com/xxxserxxx/gotop/v4" ) func TestLogging(t *testing.T) { - tdn := "testdir" - path, err := filepath.Abs(tdn) + c := gotop.NewConfig() + c.ConfigDir = configdir.New("", "gotoptest") + c.MaxLogSize = 300 + path := c.ConfigDir.QueryCacheFolder().Path + var err error defer os.RemoveAll(path) - c := gotop.Config{ - MaxLogSize: 300, - } wc, err := New(c) assert.NoError(t, err) if err != nil { diff --git a/scripts/quality.sh b/scripts/quality.sh new file mode 100755 index 0000000..2263993 --- /dev/null +++ b/scripts/quality.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +go test -covermode=count -coverprofile=docs/coverage.out ./... +go tool cover -html=docs/coverage.out -o docs/quality.html + +revive -config .revive.toml ./... > docs/lint.txt + +abcgo -path . -sort -no-test | sed 's%^/home/ser/workspace/gotop.d/gotop/%%' > docs/abcgo.txt From 5590679cb4cc4dcd6ccb4694780eda38326bc4c5 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Sun, 7 Jun 2020 18:12:04 -0500 Subject: [PATCH 44/46] Trying to get the workflow working. --- .github/workflows/release.yml | 18 ------------------ README.md | 2 +- docs/releasing.md | 24 ++++++++++-------------- 3 files changed, 11 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c212991..3b697e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,21 +44,3 @@ jobs: repository: xxxserxxx/gotop-builder event-type: my-release client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}' - - - name: Update current release badge - shell: bash - run: sed -i "s/v[0-9]*\.[0-9]*\.[0-9]*/${{steps.tag_name.outputs.tag}}/g" docs/release.svg - - - name: Commit current release badge - uses: stefanzweifel/git-auto-commit-action@v4.1.0 - with: - branch: 'master' - commit_message: Update release badge to version "${{ steps.tag_name.outputs.tag }}" - - # Optional glob pattern of files which should be added to the commit - file_pattern: docs/release.svg - - # Optional commit user and author settings - commit_user_name: Badge Updater - commit_user_email: ser@ser1.net - commit_author: Badge Updater <ser@ser1.net> diff --git a/README.md b/README.md index 17e2b05..3fd939f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([   -<div align="center">Current release: <a href="https://github.com/xxxserxxx/gotop/releases/tag/v4.0.0">v4.0.0</a></div> +<div id="release" align="center">Current release: <a href="https://github.com/xxxserxxx/gotop/releases/tag/v4.0.0">v4.0.0</a></div> See the [mini-blog](https://github.com/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates. diff --git a/docs/releasing.md b/docs/releasing.md index d71f1fa..7704097 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -2,13 +2,16 @@ 1. Update Version in main.go 2. Update CHANGELOG.md -4. Tag -5. Push everything -6. When the github workflows complete, finish the draft release and publish. -7. Wait for the [AUR](https://github.com/xxxserxxx/gotop-linux] project to finish building. +3. Tag +4. Push everything +5. Wait for the github workflows to complete +6. Download and verify the correct version of one of the binaries +7. Finish the draft release and publish. +8. Check gotop-builder for a successful everything build; if successful, publish. +10. Wait for the [AUR](https://github.com/xxxserxxx/gotop-linux] project to finish building. 1. update arch (gotop-linux) and run `aurpublish aur` and `aurpublish aur-bin` - 2. notify Nix - 3. notify Homebrew +11. Notify Nix +12. Notify Homebrew The AUR project still needs secret credentials to aurpublish to the AUR repository, so the final publish step is still currently manual. @@ -29,11 +32,4 @@ Nix adds new and interesting complexities to the release. 3. `cd /mnt` 8. install & run vgo2nix to update deps.nix 7. `nix-build -A gotop` -8. When it fails, copy the hash and update the - - -For plugin development: -``` -V=$(git show -s --format=%cI HEAD | cut -b -19 | tr -cd '[:digit:]')-$(git rev-parse HEAD | cut -b -12) -go build -ldflags "-X main.Version=$V" -o gotop ./cmd/gotop -``` +8. When it fails, ... From 1181b94bd228f5f081d49f6c7c9a9ee9c26557ed Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 9 Jun 2020 09:03:58 -0500 Subject: [PATCH 45/46] Closes #131, SMC GPL issue on OSX; consequently removes need to CGO in darwin. --- .github/workflows/build.yml | 2 +- .gitignore | 2 + devices/data/smc.tsv | 162 +++++++++++++++++++++++++ devices/smc.go | 235 ++++++++++++++++++++++++++++++++++++ devices/temp.go | 4 + devices/temp_darwin.go | 101 ++++++++++------ devices/temp_darwin_test.go | 45 +++++++ devices/temp_linux.go | 28 +---- devices/temp_nix.go | 30 +++++ docs/releasing.md | 5 +- go.mod | 1 - go.sum | 4 - 12 files changed, 550 insertions(+), 69 deletions(-) create mode 100644 devices/data/smc.tsv create mode 100644 devices/smc.go create mode 100644 devices/temp_darwin_test.go create mode 100644 devices/temp_nix.go diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6de087d..6ed52bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,4 +19,4 @@ jobs: env: SRCPATH: ./cmd/gotop with: - args: darwin/amd64/1 linux/amd64 linux/386 linux/arm64 linux/arm7 linux/arm6 linux/arm5 windows/amd64 windows/386 freebsd/amd64 freebsd/386 + args: darwin/amd64 linux/amd64 linux/386 linux/arm64 linux/arm7 linux/arm6 linux/arm5 windows/amd64 windows/386 freebsd/amd64 freebsd/386 diff --git a/.gitignore b/.gitignore index 50cf697..9588e08 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ dist/ build/gotop_* build.log + +tmp/ diff --git a/devices/data/smc.tsv b/devices/data/smc.tsv new file mode 100644 index 0000000..f6ff37b --- /dev/null +++ b/devices/data/smc.tsv @@ -0,0 +1,162 @@ +"TCXC" "PECI CPU" +"TCXc" "PECI CPU" +"TC0P" "CPU 1 Proximity" +"TC0H" "CPU 1 Heatsink" +"TC0D" "CPU 1 Package" +"TC0E" "CPU 1" +"TC0F" "CPU 1" +"TC1C" "CPU Core 1" +"TC2C" "CPU Core 2" +"TC3C" "CPU Core 3" +"TC4C" "CPU Core 4" +"TC5C" "CPU Core 5" +"TC6C" "CPU Core 6" +"TC7C" "CPU Core 7" +"TC8C" "CPU Core 8" +"TCAH" "CPU 1 Heatsink Alt." +"TCAD" "CPU 1 Package Alt." +"TC1P" "CPU 2 Proximity" +"TC1H" "CPU 2 Heatsink" +"TC1D" "CPU 2 Package" +"TC1E" "CPU 2" +"TC1F" "CPU 2" +"TCBH" "CPU 2 Heatsink Alt." +"TCBD" "CPU 2 Package Alt." +"TCSC" "PECI SA" +"TCSc" "PECI SA" +"TCSA" "PECI SA" +"TCGC" "PECI GPU" +"TCGc" "PECI GPU" +"TG0P" "GPU Proximity" +"TG0D" "GPU Die" +"TG1D" "GPU Die" +"TG0H" "GPU Heatsink" +"TG1H" "GPU Heatsink" +"Ts0S" "Memory Proximity" +"TM0P" "Mem Bank A1" +"TM1P" "Mem Bank A2" +"TM8P" "Mem Bank B1" +"TM9P" "Mem Bank B2" +"TM0S" "Mem Module A1" +"TM1S" "Mem Module A2" +"TM8S" "Mem Module B1" +"TM9S" "Mem Module B2" +"TN0D" "Northbridge Die" +"TN0P" "Northbridge Proximity 1" +"TN1P" "Northbridge Proximity 2" +"TN0C" "MCH Die" +"TN0H" "MCH Heatsink" +"TP0D" "PCH Die" +"TPCD" "PCH Die" +"TP0P" "PCH Proximity" +"TA0P" "Airflow 1" +"TA1P" "Airflow 2" +"Th0H" "Heatpipe 1" +"Th1H" "Heatpipe 2" +"Th2H" "Heatpipe 3" +"Tm0P" "Mainboard Proximity" +"Tp0P" "Powerboard Proximity" +"Ts0P" "Palm Rest" +"Tb0P" "BLC Proximity" +"TL0P" "LCD Proximity" +"TW0P" "Airport Proximity" +"TH0P" "HDD Bay 1" +"TH1P" "HDD Bay 2" +"TH2P" "HDD Bay 3" +"TH3P" "HDD Bay 4" +"TO0P" "Optical Drive" +"TB0T" "Battery TS_MAX" +"TB1T" "Battery 1" +"TB2T" "Battery 2" +"TB3T" "Battery" +"Tp0P" "Power Supply 1" +"Tp0C" "Power Supply 1 Alt." +"Tp1P" "Power Supply 2" +"Tp1C" "Power Supply 2 Alt." +"Tp2P" "Power Supply 3" +"Tp3P" "Power Supply 4" +"Tp4P" "Power Supply 5" +"Tp5P" "Power Supply 6" +"TS0C" "Expansion Slots" +"TA0S" "PCI Slot 1 Pos 1" +"TA1S" "PCI Slot 1 Pos 2" +"TA2S" "PCI Slot 2 Pos 1" +"TA3S" "PCI Slot 2 Pos 2" +"VC0C" "CPU Core 1" +"VC1C" "CPU Core 2" +"VC2C" "CPU Core 3" +"VC3C" "CPU Core 4" +"VC4C" "CPU Core 5" +"VC5C" "CPU Core 6" +"VC6C" "CPU Core 7" +"VC7C" "CPU Core 8" +"VV1R" "CPU VTT" +"VG0C" "GPU Core" +"VM0R" "Memory" +"VN1R" "PCH" +"VN0C" "MCH" +"VD0R" "Mainboard S0 Rail" +"VD5R" "Mainboard S5 Rail" +"VP0R" "12V Rail" +"Vp0C" "12V Vcc" +"VV2S" "Main 3V" +"VR3R" "Main 3.3V" +"VV1S" "Main 5V" +"VH05" "Main 5V" +"VV9S" "Main 12V" +"VD2R" "Main 12V" +"VV7S" "Auxiliary 3V" +"VV3S" "Standby 3V" +"VV8S" "Standby 5V" +"VeES" "PCIe 12V" +"VBAT" "Battery" +"Vb0R" "CMOS Battery" +"IC0C" "CPU Core" +"IC1C" "CPU VccIO" +"IC2C" "CPU VccSA" +"IC0R" "CPU Rail" +"IC5R" "CPU DRAM" +"IC8R" "CPU PLL" +"IC0G" "CPU GFX" +"IC0M" "CPU Memory" +"IG0C" "GPU Rail" +"IM0C" "Memory Controller" +"IM0R" "Memory Rail" +"IN0C" "MCH" +"ID0R" "Mainboard S0 Rail" +"ID5R" "Mainboard S5 Rail" +"IO0R" "Misc. Rail" +"IB0R" "Battery Rail" +"IPBR" "Charger BMON" +"PC0C" "CPU Core 1" +"PC1C" "CPU Core 2" +"PC2C" "CPU Core 3" +"PC3C" "CPU Core 4" +"PC4C" "CPU Core 5" +"PC5C" "CPU Core 6" +"PC6C" "CPU Core 7" +"PC7C" "CPU Core 8" +"PCPC" "CPU Cores" +"PCPG" "CPU GFX" +"PCPD" "CPU DRAM" +"PCTR" "CPU Total" +"PCPL" "CPU Total" +"PC1R" "CPU Rail" +"PC5R" "CPU S0 Rail" +"PGTR" "GPU Total" +"PG0R" "GPU Rail" +"PM0R" "Memory Rail" +"PN0C" "MCH" +"PN1R" "PCH Rail" +"PC0R" "Mainboard S0 Rail" +"PD0R" "Mainboard S0 Rail" +"PD5R" "Mainboard S5 Rail" +"PH02" "Main 3.3V Rail" +"PH05" "Main 5V Rail" +"Pp0R" "12V Rail" +"PD2R" "Main 12V Rail" +"PO0R" "Misc. Rail" +"PBLC" "Battery Rail" +"PB0R" "Battery Rail" +"PDTR" "DC In Total" +"PSTR" "System Total" diff --git a/devices/smc.go b/devices/smc.go new file mode 100644 index 0000000..4701a07 --- /dev/null +++ b/devices/smc.go @@ -0,0 +1,235 @@ +// Code generated by go-bindata. +// sources: +// data/smc.tsv +// DO NOT EDIT! + +package devices + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindataFileInfo) Name() string { + return fi.name +} +func (fi bindataFileInfo) Size() int64 { + return fi.size +} +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} +func (fi bindataFileInfo) IsDir() bool { + return false +} +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _smcTsv = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x95\xc1\x72\xab\x3a\x0f\xc7\xd7\x3d\x4f\xc1\xf0\x00\x1d\x4c\x92\x36\x67\x09\xa6\x05\x66\x42\xa2\x09\x29\x5f\x77\xdf\x10\xca\x6d\x99\x43\x02\x03\xf4\x9e\xe6\xed\xef\x58\xc6\xc6\x36\x64\xe9\x9f\x24\xdb\x92\xfe\xb2\xed\x13\x7d\xa7\xf6\x83\x0d\x2f\x34\xb6\x28\xbc\xd9\xbf\x18\x29\x4c\xe2\x80\xfd\x60\x53\x78\xb3\x88\x05\x5d\xf3\x53\x5d\xaa\xe1\xc6\x0d\x91\x34\x44\x65\x3e\xf4\xd5\xf5\x0f\xe7\xc1\x14\x90\x17\x7f\xf2\xcf\x92\xe3\x17\x81\xf9\xf2\x55\x5b\x12\x3a\x2e\x69\xd3\x95\x23\x73\x35\xe6\x22\x5b\x69\x6c\x85\x6c\xad\xb1\x35\xb2\x8d\xc6\x36\xc8\x9e\x34\xf6\x84\xec\x59\x63\xcf\xc8\xb6\x1a\xdb\x22\xf3\xe6\xc9\x5a\x5e\x3d\x3c\x72\xe3\x2c\xe3\xc9\x46\x44\xf9\x5c\xa3\x7c\x24\x92\x06\xad\x7c\x24\x98\x02\x94\xf2\x11\x51\x3e\x5e\x07\xf2\xaa\x2d\xfd\xf9\x66\xd3\x15\xfc\xd9\x8e\x93\x2d\x95\x0a\x48\x3d\x0e\x0a\x13\x78\x06\x08\x65\x48\x38\x4a\x24\x2c\x0c\x12\xa2\x68\x42\x78\xd3\x73\x0e\x51\x1a\x0c\x07\x15\x66\x15\x12\x13\xa0\xa8\x18\x50\x6b\x12\x92\x25\xda\x3b\xa9\xfd\x60\x27\xe5\xa5\xe9\x6e\xfa\x39\x09\x1e\x9f\x94\x17\xcb\xcf\x59\x21\x50\x4e\x09\xd1\x21\x16\x2e\xd9\x6a\xd0\xe7\x9e\xbf\x75\xc8\x3d\xc5\x69\x56\xd2\x7c\x7c\xd7\xa5\xdc\xd5\xc4\xe3\xbe\x06\x16\x3b\x9b\x18\xbd\xf7\x58\x97\x7d\xd3\x0d\x5f\xe7\xae\xfa\xf8\x2c\x45\x39\xf6\x98\x88\x6a\x90\x79\xf2\x19\xd9\x93\xfb\x0e\xe3\xd6\xac\x5b\x09\x8d\xa6\x2d\xa3\x11\xa8\xb5\x04\xbc\x01\x4c\x6e\x40\x4d\x80\x57\x61\x40\x2b\xb5\x87\xd8\xab\xba\x7f\xea\xe6\x2f\xbf\x93\x47\x54\x84\xb7\xf8\xc2\x43\xd9\x81\x6d\xd5\x8e\xe3\xfd\x45\x34\xc6\xfd\x5c\x8d\xe1\x78\x5f\x78\x33\xf3\xea\x7a\x6e\xf2\xee\x43\x3f\xbe\xe5\xb7\x6a\xfe\x96\xdd\x82\xb5\xe7\xd6\xbc\xbe\x58\xc7\xb2\x1f\x18\x3a\x23\xf2\x77\x54\xf7\xdc\x21\xde\xd1\x40\xc7\xff\x13\xd9\xb5\x4d\x37\xe8\xa6\x08\x4d\x51\x10\x58\x7e\x3e\x36\x23\x22\x2a\xc2\x84\x22\x57\x45\x98\x4f\xb4\x52\x11\xbe\x56\x07\xdc\xeb\xd0\x0e\x55\x91\xd7\x56\xd0\x55\xff\x62\xc9\x7d\xe7\xc4\xee\x9a\x0f\x43\xd9\xdd\xac\x53\xfa\xff\xc4\x7b\x47\x4e\x54\x8e\x47\xfb\xae\x8a\xf0\x68\x7f\xa5\x20\xa3\x56\x56\xfa\xdd\xb6\xf5\x18\xdb\xa2\x44\x74\x2e\x1f\x88\x96\xcc\x82\x5c\xce\x67\x41\xee\x14\xe4\xce\x82\x30\xf5\x76\x35\xe3\x98\x7f\xbb\x9e\x71\x7c\xb1\xdb\xcd\x8c\xe3\xab\x9d\xe2\x8d\x5f\x7e\xda\xfc\xda\x57\xcd\xd5\x4a\xeb\x66\xe8\xb9\x1a\x53\x14\x69\x8c\x88\x3d\xc7\x4d\x2f\x44\xb9\x60\xc1\x4c\x3c\x57\xb3\xb8\x4a\xcc\x6a\xc1\xc2\x62\x32\xea\xcc\xbe\xab\xcc\xf8\xc2\xb8\x9f\x3b\xfb\xae\x32\xe3\x0b\x5b\x23\x5b\xcf\xbe\xab\xcc\xf8\xc2\x9e\x90\x3d\xcd\xbe\xab\xcc\xf8\xc2\xd8\x77\x95\x65\xe4\x38\xb2\xec\x74\x62\x20\xc4\x0b\x87\xa3\x13\x23\x89\x73\x94\xaf\x27\x5b\xef\x31\x04\x68\x84\x0b\xf1\x6a\xb0\x45\xc0\x3d\xe5\x00\xa6\x8e\x75\xcc\xab\x1a\x4d\x1b\xc3\xb4\x91\x26\xc0\x28\xe2\x66\x92\x70\x9d\x31\x92\x15\x05\xde\x12\x2b\xcf\xa2\xad\x55\xc6\xc0\x71\x75\x94\xe0\x91\xa3\x8c\x48\x9f\x0d\x82\xc8\xd9\xe8\x20\xfb\x2d\x3d\x88\x8b\x24\x70\x8f\x06\xc9\x9e\x99\x8f\xf7\xfd\x53\xd5\x55\xde\xdd\xc6\xe3\x32\xec\x6f\x3a\xe4\xd7\x8f\xb3\x64\x5b\x95\xf1\x13\xca\x97\x51\x07\xa5\xd8\xcf\xf7\xf4\xd9\xca\xce\x98\x2d\x4d\x0e\xa9\x35\xd1\x58\x97\x09\x12\x29\x92\xac\x28\xe2\x03\x22\x57\x41\xf8\xc5\xc6\xd4\x11\xed\x1b\x6b\x17\xd3\x8d\x20\xc1\xd1\x4b\x90\x6c\x05\x81\xdd\x8e\x07\x85\x23\x08\x5f\xdf\x39\x48\x46\x20\xbb\x1c\x4f\x3a\x10\x3b\x27\xbc\xd5\xfc\x17\xa5\xcd\x75\xe8\x9a\xba\x2e\x3b\x6e\x9a\x24\x22\xfd\x55\x69\xc4\xf7\xa5\x11\xdf\x97\x46\x7c\xe0\x51\x55\x5f\x3c\x4a\xe6\x23\x13\x0f\x98\xa0\xe0\x63\x92\x5f\x79\xf7\x59\x76\x96\x9f\x1c\xf6\xf6\x2f\x1b\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x28\xa8\xac\xe7\x48\x6f\x0e\x50\x08\xf4\x86\x02\x3d\x89\x86\x9e\x9a\x21\xaf\xb9\xd3\x6e\x86\x88\x21\x0d\x98\xa4\x31\x55\x1f\x42\xdc\x2c\x54\x23\x43\xe7\xa8\xb7\x1e\x96\xfa\x0b\x6a\x7f\x41\x3e\x0a\xd3\x69\x77\x3b\x0e\xf7\xc5\x00\xf7\xc5\x00\x91\xe3\xaa\x33\xaf\x70\x65\xce\x25\x6d\xcd\x57\x05\xf4\x61\x97\x78\x41\x63\xe0\xef\xe8\x5c\x63\xb0\xa8\x3c\x08\xb0\x80\x01\xb5\xe2\xeb\x54\xc2\x14\x61\x7a\xeb\x87\xf2\x22\xe8\x7f\x01\x00\x00\xff\xff\x1d\x32\xff\xb6\x46\x0d\x00\x00") + +func smcTsvBytes() ([]byte, error) { + return bindataRead( + _smcTsv, + "smc.tsv", + ) +} + +func smcTsv() (*asset, error) { + bytes, err := smcTsvBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "smc.tsv", size: 3398, mode: os.FileMode(420), modTime: time.Unix(1591711965, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "smc.tsv": smcTsv, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} +var _bintree = &bintree{nil, map[string]*bintree{ + "smc.tsv": &bintree{smcTsv, map[string]*bintree{}}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} + diff --git a/devices/temp.go b/devices/temp.go index 010e7ad..247075a 100644 --- a/devices/temp.go +++ b/devices/temp.go @@ -1,9 +1,13 @@ package devices +//go:generate go-bindata -pkg devices -prefix data -o smc.go data + import ( "log" ) +// TODO add thermal history graph. Update when something changes? + var tempUpdates []func(map[string]int) map[string]error func RegisterTemp(update func(map[string]int) map[string]error) { diff --git a/devices/temp_darwin.go b/devices/temp_darwin.go index 1111943..ecdc9f1 100644 --- a/devices/temp_darwin.go +++ b/devices/temp_darwin.go @@ -2,45 +2,74 @@ package devices -// TODO gopsutil team reports this is not needed; try getting rid of this dep -import smc "github.com/xxxserxxx/iSMC" - -func init() { - RegisterTemp(update) - RegisterDeviceList(Temperatures, devs, defs) - ts = make(map[string]float32) -} - -var ts map[string]float32 - -func update(temps map[string]int) map[string]error { - err := smc.GetTemp(ts) - if err != nil { - return map[string]error{"temps": err} - } - for k, v := range ts { - if _, ok := temps[k]; ok { - temps[k] = int(v + 0.5) - } - } - return nil -} +import ( + "bytes" + "encoding/csv" + "github.com/shirou/gopsutil/host" + "io" +) +// All possible thermometers func devs() []string { - rv := make([]string, len(smc.AppleTemp)) - for i, v := range smc.AppleTemp { - rv[i] = v.Desc + // Did we already populate the sensorMap? + if sensorMap != nil { + return defs() } - return rv -} - -func defs() []string { - // CPU 0 CPU 1 GPU Memory Disk - ids := map[string]bool{"TC0P": true, "TC1P": true, "TG0P": true, "Ts0S": true, "TH0P": true} - rv := make([]string, 0, len(ids)) - for _, v := range smc.AppleTemp { - if ids[v.Key] { - rv = append(rv, v.Desc) + // Otherwise, get the sensor data from the system & filter it + ids := loadIDs() + sensors, err := host.SensorsTemperatures() + if err != nil { + // FIXME log an error here + return []string{} + } + rv := make([]string, 0, len(sensors)) + sensorMap = make(map[string]string) + for _, sensor := range sensors { + // 0-value sensors are not implemented + if sensor.Temperature == 0 { + continue + } + if label, ok := ids[sensor.SensorKey]; ok { + sensorMap[sensor.SensorKey] = label + rv = append(rv, label) + } + } + return rv +} + +// Only the ones filtered +func defs() []string { + rv := make([]string, 0, len(sensorMap)) + for _, val := range sensorMap { + rv = append(rv, val) + } + return rv +} + +// loadIDs parses the embedded smc.tsv data that maps Darwin SMC +// sensor IDs to their human-readable labels into an array and returns the +// array. The array keys are the 4-letter sensor keys; the values are the +// human labels. +func loadIDs() map[string]string { + rv := make(map[string]string) + data, err := Asset("smc.tsv") + parser := csv.NewReader(bytes.NewReader(data)) + parser.Comma = '\t' + var line []string + for { + if line, err = parser.Read(); err == io.EOF { + break + } + if err != nil { + // FIXME log an error here + break + } + // The line is malformed if len(line) != 2, but because the asset is static + // it makes no sense to report the error to downstream users. This must be + // tested at/around compile time. + // FIXME assert all lines in smc.tsv have 2 columns during unit tests + if len(line) == 2 { + rv[line[0]] = line[1] } } return rv diff --git a/devices/temp_darwin_test.go b/devices/temp_darwin_test.go new file mode 100644 index 0000000..6222b57 --- /dev/null +++ b/devices/temp_darwin_test.go @@ -0,0 +1,45 @@ +// +build darwin + +package devices + +import ( + "testing" +) + +func Test_loadIDs(t *testing.T) { + tests := []struct { + key string + want string + }{ + {"TCAD", "CPU 1 Package Alt."}, + {"TC1P", "CPU 2 Proximity"}, + {"TC1H", "CPU 2 Heatsink"}, + {"TC1D", "CPU 2 Package"}, + {"TC1E", "CPU 2"}, + {"TC1F", "CPU 2"}, + {"TCBH", "CPU 2 Heatsink Alt."}, + {"TCBD", "CPU 2 Package Alt."}, + {"TG0P", "GPU Proximity"}, + {"TG1D", "GPU Die"}, + {"TG0H", "GPU Heatsink"}, + {"TG1H", "GPU Heatsink"}, + {"Ts0S", "Memory Proximity"}, + {"TM0P", "Mem Bank A1"}, + {"TM9P", "Mem Bank B2"}, + {"TCXC", "PECI CPU"}, + {"PSTR", "System Total"}, + } + ids := loadIDs() + L := 161 + if len(ids) != L { + t.Errorf("len(loadIDs) = %d, want %d", len(ids), L) + } + for _, tt := range tests { + t.Run("contents", func(t *testing.T) { + got := ids[tt.key] + if got != tt.want { + t.Errorf("ids[%s] = %v, want %v", tt.key, got, tt.want) + } + }) + } +} diff --git a/devices/temp_linux.go b/devices/temp_linux.go index 09e7d3c..6967232 100644 --- a/devices/temp_linux.go +++ b/devices/temp_linux.go @@ -5,37 +5,15 @@ package devices import ( "strings" - psHost "github.com/shirou/gopsutil/host" + "github.com/shirou/gopsutil/host" ) -func init() { - devs() // Populate the sensorMap - RegisterTemp(getTemps) - RegisterDeviceList(Temperatures, devs, defs) -} - -func getTemps(temps map[string]int) map[string]error { - sensors, err := psHost.SensorsTemperatures() - if err != nil { - return map[string]error{"psHost": err} - } - for _, sensor := range sensors { - label := sensorMap[sensor.SensorKey] - if _, ok := temps[label]; ok { - temps[label] = int(sensor.Temperature) - } - } - return nil -} - -// Optimization to avoid string manipulation every update -var sensorMap map[string]string - +// All possible thermometers func devs() []string { if sensorMap == nil { sensorMap = make(map[string]string) } - sensors, err := psHost.SensorsTemperatures() + sensors, err := host.SensorsTemperatures() if err != nil { return []string{} } diff --git a/devices/temp_nix.go b/devices/temp_nix.go new file mode 100644 index 0000000..0015e1d --- /dev/null +++ b/devices/temp_nix.go @@ -0,0 +1,30 @@ +// +build linux darwin + +package devices + +import ( + "github.com/shirou/gopsutil/host" +) + +func init() { + devs() // Populate the sensorMap + RegisterTemp(getTemps) + RegisterDeviceList(Temperatures, devs, defs) +} + +func getTemps(temps map[string]int) map[string]error { + sensors, err := host.SensorsTemperatures() + if err != nil { + return map[string]error{"gopsutil host": err} + } + for _, sensor := range sensors { + label := sensorMap[sensor.SensorKey] + if _, ok := temps[label]; ok { + temps[label] = int(sensor.Temperature) + } + } + return nil +} + +// Optimization to avoid string manipulation every update +var sensorMap map[string]string diff --git a/docs/releasing.md b/docs/releasing.md index 7704097..8ad4498 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -9,9 +9,10 @@ 7. Finish the draft release and publish. 8. Check gotop-builder for a successful everything build; if successful, publish. 10. Wait for the [AUR](https://github.com/xxxserxxx/gotop-linux] project to finish building. - 1. update arch (gotop-linux) and run `aurpublish aur` and `aurpublish aur-bin` + 1. update arch (gotop-linux) and run `aurpublish gotop` and `aurpublish gotop-bin` + 2. Test install `gotop` and `gotop-bin` with running & version check 11. Notify Nix -12. Notify Homebrew +12. ~~Notify Homebrew~~ Automated now. The AUR project still needs secret credentials to aurpublish to the AUR repository, so the final publish step is still currently manual. diff --git a/go.mod b/go.mod index 75a8b2c..70e6a96 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 github.com/shirou/gopsutil v2.20.3+incompatible github.com/stretchr/testify v1.4.0 - github.com/xxxserxxx/iSMC v1.0.1 github.com/xxxserxxx/opflag v1.0.5 golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect diff --git a/go.sum b/go.sum index 27148da..fd648f6 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,6 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 h1:lh3PyZvY+B9nFliSGTn5uFuqQQJGuNrD0MLCokv09ag= github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= -github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a h1:P0QSyHOubLI2e6hccBBEjVX0vPWXoXui5QCAVNWdJSk= -github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a/go.mod h1:u8Q8dpnMAam0MElxP2KjEROzXMk9G8X168RTpAZ9tPc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w= @@ -43,8 +41,6 @@ github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2Obdk github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ= github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg= github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto= -github.com/xxxserxxx/iSMC v1.0.1 h1:M9Gkwnnkl+evvnugoB5yRYrbUP+cRIVOPM+xrHZc3Hs= -github.com/xxxserxxx/iSMC v1.0.1/go.mod h1:TGgNjU7BF2DZSuxiTft+BdzxzcujFJYqFfMCzcTl/aY= github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90= github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= From e2879e970c09d01422d6bc259d2601572679f745 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" <ser@ser1.net> Date: Tue, 9 Jun 2020 10:42:52 -0500 Subject: [PATCH 46/46] Updated the changelog and readme for v4.0.1 --- CHANGELOG.md | 9 +++++++++ README.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6143d9b..4747930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. +## [4.0.1] 2020-06-08 + +**Darwin-only release** + +### Changed + +- The change to remove GPL dependencies did not remove *all* dependencies. This corrects that (#131) + + ## [4.0.0] 2020-06-07 **Command line options have changed.** diff --git a/README.md b/README.md index 3fd939f..b8be2df 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([   -<div id="release" align="center">Current release: <a href="https://github.com/xxxserxxx/gotop/releases/tag/v4.0.0">v4.0.0</a></div> +<div id="release" align="center">Current release: <a href="https://github.com/xxxserxxx/gotop/releases/tag/v4.0.1">v4.0.1</a></div> See the [mini-blog](https://github.com/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates.