Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikhita/systemstat
GitHub mirror of https://bitbucket.org/bertimus9/systemstat.
https://github.com/nikhita/systemstat
Last synced: 3 days ago
JSON representation
GitHub mirror of https://bitbucket.org/bertimus9/systemstat.
- Host: GitHub
- URL: https://github.com/nikhita/systemstat
- Owner: nikhita
- License: mit
- Created: 2019-06-28T01:46:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-28T01:48:45.000Z (over 5 years ago)
- Last Synced: 2024-10-12T12:37:52.570Z (about 1 month ago)
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# systemstat
[Documentation online](http://godoc.org/bitbucket.org/bertimus9/systemstat)
**systemstat** is a package written in Go generated automatically by `gobi`.
**systemstat** allows you to add system statistics to your go program; it
currently polls the linux kernel for CPU usage, free/used memory and swap
sizes, and uptime for your go process, as well as the system you're running it
on, and the system load. It can be used to make a crippled version of top that
monitors the current go process and ignores other processes and the number of
users with ttys. See the examples directory for go-top.go, which is my attempt
at a top clone. Bear in mind that the intention of **systemstat** is to allow
your process to monitor itself and it's environment, not to replace top.## Install (with GOPATH set on your machine)
----------* Step 1: Get the `systemstat` package
```
go get bitbucket.org/bertimus9/systemstat
```* Step 2 (Optional): Run tests
```
$ go test -v bitbucket.org/bertimus9/systemstat
```* Step 3 (Optional): Run example
```bash
$ cd to the first directory in your $GOPATH
$ cd src/bitbucket.org/bertimus9/systemstat
$ go run examples/go-top.go
```##Usage
----------
```
package mainimport (
"bitbucket.org/bertimus9/systemstat"
"fmt"
)var sample systemstat.MemSample
// This example shows how easy it is to get memory information
func main() {
sample = systemstat.GetMemSample()
fmt.Println("Total available RAM in kb:", sample.MemTotal, "k total")
fmt.Println("Used RAM in kb:", sample.MemUsed, "k used")
fmt.Println("Free RAM in kb:", sample.MemFree, "k free")
fmt.Printf("The output is similar to, but somewhat different than:\n\ttop -n1 | grep Mem:\n")
}
```##License
----------Copyright (c) 2013 Phillip Bond
Licensed under the MIT License
see file LICENSE