@ -8,10 +8,10 @@ gopsutil: psutil for golang
:target: https://coveralls.io/r/shirou/gopsutil?branch=master
:target: https://coveralls.io/r/shirou/gopsutil?branch=master
This is a port of psutil(http://pythonhosted.org/psutil/). This
This is a port of psutil (http://pythonhosted.org/psutil/). The challenge is porting all
challenges porting all psutil functions on some architectures.
psutil functions on some architectures...
Available arch tectures
Available Archi tectures
------------------------------------
------------------------------------
- FreeBSD/amd64
- FreeBSD/amd64
@ -39,7 +39,7 @@ Usage
func main() {
func main() {
v, _ := gopsutil.VirtualMemory()
v, _ := gopsutil.VirtualMemory()
// almost every return value is struct
// almost every return value is a struct
fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)
fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)
// convert to JSON. String() is also implemented
// convert to JSON. String() is also implemented
@ -54,34 +54,43 @@ The output is below.
{"total":3179569152,"available":492572672,"used":2895335424,"usedPercent":84.50819439828305, (snip)}
{"total":3179569152,"available":492572672,"used":2895335424,"usedPercent":84.50819439828305, (snip)}
Document
Documentation
----------
------------------------
see http://godoc.org/github.com/shirou/gopsutil
see http://godoc.org/github.com/shirou/gopsutil
More i nfo
More I nfo
--------------------
--------------------
To becomes more useful, I have some methods which produces more information.
Several methods have been added which are not present in psutil, but which provide useful information.
- Hostinfo() (linux)
- HostInfo() (linux)
- OS
- Hostname
- Platform (ex: ubuntu, arch)
- Uptime
- Platform family (ex: debian)
- Procs
- Platform Version (ex: Ubuntu 13.10)
- OS (ex: "linux")
- VirtualizationSystem (ex: LXC)
- Platform (ex: "ubuntu", "arch")
- VirtualizationRole (ex: guest/host)
- PlatformFamily (ex: "debian")
- PlatformVersion (ex: "Ubuntu 13.10")
- CPUInfoStat() (linux, freebsd)
- VirtualizationSystem (ex: "LXC")
- VirtualizationRole (ex: "guest"/"host")
- Processer
- Vendor ID
- CPUInfo() (linux, freebsd)
- Model name
- cores
- CPU (ex: 0, 1, ...)
- VendorID (ex: "GenuineIntel")
- Family
- Model
- Stepping
- PhysicalID
- CoreID
- Cores (ex: 2)
- ModelName (ex: "Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz")
- Mhz
- Mhz
- etc...
- CacheSize
- Flags (ex: "fpu vme de pse tsc msr pae mce cx8 ...")
- LoadAvg() (linux, freebsd)
- LoadAvg() (linux, freebsd)
@ -188,9 +197,11 @@ License
New BSD License (same as psutil)
New BSD License (same as psutil)
Related w orks
Related W orks
-----------------------
-----------------------
I have been influenced by the following great works:
- psutil: http://pythonhosted.org/psutil/
- psutil: http://pythonhosted.org/psutil/
- dstat: https://github.com/dagwieers/dstat
- dstat: https://github.com/dagwieers/dstat
- gosiger: https://github.com/cloudfoundry/gosigar/
- gosiger: https://github.com/cloudfoundry/gosigar/
@ -198,9 +209,8 @@ Related works
- go-ps: https://github.com/mitchellh/go-ps
- go-ps: https://github.com/mitchellh/go-ps
- ohai: https://github.com/opscode/ohai/
- ohai: https://github.com/opscode/ohai/
I have influenced from these great works.
How to Contributing
How to Contribute
---------------------------
---------------------------
1. Fork it
1. Fork it
@ -209,5 +219,5 @@ How to Contributing
4. Push to the branch (git push origin my-new-feature)
4. Push to the branch (git push origin my-new-feature)
5. Create new Pull Request
5. Create new Pull Request
My engilsh is terrible, documentation or correcting comments are also
My Engilsh is terrible, so documentation or correcting comments are also
welcome.
welcome.