mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Added bitbucket.org/bertimus9/systemstat to godeps
This commit is contained in:
		
							
								
								
									
										4
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							@@ -5,6 +5,10 @@
 | 
			
		||||
		"./..."
 | 
			
		||||
	],
 | 
			
		||||
	"Deps": [
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "bitbucket.org/bertimus9/systemstat",
 | 
			
		||||
			"Rev": "1468fd0db20598383c9393cccaa547de6ad99e5e"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "bitbucket.org/ww/goautoneg",
 | 
			
		||||
			"Comment": "null-5",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
 | 
			
		||||
*.o
 | 
			
		||||
*.a
 | 
			
		||||
*.so
 | 
			
		||||
 | 
			
		||||
# Folders
 | 
			
		||||
_obj
 | 
			
		||||
_test
 | 
			
		||||
 | 
			
		||||
# Architecture specific extensions/prefixes
 | 
			
		||||
*.[568vq]
 | 
			
		||||
[568vq].out
 | 
			
		||||
 | 
			
		||||
*.cgo1.go
 | 
			
		||||
*.cgo2.c
 | 
			
		||||
_cgo_defun.c
 | 
			
		||||
_cgo_gotypes.go
 | 
			
		||||
_cgo_export.*
 | 
			
		||||
 | 
			
		||||
_testmain.go
 | 
			
		||||
 | 
			
		||||
*.exe
 | 
			
		||||
 | 
			
		||||
*.swp
 | 
			
		||||
*.swo
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/AUTHORS
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/AUTHORS
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
[Phillip](http://bitbucket.org/bertimus9) <bertimus9@gmail.com>
 | 
			
		||||
							
								
								
									
										20
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2013 Phillip Bond
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
 | 
			
		||||
this software and associated documentation files (the "Software"), to deal in
 | 
			
		||||
the Software without restriction, including without limitation the rights to
 | 
			
		||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 | 
			
		||||
the Software, and to permit persons to whom the Software is furnished to do so,
 | 
			
		||||
subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 | 
			
		||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 | 
			
		||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 | 
			
		||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 | 
			
		||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
							
								
								
									
										8
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
test: 
 | 
			
		||||
	gofmt -s -w .
 | 
			
		||||
	go test ./...
 | 
			
		||||
	go get bitbucket.org/bertimus9/systemstat
 | 
			
		||||
 | 
			
		||||
coverage: 
 | 
			
		||||
	go get github.com/axw/gocov/gocov
 | 
			
		||||
	gocov test . | gocov report
 | 
			
		||||
							
								
								
									
										69
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
# 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 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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/VERSION
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/VERSION
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
0.0.1
 | 
			
		||||
							
								
								
									
										21
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/example_simple_test.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/example_simple_test.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
// Copyright (c) 2013 Phillip Bond
 | 
			
		||||
// Licensed under the MIT License
 | 
			
		||||
// see file LICENSE
 | 
			
		||||
 | 
			
		||||
package systemstat_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bitbucket.org/bertimus9/systemstat"
 | 
			
		||||
	"fmt"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var sample systemstat.MemSample
 | 
			
		||||
 | 
			
		||||
// This example shows how easy it is to get memory information
 | 
			
		||||
func Example_simple() {
 | 
			
		||||
	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")
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										211
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/examples/go-top.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/examples/go-top.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,211 @@
 | 
			
		||||
// Copyright (c) 2013 Phillip Bond
 | 
			
		||||
// Licensed under the MIT License
 | 
			
		||||
// see file LICENSE
 | 
			
		||||
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
// go-top
 | 
			
		||||
//
 | 
			
		||||
// A sample program that emulates the way gnu top gets most of its
 | 
			
		||||
// information.  It does not get information about other processes, just the
 | 
			
		||||
// calling process.
 | 
			
		||||
//
 | 
			
		||||
// To demonstrate how the output changes, you can invoke with the
 | 
			
		||||
// -coresToPeg=N option. For example:
 | 
			
		||||
//
 | 
			
		||||
//   go run go-top.go -coresToPeg=2
 | 
			
		||||
//
 | 
			
		||||
// will run two concurrent infinte loops and max out up to two cores (assuming
 | 
			
		||||
// you have more than one core). Note that the loops are not tuned to always
 | 
			
		||||
// hit 100% on all machines, but they get close. Also note that each core you
 | 
			
		||||
// want to max out will add up to 100% CPU usage to this process, but you will
 | 
			
		||||
// get less than 100% per core if there are other processes using the CPU, or
 | 
			
		||||
// if the kernel is suffering high load averages, etc.
 | 
			
		||||
//
 | 
			
		||||
// %CCPU measures cumulative CPU usage. It is useful when you have a daemon
 | 
			
		||||
// that only runs periodically, but does intense calculations. You can use
 | 
			
		||||
// long sample times, on the order of minutes, but still get an accurate
 | 
			
		||||
// measure of how much CPU time has been used over the life of the process,
 | 
			
		||||
// even if your samples occur when the CPU is temporarily idle.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bitbucket.org/bertimus9/systemstat"
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"math"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var coresToPegPtr *int64
 | 
			
		||||
 | 
			
		||||
type stats struct {
 | 
			
		||||
	startTime time.Time
 | 
			
		||||
 | 
			
		||||
	// stats this process
 | 
			
		||||
	ProcUptime        float64 //seconds
 | 
			
		||||
	ProcMemUsedPct    float64
 | 
			
		||||
	ProcCPUAvg        systemstat.ProcCPUAverage
 | 
			
		||||
	LastProcCPUSample systemstat.ProcCPUSample `json:"-"`
 | 
			
		||||
	CurProcCPUSample  systemstat.ProcCPUSample `json:"-"`
 | 
			
		||||
 | 
			
		||||
	// stats for whole system
 | 
			
		||||
	LastCPUSample systemstat.CPUSample `json:"-"`
 | 
			
		||||
	CurCPUSample  systemstat.CPUSample `json:"-"`
 | 
			
		||||
	SysCPUAvg     systemstat.CPUAverage
 | 
			
		||||
	SysMemK       systemstat.MemSample
 | 
			
		||||
	LoadAverage   systemstat.LoadAvgSample
 | 
			
		||||
	SysUptime     systemstat.UptimeSample
 | 
			
		||||
 | 
			
		||||
	// bookkeeping
 | 
			
		||||
	procCPUSampled bool
 | 
			
		||||
	sysCPUSampled  bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewStats() *stats {
 | 
			
		||||
	s := stats{}
 | 
			
		||||
	s.startTime = time.Now()
 | 
			
		||||
	return &s
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *stats) PrintStats() {
 | 
			
		||||
	up, err := time.ParseDuration(fmt.Sprintf("%fs", s.SysUptime.Uptime))
 | 
			
		||||
	upstring := "SysUptime Error"
 | 
			
		||||
	if err == nil {
 | 
			
		||||
		updays := up.Hours() / 24
 | 
			
		||||
		switch {
 | 
			
		||||
		case updays >= 365:
 | 
			
		||||
			upstring = fmt.Sprintf("%.0f years", updays/365)
 | 
			
		||||
		case updays >= 1:
 | 
			
		||||
			upstring = fmt.Sprintf("%.0f days", updays)
 | 
			
		||||
		default: // less than a day
 | 
			
		||||
			upstring = up.String()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fmt.Println("*********************************************************")
 | 
			
		||||
	fmt.Printf("go-top - %s  up %s,\t\tload average: %.2f, %.2f, %.2f\n",
 | 
			
		||||
		s.LoadAverage.Time.Format("15:04:05"), upstring, s.LoadAverage.One, s.LoadAverage.Five, s.LoadAverage.Fifteen)
 | 
			
		||||
 | 
			
		||||
	fmt.Printf("Cpu(s): %.1f%%us, %.1f%%sy, %.1f%%ni, %.1f%%id, %.1f%%wa, %.1f%%hi, %.1f%%si, %.1f%%st %.1f%%gu\n",
 | 
			
		||||
		s.SysCPUAvg.UserPct, s.SysCPUAvg.SystemPct, s.SysCPUAvg.NicePct, s.SysCPUAvg.IdlePct,
 | 
			
		||||
		s.SysCPUAvg.IowaitPct, s.SysCPUAvg.IrqPct, s.SysCPUAvg.SoftIrqPct, s.SysCPUAvg.StealPct,
 | 
			
		||||
		s.SysCPUAvg.GuestPct)
 | 
			
		||||
 | 
			
		||||
	fmt.Printf("Mem:  %9dk total, %9dk used, %9dk free, %9dk buffers\n", s.SysMemK.MemTotal,
 | 
			
		||||
		s.SysMemK.MemUsed, s.SysMemK.MemFree, s.SysMemK.Buffers)
 | 
			
		||||
	fmt.Printf("Swap: %9dk total, %9dk used, %9dk free, %9dk cached\n", s.SysMemK.SwapTotal,
 | 
			
		||||
		s.SysMemK.SwapUsed, s.SysMemK.SwapFree, s.SysMemK.Cached)
 | 
			
		||||
 | 
			
		||||
	fmt.Println("************************************************************")
 | 
			
		||||
	if s.ProcCPUAvg.PossiblePct > 0 {
 | 
			
		||||
		cpuHelpText := "[see -help flag to change %cpu]"
 | 
			
		||||
		if *coresToPegPtr > 0 {
 | 
			
		||||
			cpuHelpText = ""
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Printf("ProcessName\tRES(k)\t%%CPU\t%%CCPU\t%%MEM\n")
 | 
			
		||||
		fmt.Printf("this-process\t%d\t%3.1f\t%2.1f\t%3.1f\t%s\n",
 | 
			
		||||
			s.CurProcCPUSample.ProcMemUsedK,
 | 
			
		||||
			s.ProcCPUAvg.TotalPct,
 | 
			
		||||
			100*s.CurProcCPUSample.Total/s.ProcUptime/float64(1),
 | 
			
		||||
			100*float64(s.CurProcCPUSample.ProcMemUsedK)/float64(s.SysMemK.MemTotal),
 | 
			
		||||
			cpuHelpText)
 | 
			
		||||
		fmt.Println("%CCPU is cumulative CPU usage over this process' life.")
 | 
			
		||||
		fmt.Printf("Max this-process CPU possible: %3.f%%\n", s.ProcCPUAvg.PossiblePct)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *stats) GatherStats(percent bool) {
 | 
			
		||||
	s.SysUptime = systemstat.GetUptime()
 | 
			
		||||
	s.ProcUptime = time.Since(s.startTime).Seconds()
 | 
			
		||||
 | 
			
		||||
	s.SysMemK = systemstat.GetMemSample()
 | 
			
		||||
	s.LoadAverage = systemstat.GetLoadAvgSample()
 | 
			
		||||
 | 
			
		||||
	s.LastCPUSample = s.CurCPUSample
 | 
			
		||||
	s.CurCPUSample = systemstat.GetCPUSample()
 | 
			
		||||
 | 
			
		||||
	if s.sysCPUSampled { // we need 2 samples to get an average
 | 
			
		||||
		s.SysCPUAvg = systemstat.GetCPUAverage(s.LastCPUSample, s.CurCPUSample)
 | 
			
		||||
	}
 | 
			
		||||
	// we have at least one sample, subsequent rounds will give us an average
 | 
			
		||||
	s.sysCPUSampled = true
 | 
			
		||||
 | 
			
		||||
	s.ProcMemUsedPct = 100 * float64(s.CurProcCPUSample.ProcMemUsedK) / float64(s.SysMemK.MemTotal)
 | 
			
		||||
 | 
			
		||||
	s.LastProcCPUSample = s.CurProcCPUSample
 | 
			
		||||
	s.CurProcCPUSample = systemstat.GetProcCPUSample()
 | 
			
		||||
	if s.procCPUSampled {
 | 
			
		||||
		s.ProcCPUAvg = systemstat.GetProcCPUAverage(s.LastProcCPUSample, s.CurProcCPUSample, s.ProcUptime)
 | 
			
		||||
	}
 | 
			
		||||
	s.procCPUSampled = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	// get command line flags
 | 
			
		||||
	coresToPegPtr = flag.Int64("coresToPeg", 0, "how many CPU cores would you like to artificially peg to 100% usage")
 | 
			
		||||
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
 | 
			
		||||
	// this will help us poll the OS to get system statistics
 | 
			
		||||
	stats := NewStats()
 | 
			
		||||
 | 
			
		||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
			
		||||
 | 
			
		||||
	// WARNING: each call to burnCPU() will peg one core
 | 
			
		||||
	// of your machine to 100%
 | 
			
		||||
	// If you have code you'd like to drop in to this example,
 | 
			
		||||
	// just run "go yourCode()" instead of "go burnCPU()
 | 
			
		||||
	for i := *coresToPegPtr; i > 0; i-- {
 | 
			
		||||
		fmt.Println("pegging one more CPU core.")
 | 
			
		||||
		go burnCPU()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for {
 | 
			
		||||
		stats.GatherStats(true)
 | 
			
		||||
		stats.PrintStats()
 | 
			
		||||
 | 
			
		||||
		// This next line lets out see the jsonified object
 | 
			
		||||
		// produced by systemstat
 | 
			
		||||
		//	printJson(stats, false)
 | 
			
		||||
		time.Sleep(3 * time.Second)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func printJson(s *stats, indent bool) {
 | 
			
		||||
	b, err := json.Marshal(s)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		fmt.Println("error:", err)
 | 
			
		||||
	}
 | 
			
		||||
	dst := new(bytes.Buffer)
 | 
			
		||||
	if indent {
 | 
			
		||||
		json.Indent(dst, b, "", "   ")
 | 
			
		||||
	} else {
 | 
			
		||||
		dst.Write(b)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Println(dst.String())
 | 
			
		||||
	time.Sleep(time.Second * 3)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func burnCPU() {
 | 
			
		||||
	time.Sleep(4 * time.Second)
 | 
			
		||||
	for {
 | 
			
		||||
		b := 1.0
 | 
			
		||||
		c := 1.0
 | 
			
		||||
		d := 1.0
 | 
			
		||||
		for j := 1; j < 1000; j++ {
 | 
			
		||||
			b *= float64(j)
 | 
			
		||||
			for k := 1; k < 700000; k++ {
 | 
			
		||||
 | 
			
		||||
				c *= float64(k)
 | 
			
		||||
				d = (28 + b*b/3.23412) / math.Sqrt(c*c)
 | 
			
		||||
				c *= d
 | 
			
		||||
			}
 | 
			
		||||
			time.Sleep(500 * time.Nanosecond)
 | 
			
		||||
			runtime.Gosched()
 | 
			
		||||
		}
 | 
			
		||||
		time.Sleep(10 * time.Second)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										141
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,141 @@
 | 
			
		||||
// Copyright (c) 2013 Phillip Bond
 | 
			
		||||
// Licensed under the MIT License
 | 
			
		||||
// see file LICENSE
 | 
			
		||||
 | 
			
		||||
package systemstat
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// CPUSample is an object that represents the breakdown of time spent by the
 | 
			
		||||
// CPU in various types of tasks. Two CPUSamples are required to find the
 | 
			
		||||
// average usage over time, represented by the CPUAverage object. The CPUSample
 | 
			
		||||
// is taken from the line "cpu" from /proc/stat in the Linux kernel.
 | 
			
		||||
//
 | 
			
		||||
// Summarized from the proc(5) man page:
 | 
			
		||||
// /proc/stat :
 | 
			
		||||
//        kernel/system  statistics.   Varies  with  architecture.
 | 
			
		||||
type CPUSample struct {
 | 
			
		||||
	User    uint64    // time spent in user mode
 | 
			
		||||
	Nice    uint64    // time spent in user mode with low priority (nice)
 | 
			
		||||
	System  uint64    // time spent in system mode
 | 
			
		||||
	Idle    uint64    // time spent in the idle task
 | 
			
		||||
	Iowait  uint64    // time spent waiting for I/O to complete (since Linux 2.5.41)
 | 
			
		||||
	Irq     uint64    // time spent servicing  interrupts  (since  2.6.0-test4)
 | 
			
		||||
	SoftIrq uint64    // time spent servicing softirqs (since 2.6.0-test4)
 | 
			
		||||
	Steal   uint64    // time spent in other OSes when running in a virtualized environment
 | 
			
		||||
	Guest   uint64    // time spent running a virtual CPU for guest operating systems under the control of the Linux kernel.
 | 
			
		||||
	Name    string    // name of the line in /proc/stat; cpu, cpu1, etc
 | 
			
		||||
	Time    time.Time // when the sample was taken
 | 
			
		||||
	Total   uint64    // total of all time fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ProcCPUSample struct {
 | 
			
		||||
	User         float64   // time spent in user mode
 | 
			
		||||
	System       float64   // time spent in system mode
 | 
			
		||||
	Time         time.Time // when the sample was taken
 | 
			
		||||
	Total        float64   // total of all time fields
 | 
			
		||||
	ProcMemUsedK int64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ProcCPUAverage struct {
 | 
			
		||||
	UserPct            float64   // time spent in user mode
 | 
			
		||||
	SystemPct          float64   // time spent in system mode
 | 
			
		||||
	TotalPct           float64   // total of all time fields
 | 
			
		||||
	PossiblePct        float64   // total of all time fields
 | 
			
		||||
	CumulativeTotalPct float64   // total of all time throughout process life
 | 
			
		||||
	Time               time.Time // when the sample was taken
 | 
			
		||||
	Seconds            float64   // how many seconds between the two samples
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SimpleCPUAverage is an object that represents the average cpu usage over a
 | 
			
		||||
// time period. It is calculated by taking the difference between two
 | 
			
		||||
// CPUSamples (whose units are clock ticks), dividing by the number of elapsed
 | 
			
		||||
// ticks between the samples, and converting to a percent. It is a simplified version of the CPUAverage in that it only accounts for time in the Idle task and all other time (Busy).
 | 
			
		||||
type SimpleCPUAverage struct {
 | 
			
		||||
	BusyPct float64 // percent of time spent by CPU performing all non-idle tasks
 | 
			
		||||
	IdlePct float64 // percent of time spent by CPU in the idle task
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CPUAverage is an object that represents the average cpu usage over a
 | 
			
		||||
// time period. It is calculated by taking the difference between two
 | 
			
		||||
// CPUSamples (whose units are clock ticks), dividing by the number of elapsed
 | 
			
		||||
// ticks between the samples, and converting to a percent.
 | 
			
		||||
type CPUAverage struct {
 | 
			
		||||
	UserPct    float64
 | 
			
		||||
	NicePct    float64
 | 
			
		||||
	SystemPct  float64
 | 
			
		||||
	IdlePct    float64
 | 
			
		||||
	IowaitPct  float64
 | 
			
		||||
	IrqPct     float64
 | 
			
		||||
	SoftIrqPct float64
 | 
			
		||||
	StealPct   float64
 | 
			
		||||
	GuestPct   float64
 | 
			
		||||
	Time       time.Time
 | 
			
		||||
	Seconds    float64 // how many seconds between the two samples
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type MemSample struct {
 | 
			
		||||
	Buffers   uint64
 | 
			
		||||
	Cached    uint64
 | 
			
		||||
	MemTotal  uint64
 | 
			
		||||
	MemUsed   uint64
 | 
			
		||||
	MemFree   uint64
 | 
			
		||||
	SwapTotal uint64
 | 
			
		||||
	SwapUsed  uint64
 | 
			
		||||
	SwapFree  uint64
 | 
			
		||||
	Time      time.Time
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type LoadAvgSample struct {
 | 
			
		||||
	One     float64
 | 
			
		||||
	Five    float64
 | 
			
		||||
	Fifteen float64
 | 
			
		||||
	Time    time.Time
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type UptimeSample struct {
 | 
			
		||||
	Uptime float64
 | 
			
		||||
	Time   time.Time
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetCPUAverage returns the average cpu usage between two CPUSamples.
 | 
			
		||||
func GetCPUAverage(first CPUSample, second CPUSample) CPUAverage {
 | 
			
		||||
	return getCPUAverage(first, second)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetSimpleCPUAverage returns an aggregated average cpu usage between two CPUSamples.
 | 
			
		||||
func GetSimpleCPUAverage(first CPUSample, second CPUSample) SimpleCPUAverage {
 | 
			
		||||
	return getSimpleCPUAverage(first, second)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetProcCPUAverage returns the average cpu usage of this running process
 | 
			
		||||
func GetProcCPUAverage(first ProcCPUSample, second ProcCPUSample, procUptime float64) (avg ProcCPUAverage) {
 | 
			
		||||
	return getProcCPUAverage(first, second, procUptime)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetCPUSample takes a snapshot of kernel statistics from the /proc/stat file.
 | 
			
		||||
func GetCPUSample() (samp CPUSample) {
 | 
			
		||||
	return getCPUSample("/proc/stat")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetProcCPUSample takes a snapshot of kernel statistics from the /proc/stat file.
 | 
			
		||||
func GetProcCPUSample() (samp ProcCPUSample) {
 | 
			
		||||
	return getProcCPUSample()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetUptime takes a snapshot of load info from the /proc/loadavg file.
 | 
			
		||||
func GetUptime() (samp UptimeSample) {
 | 
			
		||||
	return getUptime("/proc/uptime")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetLoadAvgSample takes a snapshot of load info from the /proc/loadavg file.
 | 
			
		||||
func GetLoadAvgSample() (samp LoadAvgSample) {
 | 
			
		||||
	return getLoadAvgSample("/proc/loadavg")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMemSample takes a snapshot of memory info from the /proc/meminfo file.
 | 
			
		||||
func GetMemSample() (samp MemSample) {
 | 
			
		||||
	return getMemSample("/proc/meminfo")
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										244
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_linux.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										244
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_linux.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,244 @@
 | 
			
		||||
// Copyright (c) 2013 Phillip Bond
 | 
			
		||||
// Licensed under the MIT License
 | 
			
		||||
// see file LICENSE
 | 
			
		||||
 | 
			
		||||
// +build linux
 | 
			
		||||
 | 
			
		||||
package systemstat
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"log"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func getUptime(procfile string) (uptime UptimeSample) {
 | 
			
		||||
	// read in whole uptime file with cpu usage information ;"/proc/uptime"
 | 
			
		||||
	contents, err := ioutil.ReadFile(procfile)
 | 
			
		||||
	uptime.Time = time.Now()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	reader := bufio.NewReader(bytes.NewBuffer(contents))
 | 
			
		||||
	line, _, err := reader.ReadLine()
 | 
			
		||||
	fields := strings.Fields(string(line))
 | 
			
		||||
 | 
			
		||||
	val, numerr := strconv.ParseFloat(fields[0], 64)
 | 
			
		||||
	if numerr != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	uptime.Uptime = val
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getLoadAvgSample(procfile string) (samp LoadAvgSample) {
 | 
			
		||||
	// read in whole loadavg file with cpu usage information ;"/proc/loadavg"
 | 
			
		||||
	contents, err := ioutil.ReadFile(procfile)
 | 
			
		||||
	samp.Time = time.Now()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	reader := bufio.NewReader(bytes.NewBuffer(contents))
 | 
			
		||||
	line, _, err := reader.ReadLine()
 | 
			
		||||
	fields := strings.Fields(string(line))
 | 
			
		||||
	for i := 0; i < 3; i++ {
 | 
			
		||||
		val, numerr := strconv.ParseFloat(fields[i], 64)
 | 
			
		||||
		if numerr != nil {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		switch i {
 | 
			
		||||
		case 0:
 | 
			
		||||
			samp.One = val
 | 
			
		||||
		case 1:
 | 
			
		||||
			samp.Five = val
 | 
			
		||||
		case 2:
 | 
			
		||||
			samp.Fifteen = val
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getMemSample(procfile string) (samp MemSample) {
 | 
			
		||||
	want := map[string]bool{
 | 
			
		||||
		"Buffers:":   true,
 | 
			
		||||
		"Cached:":    true,
 | 
			
		||||
		"MemTotal:":  true,
 | 
			
		||||
		"MemFree:":   true,
 | 
			
		||||
		"MemUsed:":   true,
 | 
			
		||||
		"SwapTotal:": true,
 | 
			
		||||
		"SwapFree:":  true,
 | 
			
		||||
		"SwapUsed:":  true}
 | 
			
		||||
 | 
			
		||||
	// read in whole meminfo file with cpu usage information ;"/proc/meminfo"
 | 
			
		||||
	contents, err := ioutil.ReadFile(procfile)
 | 
			
		||||
	samp.Time = time.Now()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	reader := bufio.NewReader(bytes.NewBuffer(contents))
 | 
			
		||||
	for {
 | 
			
		||||
		line, _, err := reader.ReadLine()
 | 
			
		||||
		if err == io.EOF {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		fields := strings.Fields(string(line))
 | 
			
		||||
		fieldName := fields[0]
 | 
			
		||||
 | 
			
		||||
		_, ok := want[fieldName]
 | 
			
		||||
		if ok && len(fields) == 3 {
 | 
			
		||||
			val, numerr := strconv.ParseUint(fields[1], 10, 64)
 | 
			
		||||
			if numerr != nil {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			switch fieldName {
 | 
			
		||||
			case "Buffers:":
 | 
			
		||||
				samp.Buffers = val
 | 
			
		||||
			case "Cached:":
 | 
			
		||||
				samp.Cached = val
 | 
			
		||||
			case "MemTotal:":
 | 
			
		||||
				samp.MemTotal = val
 | 
			
		||||
			case "MemFree:":
 | 
			
		||||
				samp.MemFree = val
 | 
			
		||||
			case "SwapTotal:":
 | 
			
		||||
				samp.SwapTotal = val
 | 
			
		||||
			case "SwapFree:":
 | 
			
		||||
				samp.SwapFree = val
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	samp.MemUsed = samp.MemTotal - samp.MemFree
 | 
			
		||||
	samp.SwapUsed = samp.SwapTotal - samp.SwapFree
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getProcCPUSample() (s ProcCPUSample) {
 | 
			
		||||
	var processInfo syscall.Rusage
 | 
			
		||||
	syscall.Getrusage(syscall.RUSAGE_SELF, &processInfo)
 | 
			
		||||
 | 
			
		||||
	s.Time = time.Now()
 | 
			
		||||
	s.ProcMemUsedK = int64(processInfo.Maxrss)
 | 
			
		||||
	s.User = float64(processInfo.Utime.Usec)/1000000 + float64(processInfo.Utime.Sec)
 | 
			
		||||
	s.System = float64(processInfo.Stime.Usec)/1000000 + float64(processInfo.Stime.Sec)
 | 
			
		||||
	s.Total = s.User + s.System
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getCPUSample(procfile string) (samp CPUSample) {
 | 
			
		||||
	// read in whole proc file with cpu usage information ; "/proc/stat"
 | 
			
		||||
	contents, err := ioutil.ReadFile(procfile)
 | 
			
		||||
	samp.Time = time.Now()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	reader := bufio.NewReader(bytes.NewBuffer(contents))
 | 
			
		||||
	for {
 | 
			
		||||
		line, _, err := reader.ReadLine()
 | 
			
		||||
		if err == io.EOF {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		fields := strings.Fields(string(line))
 | 
			
		||||
 | 
			
		||||
		if len(fields) > 0 {
 | 
			
		||||
			fieldName := fields[0]
 | 
			
		||||
			if fieldName == "cpu" {
 | 
			
		||||
				parseCPUFields(fields, &samp)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getSimpleCPUAverage(first CPUSample, second CPUSample) (avg SimpleCPUAverage) {
 | 
			
		||||
	//walltimediff := second.Time.Sub(first.Time)
 | 
			
		||||
	//dT := float64(first.Total - second.Total)
 | 
			
		||||
 | 
			
		||||
	dI := float64(second.Idle - first.Idle)
 | 
			
		||||
	dTot := float64(second.Total - first.Total)
 | 
			
		||||
	avg.IdlePct = dI / dTot * 100
 | 
			
		||||
	avg.BusyPct = (dTot - dI) * 100 / dTot
 | 
			
		||||
	//log.Printf("cpu idle ticks %f, total ticks %f, idle pct %f, busy pct %f\n", dI, dTot, avg.IdlePct, avg.BusyPct)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func subtractAndConvertTicks(first uint64, second uint64) float64 {
 | 
			
		||||
	return float64(first - second)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getCPUAverage(first CPUSample, second CPUSample) (avg CPUAverage) {
 | 
			
		||||
	dTot := float64(second.Total - first.Total)
 | 
			
		||||
	invQuotient := 100.00 / dTot
 | 
			
		||||
 | 
			
		||||
	avg.UserPct = subtractAndConvertTicks(second.User, first.User) * invQuotient
 | 
			
		||||
	avg.NicePct = subtractAndConvertTicks(second.Nice, first.Nice) * invQuotient
 | 
			
		||||
	avg.SystemPct = subtractAndConvertTicks(second.System, first.System) * invQuotient
 | 
			
		||||
	avg.IdlePct = subtractAndConvertTicks(second.Idle, first.Idle) * invQuotient
 | 
			
		||||
	avg.IowaitPct = subtractAndConvertTicks(second.Iowait, first.Iowait) * invQuotient
 | 
			
		||||
	avg.IrqPct = subtractAndConvertTicks(second.Irq, first.Irq) * invQuotient
 | 
			
		||||
	avg.SoftIrqPct = subtractAndConvertTicks(second.SoftIrq, first.SoftIrq) * invQuotient
 | 
			
		||||
	avg.StealPct = subtractAndConvertTicks(second.Steal, first.Steal) * invQuotient
 | 
			
		||||
	avg.GuestPct = subtractAndConvertTicks(second.Guest, first.Guest) * invQuotient
 | 
			
		||||
	avg.Time = second.Time
 | 
			
		||||
	avg.Seconds = second.Time.Sub(first.Time).Seconds()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getProcCPUAverage(first ProcCPUSample, second ProcCPUSample, procUptime float64) (avg ProcCPUAverage) {
 | 
			
		||||
	dT := second.Time.Sub(first.Time).Seconds()
 | 
			
		||||
 | 
			
		||||
	avg.UserPct = 100 * (second.User - first.User) / dT
 | 
			
		||||
	avg.SystemPct = 100 * (second.System - first.System) / dT
 | 
			
		||||
	avg.TotalPct = 100 * (second.Total - first.Total) / dT
 | 
			
		||||
	avg.PossiblePct = 100.0 * float64(runtime.NumCPU())
 | 
			
		||||
	avg.CumulativeTotalPct = 100 * second.Total / procUptime
 | 
			
		||||
	avg.Time = second.Time
 | 
			
		||||
	avg.Seconds = dT
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func parseCPUFields(fields []string, stat *CPUSample) {
 | 
			
		||||
	numFields := len(fields)
 | 
			
		||||
	stat.Name = fields[0]
 | 
			
		||||
	for i := 1; i < numFields; i++ {
 | 
			
		||||
		val, numerr := strconv.ParseUint(fields[i], 10, 64)
 | 
			
		||||
		if numerr != nil {
 | 
			
		||||
			log.Println("systemstat.parseCPUFields(): Error parsing (field, value): ", i, fields[i])
 | 
			
		||||
		}
 | 
			
		||||
		stat.Total += val
 | 
			
		||||
		switch i {
 | 
			
		||||
		case 1:
 | 
			
		||||
			stat.User = val
 | 
			
		||||
		case 2:
 | 
			
		||||
			stat.Nice = val
 | 
			
		||||
		case 3:
 | 
			
		||||
			stat.System = val
 | 
			
		||||
		case 4:
 | 
			
		||||
			stat.Idle = val
 | 
			
		||||
		case 5:
 | 
			
		||||
			stat.Iowait = val
 | 
			
		||||
		case 6:
 | 
			
		||||
			stat.Irq = val
 | 
			
		||||
		case 7:
 | 
			
		||||
			stat.SoftIrq = val
 | 
			
		||||
		case 8:
 | 
			
		||||
			stat.Steal = val
 | 
			
		||||
		case 9:
 | 
			
		||||
			stat.Guest = val
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_test.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_test.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
// Copyright (c) 2013 Phillip Bond
 | 
			
		||||
// Licensed under the MIT License
 | 
			
		||||
// see file LICENSE
 | 
			
		||||
 | 
			
		||||
package systemstat
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	msgFail = "%v method fails. Expects %v, returns %v"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestGetUptime(t *testing.T) {
 | 
			
		||||
	s := getUptime("testdata/uptime")
 | 
			
		||||
	if s.Uptime != 18667.53 {
 | 
			
		||||
		t.Errorf(msgFail, "getUptime", "18667.53", s.Uptime)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestGetLoadAvgSample(t *testing.T) {
 | 
			
		||||
	s := getLoadAvgSample("testdata/loadavg")
 | 
			
		||||
	fmt.Printf("%#v\n", s)
 | 
			
		||||
	if s.One != 0.1 {
 | 
			
		||||
		t.Errorf(msgFail, "getUptime", "0.1", s.One)
 | 
			
		||||
	}
 | 
			
		||||
	if s.Five != 0.15 {
 | 
			
		||||
		t.Errorf(msgFail, "getUptime", "0.15", s.Five)
 | 
			
		||||
	}
 | 
			
		||||
	if s.Fifteen != 0.14 {
 | 
			
		||||
		t.Errorf(msgFail, "getUptime", "0.14", s.Fifteen)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/loadavg
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/loadavg
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
0.10 0.15 0.14 1/538 27757
 | 
			
		||||
							
								
								
									
										42
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/meminfo
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/meminfo
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
MemTotal:        3768292 kB
 | 
			
		||||
MemFree:          831872 kB
 | 
			
		||||
Buffers:          153268 kB
 | 
			
		||||
Cached:          1622412 kB
 | 
			
		||||
SwapCached:            0 kB
 | 
			
		||||
Active:          1287508 kB
 | 
			
		||||
Inactive:        1297924 kB
 | 
			
		||||
Active(anon):     811384 kB
 | 
			
		||||
Inactive(anon):   227652 kB
 | 
			
		||||
Active(file):     476124 kB
 | 
			
		||||
Inactive(file):  1070272 kB
 | 
			
		||||
Unevictable:         196 kB
 | 
			
		||||
Mlocked:             196 kB
 | 
			
		||||
SwapTotal:       7907324 kB
 | 
			
		||||
SwapFree:        7907324 kB
 | 
			
		||||
Dirty:               228 kB
 | 
			
		||||
Writeback:             0 kB
 | 
			
		||||
AnonPages:        809948 kB
 | 
			
		||||
Mapped:           226452 kB
 | 
			
		||||
Shmem:            229284 kB
 | 
			
		||||
Slab:             210268 kB
 | 
			
		||||
SReclaimable:     148028 kB
 | 
			
		||||
SUnreclaim:        62240 kB
 | 
			
		||||
KernelStack:        4344 kB
 | 
			
		||||
PageTables:        37932 kB
 | 
			
		||||
NFS_Unstable:          0 kB
 | 
			
		||||
Bounce:                0 kB
 | 
			
		||||
WritebackTmp:          0 kB
 | 
			
		||||
CommitLimit:     9791468 kB
 | 
			
		||||
Committed_AS:    4513904 kB
 | 
			
		||||
VmallocTotal:   34359738367 kB
 | 
			
		||||
VmallocUsed:      368496 kB
 | 
			
		||||
VmallocChunk:   34359365956 kB
 | 
			
		||||
HardwareCorrupted:     0 kB
 | 
			
		||||
AnonHugePages:         0 kB
 | 
			
		||||
HugePages_Total:       0
 | 
			
		||||
HugePages_Free:        0
 | 
			
		||||
HugePages_Rsvd:        0
 | 
			
		||||
HugePages_Surp:        0
 | 
			
		||||
Hugepagesize:       2048 kB
 | 
			
		||||
DirectMap4k:      126592 kB
 | 
			
		||||
DirectMap2M:     3786752 kB
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat0
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat0
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
28267 (go-top) S 28256 28256 27864 34816 28256 4202496 736 0 0 0 17470 14 0 0 20 0 7 0 1882735 274173952 571 18446744073709551615 4194368 5592552 140737466979680 139798064197344 4333379 0 0 0 2143420159 18446744073709551615 0 0 17 1 0 0 0 0 0
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat1
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat1
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
28267 (go-top) R 28256 28256 27864 34816 28256 4202496 736 0 0 0 18773 16 0 0 20 0 7 0 1882735 274173952 571 18446744073709551615 4194368 5592552 140737466979680 139798065368712 4457862 0 0 0 2143420159 18446744073709551615 0 0 17 3 0 0 0 0 0
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat2
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat2
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
28267 (go-top) R 28256 28256 27864 34816 28256 4202496 738 0 0 0 20618 18 0 0 20 0 7 0 1882735 274239488 571 18446744073709551615 4194368 5592552 140737466979680 140737466979424 4203351 0 0 0 2143420159 18446744073709551615 0 0 17 0 0 0 0 0 0
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat3
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat3
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
28267 (go-top) R 28256 28256 27864 34816 28256 4202496 738 0 0 0 21641 19 0 0 20 0 7 0 1882735 274239488 571 18446744073709551615 4194368 5592552 140737466979680 139798065356424 4333379 0 0 0 2143420159 18446744073709551615 0 0 17 0 0 0 0 0 0
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat5
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat5
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
28267 (go-top) R 28256 28256 27864 34816 28256 4202496 738 0 0 0 23722 21 0 0 20 0 7 0 1882735 274239488 571 18446744073709551615 4194368 5592552 140737466979680 139798065368712 4203351 0 0 0 2143420159 18446744073709551615 0 0 17 1 0 0 0 0 0
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat6
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat6
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
28267 (go-top) S 28256 28256 27864 34816 28256 4202496 741 0 0 0 25512 22 0 0 20 0 7 0 1882735 274305024 571 18446744073709551615 4194368 5592552 140737466979680 140737466979424 4333379 0 0 0 2143420159 18446744073709551615 0 0 17 2 0 0 0 0 0
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  17313 714 8241 717906 1456 0 364 0 0 0
 | 
			
		||||
cpu0 6642 289 3526 173411 1162 0 355 0 0 0
 | 
			
		||||
cpu1 2193 88 1066 183608 86 0 2 0 0 0
 | 
			
		||||
cpu2 6463 217 2578 177186 141 0 4 0 0 0
 | 
			
		||||
cpu3 2014 118 1070 183699 65 0 2 0 0 0
 | 
			
		||||
intr 2312829 54 5540 0 0 0 0 0 0 1 24723 0 0 262321 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124099 1226 121928 26 141511 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3689186
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 27752
 | 
			
		||||
procs_running 1
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 923034 6 201522 63 2716 129127 6 168304 89194 629 331467
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat2
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat2
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  17328 714 8254 725156 1457 0 366 0 0 0
 | 
			
		||||
cpu0 6648 289 3531 175213 1164 0 356 0 0 0
 | 
			
		||||
cpu1 2198 88 1066 185425 86 0 2 0 0 0
 | 
			
		||||
cpu2 6466 217 2584 178996 141 0 4 0 0 0
 | 
			
		||||
cpu3 2015 118 1071 185521 65 0 2 0 0 0
 | 
			
		||||
intr 2316896 54 5562 0 0 0 0 0 0 1 24939 0 0 262321 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124124 1226 123058 26 142249 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3694091
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 27777
 | 
			
		||||
procs_running 1
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 925673 6 202044 63 2716 129146 6 169061 89550 633 332448
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat3
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat3
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  18661 714 8322 736828 1463 0 367 0 0 0
 | 
			
		||||
cpu0 6715 289 3555 178374 1170 0 358 0 0 0
 | 
			
		||||
cpu1 3134 88 1080 187754 86 0 2 0 0 0
 | 
			
		||||
cpu2 6769 217 2603 181942 141 0 4 0 0 0
 | 
			
		||||
cpu3 2042 118 1082 188756 65 0 2 0 0 0
 | 
			
		||||
intr 2346985 54 5673 0 0 0 0 0 0 1 25358 0 0 269347 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124230 1226 125412 26 143648 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3722386
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 27939
 | 
			
		||||
procs_running 2
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 939514 6 208124 63 2720 129245 6 170565 91355 637 336793
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat4
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat4
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  24106 714 8436 758512 1472 0 372 0 0 0
 | 
			
		||||
cpu0 7831 289 3602 183989 1177 0 361 0 0 0
 | 
			
		||||
cpu1 5075 88 1096 192627 86 0 3 0 0 0
 | 
			
		||||
cpu2 7667 217 2640 187814 142 0 5 0 0 0
 | 
			
		||||
cpu3 3531 118 1096 194081 66 0 2 0 0 0
 | 
			
		||||
intr 2425351 54 5880 0 0 0 0 0 0 1 26243 0 0 282247 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124425 1226 130129 26 146647 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3788723
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 28152
 | 
			
		||||
procs_running 1
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 975972 6 226788 63 2738 129419 6 173753 98111 659 344429
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat5
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat5
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  25797 714 8461 761860 1472 0 375 0 0 0
 | 
			
		||||
cpu0 8406 289 3611 184664 1177 0 364 0 0 0
 | 
			
		||||
cpu1 5391 88 1102 193577 86 0 3 0 0 0
 | 
			
		||||
cpu2 8115 217 2646 188622 142 0 5 0 0 0
 | 
			
		||||
cpu3 3884 118 1100 194996 66 0 2 0 0 0
 | 
			
		||||
intr 2446830 54 5896 0 0 0 0 0 0 1 26399 0 0 286933 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124455 1226 131103 26 147182 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3804378
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 28177
 | 
			
		||||
procs_running 3
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 985047 6 231802 63 2740 129448 6 174303 100182 665 345832
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat6
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat6
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  31643 714 8507 766175 1477 0 377 0 0 0
 | 
			
		||||
cpu0 9865 289 3628 185726 1182 0 366 0 0 0
 | 
			
		||||
cpu1 6867 88 1110 194656 86 0 3 0 0 0
 | 
			
		||||
cpu2 9658 217 2661 189610 142 0 5 0 0 0
 | 
			
		||||
cpu3 5252 118 1108 196181 66 0 2 0 0 0
 | 
			
		||||
intr 2492898 54 5942 0 0 0 0 0 0 1 26734 0 0 291667 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124574 1226 133046 26 148246 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3836141
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 28244
 | 
			
		||||
procs_running 5
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 1009821 6 247713 63 2748 129565 6 175417 104452 670 349181
 | 
			
		||||
							
								
								
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat7
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat7
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
cpu  32813 714 8513 766223 1477 0 377 0 0 0
 | 
			
		||||
cpu0 10159 289 3628 185737 1182 0 367 0 0 0
 | 
			
		||||
cpu1 7162 88 1110 194668 86 0 3 0 0 0
 | 
			
		||||
cpu2 9945 217 2664 189623 142 0 5 0 0 0
 | 
			
		||||
cpu3 5546 118 1109 196193 66 0 2 0 0 0
 | 
			
		||||
intr 2498999 54 5954 0 0 0 0 0 0 1 26770 0 0 291667 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124585 1226 133246 26 148377 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 | 
			
		||||
ctxt 3839591
 | 
			
		||||
btime 1374442803
 | 
			
		||||
processes 28269
 | 
			
		||||
procs_running 5
 | 
			
		||||
procs_blocked 0
 | 
			
		||||
softirq 1014220 6 250668 63 2748 129576 6 175558 105038 670 349887
 | 
			
		||||
							
								
								
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/uptime
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/uptime
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
18667.53 7140.26
 | 
			
		||||
		Reference in New Issue
	
	Block a user