Skip to content

Commit

Permalink
gitignore and go.sum
Browse files Browse the repository at this point in the history
  • Loading branch information
bioe007 committed Mar 14, 2024
1 parent f055583 commit f063f79
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 11 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# ignore binary
synopsis
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ The goal is to create an overview of a system. Instead of running:
Show the _critical_ parts from each of those in legible fashion with a
single command.

Some might say this breaks the one-tool philosophy but i disagree, this
isn't intended to

Ideally this would be doable from a single command that doesn't need to
be pre-installed so either a script or self-contained binary.
be pre-installed so either a script or self-contained binary.

Because any scripted language (e.g. python, lua) doing this would
require either a *ton* of boilerplate or a long list of dependencies
Expand All @@ -29,9 +26,10 @@ tool is only a simple `scp synopsys` away


## Critical Parts
These are the parameters I'd like to show
These are the parameters I'd like to show

- Uptime: express as hours:min:sec x
- load average - what if r/cpu and b/disks ?
- CPU: cores, overall % useage, then % sys, usr, guest, ...
- _wonders_ any way to make mpstat type of info here?
- by default, show the overall cpu utilization
Expand All @@ -49,7 +47,7 @@ These are the parameters I'd like to show
- connections - active, passive, trans/retrans stats
- top 'few' processes consuming CPU | memory

## Display
## Display

initially this will just output some rolling format. will have to think
about something like a tui to properly place things for readability
Expand All @@ -63,4 +61,5 @@ Is there a faster way to fetch all this data than reading a text file each time?

- [/proc](https://www.man7.org/linux/man-pages/man5/proc.5.html)
- [/proc/loadavg](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/reference_guide/s2-proc-loadavg)

- [/sys/block](https://www.kernel.org/doc/html/latest/block/stat.html)
- [filesystems](https://www.kernel.org/doc/html/latest/filesystems/index.html)
18 changes: 14 additions & 4 deletions disk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
)

type DiskStat struct {
type diskStat struct {
major int
minor int
devname string
Expand Down Expand Up @@ -40,6 +40,12 @@ type DiskStat struct {
ms_spent_flushing int // This is the total number of milliseconds spent by all flush requests.
}

type Stat struct {
old diskStat
new diskStat
values statValues
}

type dsfields int

const (
Expand All @@ -65,6 +71,10 @@ const (
DSFMS_SPENT_FLUSHING
)

type Disk struct {
sick int
}

func diskparse(s string) (*DiskStat, error) {
ds := new(DiskStat)

Expand Down Expand Up @@ -92,9 +102,9 @@ func diskparse(s string) (*DiskStat, error) {
return ds, nil
}

// Create an array od DiskStat and return it
func DiskStats() ([]*DiskStat, error) {
var ds []*DiskStat
// Create an array od diskStat and return it
func DiskStats() ([]*diskStat, error) {
var ds []*diskStat

f, err := os.Open("/proc/diskstats")
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4=
github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0=
github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4=
github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

0 comments on commit f063f79

Please sign in to comment.