Skip to content

A basic Go package that gets informations of system status on only Gnu/Linux Os

Notifications You must be signed in to change notification settings

muratsplat/highLevelStat

Repository files navigation

highLevelStat

Build Status

A basic Go Package that gets system the percent of cpu(s) usage on only Gnu/Linux Os.

I'm new in Go Language and this library is my first library in go. I want to improve my go skils by writing go code more and more.

The package is high level to access the information of system status.

Probably I will not support the package at long term support.

It likes this:

package main

import (
	"fmt"
	stat "github.com/muratsplat/highLevelStat"
)

func main() {

	// setting time range value in the package..
	// This value only effects the range time duration of cpu status samples..	
	statSetTimeOfRangeForCpuStat(500 * time.Millisecond) // 0.5 second

	go func() {

		for {
			var test stat.SystemStatus
			// getting information the structer of memory

			memInfo := stat.GetMemInfo()

			fmt.Printf("Cpu(s): %.f%% UsedMem: %.f%%\n", test.GetCpuUsage().CpuUsage, memInfo.GetUsedMemForHuman())
		}
	}()

	// To block main method by working fmt.Scanln() method

	var in string
	fmt.Scanln(&in)

}

output:

Cpu(s): 11% UsedMem: 32%
Cpu(s): 13% UsedMem: 32%
Cpu(s): 12% UsedMem: 32%
Cpu(s): 13% UsedMem: 32%
Cpu(s): 10% UsedMem: 32%
Cpu(s): 9% UsedMem: 32%
Cpu(s): 13% UsedMem: 32%
Cpu(s): 11% UsedMem: 32%
Cpu(s): 8% UsedMem: 32%
Cpu(s): 12% UsedMem: 32%

Installing

to download the package by using "get" parameter via go such as..

$ go get github.com/muratsplat/highLevelStat

Include in your source code:

import "github.com/muratsplat/highLevelStat"

About

A basic Go package that gets informations of system status on only Gnu/Linux Os

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages