Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitbucket.org/bertimus9/systemstat

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitbucket.org/bertimus9/systemstat

  • v0.5.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

systemstat

Documentation online

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
$ cd to the first directory in your $GOPATH
$ cd src/bitbucket.org/bertimus9/systemstat
$ go run examples/go-top.go

##Usage

package main

import (
	"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

FAQs

Package last updated on 08 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc