mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-28 13:48:49 +08:00
Merge branch 'master' of github.com:shirou/gopsutil
This commit is contained in:
commit
1629dd9a38
27
LICENSE
Normal file
27
LICENSE
Normal file
@ -0,0 +1,27 @@
|
||||
gopsutil is distributed under BSD license reproduced below.
|
||||
|
||||
Copyright (c) 2014, WAKAYAMA Shirou
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the psutil authors nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
56
README.rst
56
README.rst
@ -1,8 +1,64 @@
|
||||
gopsutil: psutil for golang
|
||||
==============================
|
||||
|
||||
This is a port of psutil(http://pythonhosted.org/psutil/). This
|
||||
challenges port of all
|
||||
|
||||
Available archtectures
|
||||
------------------------------------
|
||||
|
||||
- FreeBSD/amd64
|
||||
- Linux
|
||||
- Windows
|
||||
|
||||
(I do not have a darwin machine)
|
||||
|
||||
usage
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
import (
|
||||
"github.com/shirou/gopsutil"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func main(){
|
||||
v, _ := gopsutil.Virtual_memory()
|
||||
|
||||
// return value is struct
|
||||
fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)
|
||||
|
||||
// convert to JSON
|
||||
d, _ := json.Marshal(v)
|
||||
fmt.Printf("%s\n", d)
|
||||
}
|
||||
|
||||
The output is below.
|
||||
|
||||
::
|
||||
|
||||
Total: 3179569152, Free:284233728, UsedPercent:84.508194%
|
||||
{"total":3179569152,"available":492572672,"used":2895335424,"usedPercent":84.50819439828305, (snip)}
|
||||
|
||||
|
||||
Document
|
||||
----------
|
||||
|
||||
see http://godoc.org/github.com/shirou/gopsutil
|
||||
|
||||
|
||||
License
|
||||
------------
|
||||
|
||||
New BSD License (same as psutil)
|
||||
|
||||
|
||||
Related works
|
||||
-----------------------
|
||||
|
||||
So many thanks!
|
||||
|
||||
- psutil: http://pythonhosted.org/psutil/
|
||||
- dstat: https://github.com/dagwieers/dstat
|
||||
|
Loading…
x
Reference in New Issue
Block a user