Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Commit

Permalink
Remove debugging; better-ified README
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxserxxx committed Feb 3, 2021
1 parent 68eea8c commit 66b6ce1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@

Provides NVidia GPU data to gotop

## Compiling

The easiest way is to not try to compile from this repository, but use the [gotop-builder](github.com/xxxserxxx/gotop-builder):

```
mkdir gotop-nvidia
cd gotop-nvidia
go run github.com/xxxserxxx/gotop-builder -r v4.1.0 github.com/xxxserxxx/gotop-nvidia
go build -o gotop-nvidia ./gotop.go
```

Check the documentation for gotop-builder, and the source -- it's not a very long file. What this program does is downloads the `gotop.go` command file, modifies it to import the nvidia code (this project), and creates an appropropriate `go.mod` to import the main gotop project. You end up with `gotop.go` and a `go.mod` files in the directory, which you can then build into an executable with the nvidia plugin.

If you need or want to compile locally (such as, for development), there are a couple of variations. It ain't trivial.

### If you want to use the gotop code from github directly

From this repository, run:

```
mkdir tmp
cd tmp
go run github.com/xxxserxxx/gotop-builder -r v4.1.0 github.com/xxxserxxx/gotop-nvidia
echo 'replace github.com/xxxserxxx/gotop-nvidia => ../' >> go.mod
go build -o gotop .
```

This builds with the checked-out nvidia code.

### If you want to use the gotop code from a local path

then do everything in the previous example, but before compiling do an additional replacement:

```
echo 'replace github.com/xxxserxxx/gotop/v4 => ../../gotop' >> go.mod
```

## Dependencies

- [nvidia-smi](https://wiki.archlinux.org/index.php/NVIDIA/Tips_and_tricks#nvidia-smi)
Expand Down
4 changes: 2 additions & 2 deletions nvidia.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ func update() {
"--format=csv,noheader,nounits").Output()
if err != nil {
errors["nvidia"] = err
bs = []byte("GeForce GTX 1080 Ti, 0, 31, 9, 11175, 206")
//return
//bs = []byte("GeForce GTX 1080 Ti, 0, 31, 9, 11175, 206")
return
}
csvReader := csv.NewReader(bytes.NewReader(bs))
csvReader.TrimLeadingSpace = true
Expand Down

0 comments on commit 66b6ce1

Please sign in to comment.