From 4c323a7715057ec6f5c8ad5153392730d6cd6af5 Mon Sep 17 00:00:00 2001 From: WAKAYAMA shirou Date: Tue, 22 Apr 2014 12:31:36 +0900 Subject: [PATCH] update README and add LICENSE file. --- LICENSE | 27 +++++++++++++++++++++++++++ README.rst | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f835f84 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.rst b/README.rst index 67308d9..e0abe67 100644 --- a/README.rst +++ b/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