psutil for golang

Overview

gopsutil: psutil for golang

https://coveralls.io/repos/shirou/gopsutil/badge.svg?branch=master

This is a port of psutil (https://github.com/giampaolo/psutil). The challenge is porting all psutil functions on some architectures.

v3 migration

from v3.20.10, gopsutil becomes v3 which breaks backawards compatiblity. See v3Changes.md more detail changes.

Tag semantics

gopsutil tag policy is almost same as Semantic Versioning, but automatically increase like Ubuntu versioning.

for example, v2.17.04 means

  • v2: major version
  • 17: release year, 2017
  • 04: release month

gopsutil aims to keep backwards-compatiblity until major version change.

Taged at every end of month, but there are only a few commits, it can be skipped.

Available Architectures

  • FreeBSD i386/amd64/arm
  • Linux i386/amd64/arm(raspberry pi)
  • Windows/amd64
  • Darwin i386/amd64
  • OpenBSD amd64 (Thank you @mpfz0r!)
  • Solaris amd64 (developed and tested on SmartOS/Illumos, Thank you @jen20!)

These are partial support:

  • CPU on DragonFly BSD (#893, Thank you @gballet!)
  • host on Linux RISC-V (#896, Thank you @tklauser!)

All works are implemented without cgo by porting c struct to golang struct.

Usage

package main

import (
    "fmt"

    "github.com/shirou/gopsutil/v3/mem"
    // "github.com/shirou/gopsutil/mem"  // to use v2
)

func main() {
    v, _ := mem.VirtualMemory()

    // almost every return value is a struct
    fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)

    // convert to JSON. String() is also implemented
    fmt.Println(v)
}

The output is below.

Total: 3179569152, Free:284233728, UsedPercent:84.508194%
{"total":3179569152,"available":492572672,"used":2895335424,"usedPercent":84.50819439828305, (snip...)}

You can set an alternative location to /proc by setting the HOST_PROC environment variable.

You can set an alternative location to /sys by setting the HOST_SYS environment variable.

You can set an alternative location to /etc by setting the HOST_ETC environment variable.

You can set an alternative location to /var by setting the HOST_VAR environment variable.

You can set an alternative location to /run by setting the HOST_RUN environment variable.

You can set an alternative location to /dev by setting the HOST_DEV environment variable.

Documentation

see http://godoc.org/github.com/shirou/gopsutil

Requirements

  • go1.11 or above is required.

More Info

Several methods have been added which are not present in psutil, but will provide useful information.

  • host/HostInfo() (linux)
    • Hostname
    • Uptime
    • Procs
    • OS (ex: "linux")
    • Platform (ex: "ubuntu", "arch")
    • PlatformFamily (ex: "debian")
    • PlatformVersion (ex: "Ubuntu 13.10")
    • VirtualizationSystem (ex: "LXC")
    • VirtualizationRole (ex: "guest"/"host")
  • IOCounters
  • cpu/CPUInfo() (linux, freebsd)
    • 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
    • CacheSize
    • Flags (ex: "fpu vme de pse tsc msr pae mce cx8 ...")
    • Microcode
  • load/LoadAvg() (linux, freebsd)
    • Load1
    • Load5
    • Load15
  • docker/GetDockerIDList() (linux only)
    • container id list ([]string)
  • docker/CgroupCPU() (linux only)
    • user
    • system
  • docker/CgroupMem() (linux only)
    • various status
  • net_protocols (linux only)
    • system wide stats on network protocols (i.e IP, TCP, UDP, etc.)
    • sourced from /proc/net/snmp
  • iptables nf_conntrack (linux only)
    • system wide stats on netfilter conntrack module
    • sourced from /proc/sys/net/netfilter/nf_conntrack_count

Some codes are ported from Ohai. many thanks.

Current Status

  • x: work
  • b: almost works, but something is broken

Process class

name Linux FreeBSD OpenBSD MacOSX Windows
pid x x x x x
ppid x x x x x
name x x x x x
cmdline x x   x x
create_time x     x x
status x x x x  
cwd x        
exe x x x   x
uids x x x x  
gids x x x x  
terminal x x x x  
io_counters x x x   x
nice x x x x x
num_fds x        
num_ctx_switches x        
num_threads x x x x x
cpu_times x       x
memory_info x x x x x
memory_info_ex x        
memory_maps x        
open_files x        
send_signal x x x x  
suspend x x x x  
resume x x x x  
terminate x x x x x
kill x x x x  
username x x x x x
ionice          
rlimit x        
num_handlers          
threads x        
cpu_percent x   x x  
cpu_affinity          
memory_percent          
parent x   x x x
children x x x x x
connections x   x x  
is_running          
page_faults x        

Original Metrics

item Linux FreeBSD OpenBSD MacOSX Windows Solaris
HostInfo            
hostname x x x x x x
uptime x x x x   x
proces x x x     x
os x x x x x x
platform x x x x   x
platformfamily x x x x   x
virtualization x          
CPU            
VendorID x x x x x x
Family x x x x x x
Model x x x x x x
Stepping x x x x x x
PhysicalID x         x
CoreID x         x
Cores x       x x
ModelName x x x x x x
Microcode x         x
LoadAvg            
Load1 x x x x    
Load5 x x x x    
Load15 x x x x    
GetDockerID            
container id x no no no no  
CgroupsCPU            
user x no no no no  
system x no no no no  
CgroupsMem            
various x no no no no  
  • future work
    • process_iter
    • wait_procs
    • Process class
      • as_dict
      • wait

License

New BSD License (same as psutil)

Related Works

I have been influenced by the following great works:

How to Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

My English is terrible, so documentation or correcting comments are also welcome.

Comments
  • Make types for OpenBSD/arm64

    Make types for OpenBSD/arm64

    As requested here.

    These were generated on OpenBSD-current on a Raspberry Pi 4.

    Can you tell me how to test the build and run the test suite? I don't know anything about golang!

    Fixes #992

    package:host package:process package:disk package:mem v3 
    opened by vext01 21
  • proc.Percent()

    proc.Percent()

    I am trying to get cpu usage for a process. However, I am getting 0 as the value always. Below is my sample code. I am using telegraf procstat plugin. Even there it's returning 0 value

    ` func main() {

    var pid int32
    pid = 10172
    proc, _ := process.NewProcess(pid)
    p, err := proc.Percent(time.Duration(0))
    if err != nil {
       fmt.Println(err)
    }
    

    }`

    Thanks

    opened by adityacs 19
  • Mhz copied to CPU on FreeBSD

    Mhz copied to CPU on FreeBSD

    I noticed CPU outputs value of MHz instead of number on CPUs. I thought CPU is used to output number of physical CPUs.

    I think dmesg might help here to get the right number. Here are a few examples from our servers

    • (2phys CPUs no HT) FreeBSD/SMP: 2 package(s) x 4 core(s) hw.ncpu=8
    • (1 phys CPUs) FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads hw.ncpu=4
    • (1 phys CPUs) FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 SMT threads hw.ncpu=8
    • (1 phys CPUs) FreeBSD/SMP: 1 package(s) x 6 core(s) x 2 SMT threads hw.ncpu=12
    opened by urosgruber 18
  • disk: device mapper name in linux

    disk: device mapper name in linux

    I would like to support device mapper naming in linux for the disk module.

    It's not as exotic as it sounds, eg LVM devices get a mapper name; but my main interest is is multipath devices.

    to get the name, there's following https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block-dm

    so given device name abc it is as easy as trying to get the content of /sys/block/abc/dm/name. it will be empty for non-dm devices and for older kernels or system without /sys mounted

    my main question is: would such feature get merged? and if so, what attributename can i use for that?

    i would implement it similar to getSerialNumber and maybe add it in IOCounter as d.DMName = getDeviceMapperName(), similar to the way the serial number is added.

    opened by stdweird 16
  • Fix broken retrieval of OpenBSD CPU metrics

    Fix broken retrieval of OpenBSD CPU metrics

    CPU metrics are broken on OpenBSD 7.0-CURRENT as described in #1239. I believe that the problem is the multiplication of the CPU incrementer by 2 when the code walks through the available CPUs to gather CPU time metrics. The code makes uses of the KERN_CPTIME2 sysctl to fetch per-CPU time metrics.

    Looking at the kernel code behind this particular sysctl, we have this.. As you can see, it's calling a CPU_INFO_FOREACH macro and iterating through the results until it has the info for the requested CPU. This macro is defined per-architecture and in every one that I found, it's just iterating through cpu_info structs defined here.

    I can't find anything that leads me to believe that this Go code should be incrementing by anything other than 1.

    In the entire OpenBSD codebase, there's only one use of the KERN_CPTIME2 sysctl and that's in snmpd's source code, which iterates through the CPUs and it does this by incrementing the counter by 1.

    This particular code ^ hasn't changed since 2016 and I'll bet it still works. :-)

    Here's another clue. As I mentioned, the guts of this syscall is just iterating through cpu_info struct. I looked around for other uses of this struct and found code for the new OpenBSD debugger. There are different implementations for different architectures, but for amd64, it also increments through CPUs by 1.

    Here is a PR to fix this. I only have one OpenBSD machine to test on, a simple Dell Optiplex workstation.

    package:cpu 
    opened by chrissnell 14
  • Cache common/common_linux.Virtualization()

    Cache common/common_linux.Virtualization()

    By assuming virtualization environment won't change during a the program's runtime, we can cache common/common_linux.Virtualization() with a simple map to reduce amount of system calls. I first mentioned this issue at 890

    opened by AtakanColak 14
  • go.mod does not specify v2 version

    go.mod does not specify v2 version

    The go.mod file in this repo does not specify the /v2 tag so if this module is imported in any project, it will be imported with +incompatible From the official documentation (https://github.com/golang/go/wiki/Modules)

    The module path (such as module foo/v2) declared at the start of a module's go.mod file is both: the definitive declaration of that module's identity the definitive declaration of how that module must be imported by consuming code

    A module can import a v2+ package that has not opted in to modules itself. A non-module v2+ package that has a valid v2+ semver tag will be recorded with an +incompatible suffix in the importing module's go.mod file. The +incompatible suffix indicates that even though the v2+ package has a valid v2+ semver tag such as v2.0.0, the v2+ package has not actively opted in to modules and hence that v2+ package is assumed to have not been created with an understanding of the implications of Semantic Import Versioning and how to use major versions in import paths. Therefore, when operating in module mode, the go tool will treat a non-module v2+ package as an (incompatible) extension of the v1 version series of the package and assume the package has no awareness of Semantic Import Versioning, and the +incompatible suffix is an indication that the go tool is doing so.

    Tested this on centos linux and saw this in my go.mod file github.com/shirou/gopsutil v2.18.12+incompatible When I tested this, the current tag was 2.19.03 My go version go version go1.11 linux/amd64

    opened by hvastani 14
  • add bedrock linux support

    add bedrock linux support

    on bedrock linux installs, gopsutil improperly detects the operating system as the operating system of the strata the program is being run from. this pull request adds in another utility function that detects the /bedrock folder at the root of the system and if it finds it, it changes the files being read from and properly detects the operating system as being bedrock linux

    opened by superwhiskers 14
  • Deprecated code in macOS Monterey

    Deprecated code in macOS Monterey

    Describe the bug There is a deprecation messages while building code with gopsutil v3.

    # github.com/shirou/gopsutil/disk
    iostat_darwin.c:28:2: warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:132:1: note: 'IOMasterPort' has been explicitly marked deprecated here
    # github.com/shirou/gopsutil/host
    smc_darwin.c:75:41: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:123:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
    

    To Reproduce

    package main
    
    import (
    	_ "github.com/shirou/gopsutil/cpu"
    	_ "github.com/shirou/gopsutil/disk"
    	_ "github.com/shirou/gopsutil/host"
    	_ "github.com/shirou/gopsutil/mem"
    )
    
    func main() {}
    

    Expected behavior There isn't any messages about deprecation.

    Environment (please complete the following information):

    • [x] Mac OS: [paste the result of sw_vers and uname -a
    ProductName:	macOS
    ProductVersion:	12.0.1
    BuildVersion:	21A559
    
    Darwin MacBook-Pro.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64
    
    os:darwin package:host package:disk 
    opened by lavrd 13
  • [windows]services: add windows service feature

    [windows]services: add windows service feature

    Hi, @shirou I write windows service package to implement like psutil win_services.

    usage:

    
    import (
    	"fmt"
    	"log"
    
    	"github.com/shirou/gopsutil/winservices"
    )
    
    func main() {
            name := "MySQL57"
    	srv, err := winservices.NewService(name)
    	if err != nil {
    		log.Fatalf("get service by name error, %s", err)
    	}
    	if err := srv.GetServiceDetail(); err != nil {
    		log.Fatalf("get service %s error, %s", name, err)
    	}
    
           services, err := winservices.ListServices()
    	if err != nil {
    		log.Fatal(err)
    	}
    }
    

    implement #524, please check it. I don't know how to write test code for this feature, can you tell me? thanks :)

    opened by pytimer 13
  • processor, v3/processor (Win): fix slow cpuinfo on multisocket config

    processor, v3/processor (Win): fix slow cpuinfo on multisocket config

    updated win32_Processor struct to exclude (unused) LoadPercentage field. The loadpercentage takes linearly more time as the # of sockets increases. By default vSphere maps 1 vCPU to 1 socket, resulting in very poor performance when getting CPU info against, saying, 40 vCPU VM (basically 40 sockets as seen by the VM).

    Here is the before and after time comparison: printcpu-diff

    changes:

    for cpu: since Win32_Processor is a public struct, created a substruct named: Win32_ProcessorWithoutLoadPct for use in all queries without breaking any potential usage of the public api.

    for v3/cpu: since the struct now is private, simply removed LoadPercentage

    package:cpu v3 
    opened by fredwangwang 12
  • chore(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0

    chore(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0

    Bumps golang.org/x/sys from 0.3.0 to 0.4.0.

    Commits
    • b60007c unix: add Uvmexp and SysctlUvmexp for NetBSD
    • b751db5 unix: gofmt hurd files after CL 459895
    • b360406 unix: support TIOCGETA on GNU/Hurd
    • 3086868 unix: regen on OpenBSD 7.2
    • 2b11e6b unix: remove Mclpool from openbsd types
    • 7c6badc unix: convert openbsd/mips64 to direct libc calls
    • 3b1fc93 unix: avoid allocations for common uses of Readv, Writev, etc.
    • 2204b66 cpu: parse /proc/cpuinfo on linux/arm64 on old kernels when needed
    • 72f772c unix: offs2lohi should shift by bits, not bytes
    • cffae8e unix: add ClockGettime on *bsd and solaris
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 0
  • iOS build error:

    iOS build error: "C source files not allowed when not using cgo or SWIG: iostat_darwin.c"

    Describe the bug I'm getting a "C source files not allowed when not using cgo or SWIG: iostat_darwin.c" error when compiling when trying to compile go-btfs which has a dependency on go-sutil. I need to use CGO so CGO=0 is not doable for me, issue is happening for arm64 and x86_64 as well.

    Exact output error:

    package github.com/bittorrent/go-btfs/cmd/btfs imports github.com/bittorrent/go-btfs/chain imports github.com/bittorrent/go-btfs/core/commands/storage/path imports github.com/shirou/gopsutil/v3/disk: C source files not allowed when not using cgo or SWIG: iostat_darwin.c make: *** [ios-arm64] Error 1

    To Reproduce

    v3.22.12

    	CGO_ENABLED=1 \
    	GOOS=darwin \
    	GOARCH=arm64 \
    	SDK=iphoneos \
    	SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk \
    	CC=$(PWD)/clangwrap.sh \
    	CGO_CFLAGS="-fembed-bitcode -Wno-undef-prefix" \
    	go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/arm64.a .
    

    Expected behavior Compiling completed with no issues

    Environment (please complete the following information):

    • [ ] Windows: [paste the result of ver]

    • [ ] Linux: [paste contents of /etc/os-release and the result of uname -a]

    • [X] Mac OS: ProductName: macOS ProductVersion: 13.1 BuildVersion: 22C65 Darwin Simbads-MacBook-Air.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 arm64

    • [ ] FreeBSD: [paste the result of freebsd-version -k -r -u and uname -a]

    • [ ] OpenBSD: [paste the result of uname -a]

    Additional context [Cross-compiling? Paste the command you are using to cross-compile and the result of the corresponding go env] GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/simbadmarino/Library/Caches/go-build" GOENV="/Users/simbadmarino/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/simbadmarino/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/simbadmarino/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.19.4" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/simbadmarino/Documents/btfs-sharedLib/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/89/7_dkrhfd345107kdvp3gk4p40000gn/T/go-build1188434045=/tmp/go-build -gno-record-gcc-switches -fno-common"

    MakeFile:

    	CGO_ENABLED=1 \
    	GOOS=darwin \
    	GOARCH=arm64 \
    	SDK=iphoneos \
    	SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk \
    	CC=$(PWD)/clangwrap.sh \
    	CGO_CFLAGS="-fembed-bitcode -Wno-undef-prefix" \
    	go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/arm64.a .
    

    clangwrap.txt

    Any support is greatly appreciated. Thanks

    opened by simbadMarino 0
  • Windows error: gopsutil: unexpected processor queue length counter error, please file an issue on github: err

    Windows error: gopsutil: unexpected processor queue length counter error, please file an issue on github: err

    Describe the bug

    print the error information

    gopsutil: unexpected processor queue length counter error, please file an issue on github: err
    

    To Reproduce

    // paste example code reproducing the bug you are reporting
    

    I am not sure what api cause this error

    Expected behavior

    It should works without any error information.

    Environment (please complete the following information):

    • [x] Windows: [paste the result of ver]
    • [ ] Linux: [paste contents of /etc/os-release and the result of uname -a]
    • [ ] Mac OS: [paste the result of sw_vers and uname -a
    • [ ] FreeBSD: [paste the result of freebsd-version -k -r -u and uname -a]
    • [ ] OpenBSD: [paste the result of uname -a]

    Additional context [Cross-compiling? Paste the command you are using to cross-compile and the result of the corresponding go env]

    set GO111MODULE=
    set GOARCH=amd64
    set GOBIN=
    set GOCACHE=C:\Users\Admin\AppData\Local\go-build
    set GOENV=C:\Users\Admin\AppData\Roaming\go\env  
    set GOEXE=.exe
    set GOEXPERIMENT=
    set GOFLAGS=
    set GOHOSTARCH=amd64
    set GOHOSTOS=windows
    set GOINSECURE=
    set GOMODCACHE=C:\Users\Admin\go\pkg\mod
    set GONOPROXY=
    set GONOSUMDB=
    set GOOS=windows
    set GOPATH=C:\Users\Admin\go
    set GOPRIVATE=
    set GOPROXY=https://proxy.golang.com.cn,direct   
    set GOROOT=C:\Program Files\Go
    set GOSUMDB=sum.golang.org
    set GOTMPDIR=
    set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
    set GOVCS=
    set GOVERSION=go1.19.3
    set GCCGO=gccgo
    set GOAMD64=v1
    set AR=ar
    set CC=gcc
    set CXX=g++
    set CGO_ENABLED=1
    set GOMOD=C:\Users\Admin\go\xx\go.mod
    set GOWORK=
    set CGO_CFLAGS=-g -O2
    set CGO_CPPFLAGS=
    set CGO_CXXFLAGS=-g -O2
    set CGO_FFLAGS=-g -O2
    set CGO_LDFLAGS=-g -O2
    set PKG_CONFIG=pkg-config
    set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\Admin\AppData\Local\Temp\go-build2193561186=/tmp/go-build -gno-record-gcc-switches
    PS C:\Users\Admin\go\src\xxx>
    

    截屏2022-11-18 22 06 25

    If need any additional information, please let me known.

    opened by axetroy 1
  • Initial support for NetBSD

    Initial support for NetBSD

    These two commits will hopefully help bring support for NetBSD to the project. I have not been able to verify if these changes are correct yet ("go test" did not yield anything apparently useful). Please review before merging, and do so only if you feel like it is not expected to break anything new.

    For these changes, I have simply copied the OpenBSD files as NetBSD, as the two systems are usually very close to one another. As such I think at least some things should work once the module is confirmed to build.

    package:host package:process package:cpu package:net package:load package:mem 
    opened by khorben 3
  • disk_windows.go function PartitionsWithContext and only local  disk

    disk_windows.go function PartitionsWithContext and only local disk

    Describe the bug

    In disk_windows.go func PartitionsWithContext not used flag "all" Always return all type of drive

    adding a flag analysis in lpBuffer cycle if !all && (typeret==2 || typeret==4 || typeret==5) { continue }

    opened by ldapomni 0
Releases(v3.22.12)
  • v3.22.12(Jan 1, 2023)

    Important notice

    v3.22.11 was reverted because some issue by #1384, and retracted by #1386.

    What's Changed

    cpu

    • feat: Setting the model name for arm based CPUs by @yaozbek in https://github.com/shirou/gopsutil/pull/1373
    • cpu: use windows.GetActiveProcessorCount by @tklauser in https://github.com/shirou/gopsutil/pull/1394
    • fill modelName for all cores in arm64 devices by @sgthammer in https://github.com/shirou/gopsutil/pull/1389
    • test: use T.Setenv to set env vars in tests by @Juneezee in https://github.com/shirou/gopsutil/pull/1398

    disk

    • [ios][disk] IOKit is not available on iOS by @tmm1 in https://github.com/shirou/gopsutil/pull/1362
    • pull request on adding missing statistic under solaris/illumos by @sfzfs in https://github.com/shirou/gopsutil/pull/1381
    • [disk][host]: move back Warnings from internal to disk and host. by @shirou in https://github.com/shirou/gopsutil/pull/1379
    • [disk][windows] Support LabelWithContext & SerialNumberWithContext - rebased by @FrankSpitulski in https://github.com/shirou/gopsutil/pull/1367
    • Revert "[disk][windows] Support LabelWithContext & SerialNumberWithContext - rebased " by @shirou in https://github.com/shirou/gopsutil/pull/1384
    • Truncate the Getfsstat result to the count of items that were returned by @brianryner8 in https://github.com/shirou/gopsutil/pull/1392

    host

    • feat(host, windows): add UBR (Update Build Revision) to kernel version by @shirou in https://github.com/shirou/gopsutil/pull/1374
    • host: use unix.ByteSliceToString by @tklauser in https://github.com/shirou/gopsutil/pull/1393

    load

    • [load][windows]: add error detail and context handling. by @shirou in https://github.com/shirou/gopsutil/pull/1380

    Other Changes

    • [android][host] fix Info() failure due to forbidden /proc/stat and /proc/uptime by @tmm1 in https://github.com/shirou/gopsutil/pull/1361
    • Retract deleted tag v3.22.11 by @bogdandrutu in https://github.com/shirou/gopsutil/pull/1386
    • Detect Docker also using /.dockerenv by @scop in https://github.com/shirou/gopsutil/pull/1400
    • chore(README): add HOST_ROOT by @shirou in https://github.com/shirou/gopsutil/pull/1401

    New Contributors

    • @yaozbek made their first contribution in https://github.com/shirou/gopsutil/pull/1373
    • @sfzfs made their first contribution in https://github.com/shirou/gopsutil/pull/1381
    • @FrankSpitulski made their first contribution in https://github.com/shirou/gopsutil/pull/1367
    • @bogdandrutu made their first contribution in https://github.com/shirou/gopsutil/pull/1386
    • @brianryner8 made their first contribution in https://github.com/shirou/gopsutil/pull/1392
    • @sgthammer made their first contribution in https://github.com/shirou/gopsutil/pull/1389
    • @Juneezee made their first contribution in https://github.com/shirou/gopsutil/pull/1398

    Full Changelog: https://github.com/shirou/gopsutil/compare/v3.22.10...v3.22.12

    Source code(tar.gz)
    Source code(zip)
  • v3.22.10(Nov 1, 2022)

    What's Changed

    disk

    • Return all Windows partitions by @atoulme in https://github.com/shirou/gopsutil/pull/1347

    net

    • Pass on context to ConnectionsPidWithContext by @ib-steffen in https://github.com/shirou/gopsutil/pull/1365

    process

    • Fix memory leaks in process_darwin_cgo by @bduffany in https://github.com/shirou/gopsutil/pull/1360
    • [process][windows] Retrieve process name as basename of executable by @Lomanic in https://github.com/shirou/gopsutil/pull/1369

    New Contributors

    • @atoulme made their first contribution in https://github.com/shirou/gopsutil/pull/1347
    • @bduffany made their first contribution in https://github.com/shirou/gopsutil/pull/1360
    • @ib-steffen made their first contribution in https://github.com/shirou/gopsutil/pull/1365

    Full Changelog: https://github.com/shirou/gopsutil/compare/v3.22.9...v3.22.10

    Source code(tar.gz)
    Source code(zip)
  • v3.22.9(Oct 1, 2022)

    What's Changed

    disk

    • [disk][linux] Fix for diskusage Ceph mount by @itsties in https://github.com/shirou/gopsutil/pull/1345
    • implement aix nocgo disk usage by @chbuescher in https://github.com/shirou/gopsutil/pull/1341

    process

    • fix(process,windows): compare len(cwd) to an incorrect value by @tienthanh1993 in https://github.com/shirou/gopsutil/pull/1346

    Other Changes

    • Add hostinfo Virtualization hyperv by @johanburati in https://github.com/shirou/gopsutil/pull/1336

    New Contributors

    • @tienthanh1993 made their first contribution in https://github.com/shirou/gopsutil/pull/1346
    • @itsties made their first contribution in https://github.com/shirou/gopsutil/pull/1345
    • @johanburati made their first contribution in https://github.com/shirou/gopsutil/pull/1336

    Full Changelog: https://github.com/shirou/gopsutil/compare/v3.22.7...v3.22.9

    Source code(tar.gz)
    Source code(zip)
  • v3.22.7(Aug 3, 2022)

    What's Changed

    cpu

    • fix(cpu): fix cpu total and busy calc by @shirou in https://github.com/shirou/gopsutil/pull/1325

    disk

    • Replace IOMainPort/IOMasterPort() and kIOMainPortDefault/kIOMasterPortDefault with NULL by @kyz in https://github.com/shirou/gopsutil/pull/1333

    host

    • add neokylin host info on linux by @yyt030 in https://github.com/shirou/gopsutil/pull/1324
    • fix(host,linux): Check if path exists and is nonempty before reading host files by @shirou in https://github.com/shirou/gopsutil/pull/1328
    • host, process: delete darwin/386 code by @tklauser in https://github.com/shirou/gopsutil/pull/1335

    mem

    • mem.VirtualMemory(): wrong page size on darwin arm64 by @kyz in https://github.com/shirou/gopsutil/pull/1334

    net

    • fix(net,linux): fix decodeaddress if Big Endian by @shirou in https://github.com/shirou/gopsutil/pull/1322

    process

    • fix(process,linux): remove trailing multiple \x00 by @shirou in https://github.com/shirou/gopsutil/pull/1326

    Other Changes

    • fix(host,linux): when platform is detected to be 'amazon' cleanup os-release ID by @shirou in https://github.com/shirou/gopsutil/pull/1327
    • feat: add github release.yml by @shirou in https://github.com/shirou/gopsutil/pull/1329
    • Update README with /v3 godoc links and remove deprecated macos-10.15 virtual environment in CI by @Lomanic in https://github.com/shirou/gopsutil/pull/1330

    New Contributors

    • @yyt030 made their first contribution in https://github.com/shirou/gopsutil/pull/1324
    • @kyz made their first contribution in https://github.com/shirou/gopsutil/pull/1334

    Full Changelog: https://github.com/shirou/gopsutil/compare/v3.22.6...v3.22.7

    Source code(tar.gz)
    Source code(zip)
Owner
shirou
shirou
memresolver is an in-memory golang resolver that allows to override current golang Lookup func literals

mem-resolver memresolver is an in-memory golang resolver that allows to override current golang Lookup func literals How to use it Create your custom

Antonio Ojea 4 Jun 23, 2022
Govalid is a data validation library that can validate most data types supported by golang

Govalid is a data validation library that can validate most data types supported by golang. Custom validators can be used where the supplied ones are not enough.

null 61 Apr 22, 2022
Code Generation for Functional Programming, Concurrency and Generics in Golang

goderive goderive derives mundane golang functions that you do not want to maintain and keeps them up to date. It does this by parsing your go code fo

Walter Schulze 1.1k Dec 25, 2022
Golang source code parsing, usage like reflect package

gotype Golang source code parsing, usage like reflect package English 简体中文 Usage API Documentation Examples License Pouch is licensed under the MIT Li

null 52 Dec 9, 2022
Golang library to act on structure fields at runtime. Similar to Python getattr(), setattr(), hasattr() APIs.

go-attr Golang library to act on structure fields at runtime. Similar to Python getattr(), setattr(), hasattr() APIs. This package provides user frien

Shyamsunder Rathi 28 Dec 16, 2022
Composable HTML components in Golang

daz Composable HTML components in Golang Daz is a "functional" alternative to using templates, and allows for nested components/lists Also enables tem

Steve Lacy 192 Oct 3, 2022
Meteoric golang nitro sniper, 0.1/0.5s claim time.

Meteoric golang nitro sniper, 0.1/0.5s claim time.

Azael 298 Apr 3, 2021
Golang bindings for GDAL

Golang bindings for GDAL Goals Godal aims at providing an idiomatic go wrapper around the GDAL library: Function calls return a result and an error.

Airbus DS GEO S.A. 84 Dec 16, 2022
Minimal UART client in Golang that dumps LPC1343 chips that are locked at CRP1.

Howdy y'all, This is a quick and dirty client for the UART bootloader of the LPC1343, and probably other bootloaders in that chip family. This client

Travis Goodspeed 13 Dec 2, 2022
Cross platform locale detection for Golang

go-locale go-locale is a Golang lib for cross platform locale detection. OS Support Support all OS that Golang supported, except android: aix: IBM AIX

Xuanwo 86 Aug 20, 2022
A Go (golang) library for parsing and verifying versions and version constraints.

go-version is a library for parsing versions and version constraints, and verifying versions against a set of constraints. go-version can sort a collection of versions properly, handles prerelease/beta versions, can increment versions, etc.

HashiCorp 1.3k Jan 9, 2023
A port of the parser from graphql-js into golang

gqlparser This is a parser for graphql, written to mirror the graphql-js reference implementation as closely while remaining idiomatic and easy to use

Adam Scarr 402 Dec 27, 2022
Copier for golang, copy value from struct to struct and more

Copier I am a copier, I copy everything from one to another Features Copy from field to field with same name Copy from method to field with same name

Jinzhu 3.9k Jan 8, 2023
A library for diffing golang structures

Diff A library for diffing golang structures and values. Utilizing field tags and reflection, it is able to compare two structures of the same type an

R3 Labs 675 Dec 29, 2022
Use Golang to implement PHP's common built-in functions.

PHP2Go Use Golang to implement PHP's common built-in functions. About 140+ functions have been implemented. Install go get github.com/syyongx/php2go R

syyong.x 1.5k Dec 28, 2022
Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Maxime Soulé 337 Jan 5, 2023
A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Montana Flynn 2.6k Dec 30, 2022
go-sundheit:A library built to provide support for defining service health for golang services

A library built to provide support for defining service health for golang services. It allows you to register async health checks for your dependencies and the service itself, and provides a health endpoint that exposes their status.

AppsFlyer 505 Dec 27, 2022
Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation

stack Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation Purpose Provide a fast, thread safe, and generic Golang Stack API with minim

Brendan Wilson 5 May 3, 2022