Full Code of shirou/gopsutil for AI

master f2a1528f7e15 cached
307 files
868.0 KB
277.2k tokens
3061 symbols
1 requests
Download .txt
Showing preview only (939K chars total). Download the full file or copy to clipboard to get everything.
Repository: shirou/gopsutil
Branch: master
Commit: f2a1528f7e15
Files: 307
Total size: 868.0 KB

Directory structure:
gitextract_q6j6w0jl/

├── .gitattributes
├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   ├── SECURITY.md
│   ├── dependabot.yml
│   ├── labeler.yml
│   ├── release.yml
│   └── workflows/
│       ├── build_test.yml
│       ├── labeler.yml
│       ├── lint.yml
│       ├── release.yml
│       ├── sbom_generator.yml
│       ├── shellcheck.yml
│       └── test.yml
├── .gitignore
├── .golangci.yml
├── LICENSE
├── Makefile
├── README.md
├── common/
│   └── env.go
├── cpu/
│   ├── cpu.go
│   ├── cpu_aix.go
│   ├── cpu_aix_cgo.go
│   ├── cpu_aix_nocgo.go
│   ├── cpu_darwin.go
│   ├── cpu_darwin_arm64.go
│   ├── cpu_darwin_fallback.go
│   ├── cpu_darwin_test.go
│   ├── cpu_dragonfly.go
│   ├── cpu_dragonfly_amd64.go
│   ├── cpu_fallback.go
│   ├── cpu_freebsd.go
│   ├── cpu_freebsd_386.go
│   ├── cpu_freebsd_amd64.go
│   ├── cpu_freebsd_arm.go
│   ├── cpu_freebsd_arm64.go
│   ├── cpu_freebsd_test.go
│   ├── cpu_linux.go
│   ├── cpu_linux_test.go
│   ├── cpu_netbsd.go
│   ├── cpu_netbsd_amd64.go
│   ├── cpu_netbsd_arm.go
│   ├── cpu_netbsd_arm64.go
│   ├── cpu_openbsd.go
│   ├── cpu_openbsd_386.go
│   ├── cpu_openbsd_amd64.go
│   ├── cpu_openbsd_arm.go
│   ├── cpu_openbsd_arm64.go
│   ├── cpu_openbsd_riscv64.go
│   ├── cpu_plan9.go
│   ├── cpu_plan9_test.go
│   ├── cpu_solaris.go
│   ├── cpu_solaris_test.go
│   ├── cpu_test.go
│   ├── cpu_windows.go
│   └── testdata/
│       ├── aix/
│       │   ├── prtconf
│       │   ├── sar-u-PALL101
│       │   └── sar-u101
│       ├── freebsd/
│       │   ├── 1cpu_2core.txt
│       │   ├── 1cpu_4core.txt
│       │   └── 2cpu_4core.txt
│       ├── linux/
│       │   ├── 1037/
│       │   │   └── proc/
│       │   │       └── cpuinfo
│       │   ├── 1958/
│       │   │   └── proc/
│       │   │       └── cpuinfo
│       │   ├── 424/
│       │   │   └── proc/
│       │   │       └── stat
│       │   └── times_empty/
│       │       └── proc/
│       │           └── stat
│       ├── plan9/
│       │   └── 2cores/
│       │       ├── dev/
│       │       │   ├── cputype
│       │       │   ├── sysstat
│       │       │   └── time
│       │       └── proc/
│       │           ├── 1/
│       │           │   └── status
│       │           ├── 331/
│       │           │   └── .gitkeep
│       │           ├── 54384/
│       │           │   └── status
│       │           ├── 54412/
│       │           │   └── status
│       │           └── 72/
│       │               └── status
│       └── solaris/
│           ├── 1cpu_1core_isainfo.txt
│           ├── 1cpu_1core_psrinfo.txt
│           ├── 2cpu_12core_isainfo.txt
│           ├── 2cpu_12core_psrinfo.txt
│           ├── 2cpu_1core_isainfo.txt
│           ├── 2cpu_1core_psrinfo.txt
│           ├── 2cpu_8core_isainfo.txt
│           └── 2cpu_8core_psrinfo.txt
├── disk/
│   ├── disk.go
│   ├── disk_aix.go
│   ├── disk_aix_cgo.go
│   ├── disk_aix_nocgo.go
│   ├── disk_darwin.go
│   ├── disk_fallback.go
│   ├── disk_freebsd.go
│   ├── disk_freebsd_386.go
│   ├── disk_freebsd_amd64.go
│   ├── disk_freebsd_arm.go
│   ├── disk_freebsd_arm64.go
│   ├── disk_linux.go
│   ├── disk_linux_test.go
│   ├── disk_netbsd.go
│   ├── disk_netbsd_amd64.go
│   ├── disk_netbsd_arm.go
│   ├── disk_netbsd_arm64.go
│   ├── disk_openbsd.go
│   ├── disk_openbsd_386.go
│   ├── disk_openbsd_amd64.go
│   ├── disk_openbsd_arm.go
│   ├── disk_openbsd_arm64.go
│   ├── disk_openbsd_riscv64.go
│   ├── disk_solaris.go
│   ├── disk_test.go
│   ├── disk_unix.go
│   ├── disk_windows.go
│   ├── disk_windows_test.go
│   ├── types_freebsd.go
│   ├── types_netbsd.go
│   └── types_openbsd.go
├── doc.go
├── docker/
│   ├── docker.go
│   ├── docker_linux.go
│   ├── docker_linux_test.go
│   ├── docker_notlinux.go
│   └── main_test.go
├── go.mod
├── go.sum
├── host/
│   ├── freebsd_headers/
│   │   └── utxdb.h
│   ├── host.go
│   ├── host_aix.go
│   ├── host_aix_cgo.go
│   ├── host_aix_nocgo.go
│   ├── host_aix_ppc64.go
│   ├── host_aix_test.go
│   ├── host_bsd.go
│   ├── host_darwin.go
│   ├── host_darwin_amd64.go
│   ├── host_darwin_arm64.go
│   ├── host_fallback.go
│   ├── host_freebsd.go
│   ├── host_freebsd_386.go
│   ├── host_freebsd_amd64.go
│   ├── host_freebsd_arm.go
│   ├── host_freebsd_arm64.go
│   ├── host_linux.go
│   ├── host_linux_386.go
│   ├── host_linux_amd64.go
│   ├── host_linux_arm.go
│   ├── host_linux_arm64.go
│   ├── host_linux_loong64.go
│   ├── host_linux_mips.go
│   ├── host_linux_mips64.go
│   ├── host_linux_mips64le.go
│   ├── host_linux_mipsle.go
│   ├── host_linux_ppc64.go
│   ├── host_linux_ppc64le.go
│   ├── host_linux_riscv64.go
│   ├── host_linux_s390x.go
│   ├── host_linux_test.go
│   ├── host_netbsd.go
│   ├── host_openbsd.go
│   ├── host_openbsd_386.go
│   ├── host_openbsd_amd64.go
│   ├── host_openbsd_arm.go
│   ├── host_openbsd_arm64.go
│   ├── host_openbsd_riscv64.go
│   ├── host_posix.go
│   ├── host_solaris.go
│   ├── host_test.go
│   ├── host_windows.go
│   ├── testdata/
│   │   └── linux/
│   │       └── lsbStruct/
│   │           ├── arch/
│   │           │   └── lsb-release
│   │           └── ubuntu_22_04/
│   │               └── lsb-release
│   ├── types_darwin.go
│   ├── types_freebsd.go
│   ├── types_linux.go
│   └── types_openbsd.go
├── internal/
│   └── common/
│       ├── common.go
│       ├── common_aix.go
│       ├── common_aix_test.go
│       ├── common_darwin.go
│       ├── common_freebsd.go
│       ├── common_linux.go
│       ├── common_netbsd.go
│       ├── common_openbsd.go
│       ├── common_test.go
│       ├── common_unix.go
│       ├── common_windows.go
│       ├── endian.go
│       ├── readlink_linux.go
│       ├── sleep.go
│       ├── sleep_test.go
│       ├── warnings.go
│       └── warnings_test.go
├── load/
│   ├── load.go
│   ├── load_aix.go
│   ├── load_aix_cgo.go
│   ├── load_aix_nocgo.go
│   ├── load_bsd.go
│   ├── load_darwin.go
│   ├── load_fallback.go
│   ├── load_freebsd.go
│   ├── load_linux.go
│   ├── load_openbsd.go
│   ├── load_solaris.go
│   ├── load_test.go
│   └── load_windows.go
├── mem/
│   ├── ex_linux.go
│   ├── ex_windows.go
│   ├── mem.go
│   ├── mem_aix.go
│   ├── mem_aix_cgo.go
│   ├── mem_aix_nocgo.go
│   ├── mem_bsd.go
│   ├── mem_bsd_test.go
│   ├── mem_darwin.go
│   ├── mem_darwin_test.go
│   ├── mem_fallback.go
│   ├── mem_freebsd.go
│   ├── mem_linux.go
│   ├── mem_linux_test.go
│   ├── mem_netbsd.go
│   ├── mem_openbsd.go
│   ├── mem_openbsd_386.go
│   ├── mem_openbsd_amd64.go
│   ├── mem_openbsd_arm.go
│   ├── mem_openbsd_arm64.go
│   ├── mem_openbsd_riscv64.go
│   ├── mem_plan9.go
│   ├── mem_plan9_test.go
│   ├── mem_solaris.go
│   ├── mem_solaris_test.go
│   ├── mem_test.go
│   ├── mem_windows.go
│   ├── testdata/
│   │   ├── linux/
│   │   │   └── virtualmemory/
│   │   │       ├── anonhugepages/
│   │   │       │   └── proc/
│   │   │       │       └── meminfo
│   │   │       ├── intelcorei5/
│   │   │       │   └── proc/
│   │   │       │       └── meminfo
│   │   │       └── issue1002/
│   │   │           └── proc/
│   │   │               └── meminfo
│   │   └── plan9/
│   │       └── virtualmemory/
│   │           └── dev/
│   │               └── swap
│   └── types_openbsd.go
├── mktypes.sh
├── net/
│   ├── net.go
│   ├── net_aix.go
│   ├── net_aix_cgo.go
│   ├── net_aix_nocgo.go
│   ├── net_darwin.go
│   ├── net_darwin_test.go
│   ├── net_fallback.go
│   ├── net_freebsd.go
│   ├── net_linux.go
│   ├── net_linux_test.go
│   ├── net_openbsd.go
│   ├── net_solaris.go
│   ├── net_test.go
│   ├── net_unix.go
│   ├── net_windows.go
│   └── types_darwin.go
├── process/
│   ├── process.go
│   ├── process_bsd.go
│   ├── process_darwin.go
│   ├── process_darwin_amd64.go
│   ├── process_darwin_arm64.go
│   ├── process_darwin_test.go
│   ├── process_fallback.go
│   ├── process_freebsd.go
│   ├── process_freebsd_386.go
│   ├── process_freebsd_amd64.go
│   ├── process_freebsd_arm.go
│   ├── process_freebsd_arm64.go
│   ├── process_linux.go
│   ├── process_linux_test.go
│   ├── process_openbsd.go
│   ├── process_openbsd_386.go
│   ├── process_openbsd_amd64.go
│   ├── process_openbsd_arm.go
│   ├── process_openbsd_arm64.go
│   ├── process_openbsd_riscv64.go
│   ├── process_plan9.go
│   ├── process_posix.go
│   ├── process_posix_test.go
│   ├── process_race_test.go
│   ├── process_solaris.go
│   ├── process_test.go
│   ├── process_windows.go
│   ├── process_windows_32bit.go
│   ├── process_windows_64bit.go
│   ├── testdata/
│   │   ├── linux/
│   │   │   ├── 1/
│   │   │   │   ├── comm
│   │   │   │   ├── smaps
│   │   │   │   └── status
│   │   │   ├── 1060/
│   │   │   │   ├── comm
│   │   │   │   └── status
│   │   │   ├── 23819/
│   │   │   │   ├── comm
│   │   │   │   └── status
│   │   │   └── 68927/
│   │   │       ├── comm
│   │   │       └── stat
│   │   └── lx_brandz/
│   │       └── 1/
│   │           └── stat
│   ├── types_darwin.go
│   ├── types_freebsd.go
│   └── types_openbsd.go
├── sensors/
│   ├── ex_linux.go
│   ├── sensors.go
│   ├── sensors_aix.go
│   ├── sensors_darwin.go
│   ├── sensors_darwin_arm64.go
│   ├── sensors_fallback.go
│   ├── sensors_freebsd.go
│   ├── sensors_linux.go
│   ├── sensors_netbsd.go
│   ├── sensors_openbsd.go
│   ├── sensors_solaris.go
│   ├── sensors_test.go
│   └── sensors_windows.go
├── windows_memo.rst
└── winservices/
    ├── manager.go
    └── winservices.go

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitattributes
================================================
# ensure that line endings for Windows builds are properly formatted
# see https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#how-to-use
# at "Multiple OS Example" section
*.go text eol=lf


================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: shirou


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve gopsutil

---

**Describe the bug**
[A clear and concise description of what the bug is.]

**To Reproduce**
```go
// paste example code reproducing the bug you are reporting
```

**Expected behavior**
[A clear and concise description of what you expected to happen.]

**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`]
 - [ ] 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`]


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for gopsutil

---

**Is your feature request related to a problem? Please describe.**
[A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]]

**Describe the solution you'd like**
[A clear and concise description of what you want to happen.]

**Describe alternatives you've considered**
[A clear and concise description of any alternative solutions or features you've considered.]

**Additional context**
[Add any other context or screenshots about the feature request here.]


================================================
FILE: .github/SECURITY.md
================================================
# Security Policy

## Supported Versions

Security updates are applied only to the latest release.

## Reporting a Vulnerability

If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.

Please disclose it at [Security Advisories](https://github.com/shirou/gopsutil/security/advisories/new).

This project is maintained by a team of volunteers on a reasonable-effort basis. As such, vulnerability reports will be investigated and fixed or disclosed as soon as possible.


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: gomod
  directory: /
  schedule:
    interval: daily
- package-ecosystem: github-actions
  directory: /
  schedule:
    interval: daily


================================================
FILE: .github/labeler.yml
================================================
'package:cpu':
  - changed-files:
    - any-glob-to-any-file:
      - 'cpu/**'

'package:disk':
  - changed-files:
    - any-glob-to-any-file:
      - 'disk/**'

'package:docker':
  - changed-files:
    - any-glob-to-any-file:
      - 'docker/**'

'package:host':
  - changed-files:
    - any-glob-to-any-file:
      - 'host/**'

'package:load':
  - changed-files:
    - any-glob-to-any-file:
      - 'load/**'

'package:mem':
  - changed-files:
    - any-glob-to-any-file:
      - 'mem/**'

'package:net':
  - changed-files:
    - any-glob-to-any-file:
      - 'net/**'

'package:process':
  - changed-files:
    - any-glob-to-any-file:
      - 'process/**'

'package:sensors':
  - changed-files:
    - any-glob-to-any-file:
      - 'sensors/**'

'package:winservices':
  - changed-files:
    - any-glob-to-any-file:
      - 'winservices/**'

'os:linux':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_linux.go'
      - '**/*_linux_mips64.go'
      - '**/*_linux_386.go'
      - '**/*_linux_test.go'
      - '**/*_linux_s390x.go'
      - '**/*_linux_amd64.go'
      - '**/*_linux_arm64.go'
      - '**/*_linux_arm.go'
      - '**/*_posix.go'

'os:freebsd':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_freebsd.go'
      - '**/*_freebsd_386.go'
      - '**/*_freebsd_test.go'
      - '**/*_freebsd_amd64.go'
      - '**/*_freebsd_arm64.go'
      - '**/*_freebsd_arm.go'
      - '**/*_bsd.go'
      - '**/*_posix.go'

'os:darwin':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_darwin.go'
      - '**/*_darwin_386.go'
      - '**/*_darwin_test.go'
      - '**/*_darwin_amd64.go'
      - '**/*_darwin_arm64.go'
      - '**/*_posix.go'

'os:openbsd':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_openbsd.go'
      - '**/*_openbsd_386.go'
      - '**/*_openbsd_test.go'
      - '**/*_openbsd_amd64.go'
      - '**/*_openbsd_arm64.go'
      - '**/*_openbsd_arm.go'
      - '**/*_bsd.go'
      - '**/*_posix.go'

'os:windows':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_windows.go'
      - '**/*_windows_386.go'
      - '**/*_windows_test.go'
      - '**/*_windows_amd64.go'
      - '**/*_windows_32bit.go'
      - '**/*_windows_64bit.go'

'os:solaris':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_solaris.go'
      - '**/*_posix.go'

'os:aix':
  - changed-files:
    - any-glob-to-any-file:
      - '**/*_aix.go'
      - '**/*_aix_test.go'
      - '**/*_aix_*.go'
      - '**/*_posix.go'


================================================
FILE: .github/release.yml
================================================
changelog:
  exclude:
    labels:
      - ignore-for-release
      - dependencies
    authors:
      - dependabot[bot]
  categories:
    - title: "cpu"
      labels:
        - "package:cpu"
    - title: "disk"
      labels:
        - "package:disk"
    - title: "docker"
      labels:
        - "package:docker"
    - title: "host"
      labels:
        - "package:host"
    - title: "load"
      labels:
        - "package:load"
    - title: "mem"
      labels:
        - "package:mem"
    - title: "net"
      labels:
        - "package:net"
    - title: "process"
      labels:
        - "package:process"
    - title: "winservices"
      labels:
        - "package:winservices"
    - title: Other Changes
      labels:
        - "*"

================================================
FILE: .github/workflows/build_test.yml
================================================
name: Build Test

on:
  push:
    branches:
      - master
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  go-versions:
    runs-on: ubuntu-latest
    outputs:
      versions: ${{ steps.versions.outputs.value }}
    steps:
      - id: versions
        run: |
          versions=$(curl -s 'https://go.dev/dl/?mode=json' | jq -c 'map(.version[2:])')
          echo "value=${versions}"  >> $GITHUB_OUTPUT
  build_test:
    needs: go-versions
    strategy:
      fail-fast: false
      matrix:
        go-version: ${{fromJson(needs.go-versions.outputs.versions)}}
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Install Go
        uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
        with:
          go-version: ${{ matrix.go-version }}
      - name: Build Test v3
        run: |
          make build_test


================================================
FILE: .github/workflows/labeler.yml
================================================
name: "Pull Request Labeler"

on:
  pull_request_target:

permissions:
  contents: read

jobs:
  triage:
    permissions:
      contents: read  # for actions/labeler to determine modified files
      pull-requests: write  # for actions/labeler to add labels to PRs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"


================================================
FILE: .github/workflows/lint.yml
================================================
name: Golangci-lint

on:
  push:
    branches:
      - master
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  golangci:
    strategy:
      fail-fast: false
      matrix:
        include:
          - {os: macos-latest, CGO_ENABLED: "0", GOOS: darwin, GOARCH: amd64}
          - {os: macos-latest, CGO_ENABLED: "1", GOOS: darwin, GOARCH: amd64}
          - {os: macos-latest, CGO_ENABLED: "0", GOOS: darwin, GOARCH: arm64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: aix, GOARCH: ppc64}
#          - {os: ubuntu-latest, CGO_ENABLED: "1", GOOS: aix, GOARCH: ppc64} # FIXME
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: dragonfly, GOARCH: amd64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: freebsd, GOARCH: amd64}
#          - {os: ubuntu-latest, CGO_ENABLED: "1", GOOS: freebsd, GOARCH: amd64} # FIXME
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: freebsd, GOARCH: 386}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: freebsd, GOARCH: arm}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: 386}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: amd64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: arm64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: arm}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: loong64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: mips64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: mips64le}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: mips}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: mipsle}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: ppc64le}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: ppc64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: riscv64}
#          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: linux, GOARCH: s390x} # FIXME
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: netbsd, GOARCH: amd64}
          - {os: ubuntu-latest, CGO_ENABLED: "1", GOOS: netbsd, GOARCH: amd64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: openbsd, GOARCH: 386}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: openbsd, GOARCH: amd64}
#          - {os: ubuntu-latest, CGO_ENABLED: "1", GOOS: openbsd, GOARCH: amd64} # FIXME
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: plan9, GOARCH: amd64}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: plan9, GOARCH: 386}
          - {os: ubuntu-latest, CGO_ENABLED: "0", GOOS: solaris, GOARCH: amd64}
          - {os: windows-latest, CGO_ENABLED: "0", GOOS: windows, GOARCH: amd64}
          - {os: windows-latest, CGO_ENABLED: "0", GOOS: windows, GOARCH: 386}
    permissions:
      contents: read  # for actions/checkout to fetch code
      pull-requests: read  # for golangci/golangci-lint-action to fetch pull requests
    name: lint
    runs-on: ${{ matrix.os }}
    env:
      CGO_ENABLED: "${{ matrix.CGO_ENABLED }}"
      GOARCH: ${{ matrix.GOARCH }}
      GOOS: ${{ matrix.GOOS }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Setup go
        uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
        with:
          go-version-file: go.mod
      - name: Setup golangci-lint
        uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9  # v8.0.0
        with:
          args: --verbose
          version: latest


================================================
FILE: .github/workflows/release.yml
================================================
name: Release

on:
  schedule:
    - cron: '0 1 1 * *'  # UTC 01:00 on the first day of the Month

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Release
        run: make release


================================================
FILE: .github/workflows/sbom_generator.yml
================================================
name: SBOM Generator

on:
  push:
    branches: 
      - master
  workflow_dispatch:

permissions: read-all

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: advanced-security/sbom-generator-action@6fe43abf522b2e7a19bc769aec1e6c848614b517 # v0.0.2
        id: sbom
        env: 
          GITHUB_TOKEN: ${{ github.token }}
      - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
        with: 
          path: ${{steps.sbom.outputs.fileName }}
          name: "SBOM"


================================================
FILE: .github/workflows/shellcheck.yml
================================================
name: Shellcheck

on:
  push:
    branches:
      - master
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  shellcheck:
    name: Shellcheck
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Run ShellCheck
        uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0


================================================
FILE: .github/workflows/test.yml
================================================
name: Test

on:
  push:
    branches:
      - master
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  go-versions:
    runs-on: ubuntu-latest
    outputs:
      versions: ${{ steps.versions.outputs.value }}
    steps:
      - id: versions
        run: |
          versions=$(curl -s 'https://go.dev/dl/?mode=json' | jq -c 'map(.version[2:])')
          echo "value=${versions}"  >> $GITHUB_OUTPUT
  test:
    needs: go-versions
    strategy:
      fail-fast: false
      matrix:
        go-version: ${{fromJson(needs.go-versions.outputs.versions)}}
        os:
          - ubuntu-24.04
          - ubuntu-22.04
          - macos-26
          - macos-15
          - macos-15-intel
          - macos-14
          - windows-2025
          - windows-2022
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Install Go
        uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
        with:
          go-version: ${{ matrix.go-version }}
      - name: Test
        run: |
          go test -coverprofile='coverage.out' -covermode=atomic ./...


================================================
FILE: .gitignore
================================================
*~
#*
_obj
*.tmp
.idea
vendor


================================================
FILE: .golangci.yml
================================================
version: "2"
formatters:
  enable:
    - gci
    - gofumpt
  settings:
    gci:
      sections:
        - standard
        - default
        - prefix(github.com/shirou)
issues:
  max-same-issues: 0
linters:
  enable:
    - asciicheck
    - contextcheck
    - durationcheck
    - errorlint
    - fatcontext
    - gocritic
    - gomodguard
    - gosec
    - govet
    - importas
    - ineffassign
    - misspell
    - nakedret
    - nilnesserr
    - noctx
    - nolintlint
    - perfsprint
    - predeclared
    - revive
    - staticcheck
    - testifylint
    - thelper
    - unparam
    - usetesting
  disable:
    - errcheck
    - unused
  settings:
    gocritic:
      disabled-checks:
        - captLocal
        - commentedOutCode
        - deferInLoop
        - hexLiteral
        - hugeParam
        - tooManyResultsChecker
        - unnamedResult
      enable-all: true
    gomodguard:
      blocked:
        modules:
          - io/ioutil:
              recommendations:
                - io
                - os
    gosec:
      excludes:
        - G115
    govet:
      disable:
        - copylocks
        - fieldalignment
        - testinggoroutine
      enable-all: true
    perfsprint:
      # Optimizes even if it requires an int or uint type cast.
      int-conversion: true
      # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
      err-error: true
      # Optimizes `fmt.Errorf`.
      errorf: true
      # Optimizes `fmt.Sprintf` with only one argument.
      sprintf1: true
      # Optimizes into strings concatenation.
      strconcat: true
    revive:
      rules:
        - name: blank-imports
        - name: context-as-argument
          arguments:
            - allowTypesBefore: "*testing.T"
        - name: context-keys-type
        - name: dot-imports
        - name: duplicated-imports
        - name: early-return
          arguments:
            - "preserveScope"
        - name: empty-block
          disabled: true
        - name: error-naming
        - name: error-return
        - name: error-strings
        - name: exported
          disabled: true
        - name: errorf
        - name: increment-decrement
        - name: indent-error-flow
          arguments:
            - "preserveScope"
        - name: range
        - name: receiver-naming
        - name: redefines-builtin-id
        - name: redundant-import-alias
        - name: superfluous-else
          arguments:
            - "preserveScope"
        - name: time-date
        - name: time-equal
        - name: time-naming
        - name: unexported-return
        - name: unnecessary-stmt
        - name: unreachable-code
        - name: unused-parameter
        - name: unused-receiver
        - name: use-any
        - name: var-declaration
        - name: var-naming
          arguments:
            - ["ID"] # AllowList
            - ["VM"] # DenyList
            - - upperCaseConst: true # Extra parameter (upperCaseConst|skipPackageNameChecks)
                skipPackageNameChecks: true
    staticcheck:
      checks:
        - all
        - -SA1019 # Using a deprecated function, variable, constant or field
        - -SA2002 # Called testing.T.FailNow or SkipNow in a goroutine, which isn’t allowed
        - -SA4003 # Comparing unsigned values against negative values is pointless
        - -SA4004 # The loop exits unconditionally after one iteration
        - -SA4008 # The variable in the loop condition never changes, are you incrementing the wrong variable?
        - -SA5003 # Defers in infinite loops will never execute
        - -SA9003 # Empty body in an if or else branch
        - -ST1003 # Poorly chosen identifier
    testifylint:
      enable-all: true
    usetesting:
      os-create-temp: false
      os-mkdir-temp: false
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - text: 'shadow: declaration of "err" shadows declaration at line'
        linters:
          - govet
    warn-unused: true
output:
  show-stats: false
run:
  timeout: 5m


================================================
FILE: LICENSE
================================================
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 gopsutil 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.


-------
internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go.



Copyright (c) 2009 The Go Authors. 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 Google Inc. 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.

================================================
FILE: Makefile
================================================
.PHONY: help check
.DEFAULT_GOAL := help

SUBPKGS=cpu disk docker host internal load mem net process

help:  ## Show help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

check:  ## Check
	errcheck -ignore="Close|Run|Write" ./...
	golint ./... | egrep -v 'underscores|HttpOnly|should have comment|comment on exported|CamelCase|VM|UID' && exit 1 || exit 0

BUILD_FAIL_PATTERN=grep -v "exec format error" | grep "build failed" && exit 1 || exit 0
build_test:  ## test only buildable
	# Supported operating systems
	GOOS=linux GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=loong64 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=riscv64 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=s390x go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=linux GOARCH=mips go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=freebsd GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=freebsd GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=freebsd GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
	CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=windows go test ./... | $(BUILD_FAIL_PATTERN)
	# The following operating systems are tested only for successful builds.
	# Value testing is not performed.
	GOOS=solaris go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=dragonfly go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=openbsd go test ./... | $(BUILD_FAIL_PATTERN)
	GOOS=plan9 go test ./... | $(BUILD_FAIL_PATTERN)
	CGO_ENABLED=0 GOOS=aix GOARCH=ppc64  go test ./... | $(BUILD_FAIL_PATTERN)

ifeq ($(shell uname -s), Darwin)
	CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
endif
	@echo 'Successfully built on all known operating systems'

vet:
	GOOS=darwin GOARCH=amd64 go vet ./...
	GOOS=darwin GOARCH=arm64 go vet ./...

	GOOS=dragonfly GOARCH=amd64 go vet ./...

	GOOS=freebsd GOARCH=amd64 go vet ./...
	GOOS=freebsd GOARCH=386 go vet ./...
	GOOS=freebsd GOARCH=arm go vet ./...

	GOOS=linux GOARCH=386 go vet ./...
	GOOS=linux GOARCH=amd64 go vet ./...
	GOOS=linux GOARCH=arm64 go vet ./...
	GOOS=linux GOARCH=arm go vet ./...
	GOOS=linux GOARCH=loong64 go vet ./...
	GOOS=linux GOARCH=mips64 go vet ./...
	GOOS=linux GOARCH=mips64le go vet ./...
	GOOS=linux GOARCH=mips go vet ./...
	GOOS=linux GOARCH=mipsle go vet ./...
	GOOS=linux GOARCH=ppc64le go vet ./...
	GOOS=linux GOARCH=ppc64 go vet ./...
	GOOS=linux GOARCH=riscv64 go vet ./...
	GOOS=linux GOARCH=s390x go vet ./...

	GOOS=netbsd GOARCH=amd64 go vet ./...

	GOOS=openbsd GOARCH=386 go vet ./...
	GOOS=openbsd GOARCH=amd64 go vet ./...

	GOOS=solaris GOARCH=amd64 go vet ./...

	GOOS=windows GOARCH=amd64 go vet ./...
	GOOS=windows GOARCH=386 go vet ./...

	GOOS=plan9 GOARCH=amd64 go vet ./...
	GOOS=plan9 GOARCH=386 go vet ./...

	CGO_ENABLED=0 GOOS=aix GOARCH=ppc64 go vet ./...

macos_test:
	CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
	CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)

init_tools:
	go get github.com/golang/dep/cmd/dep

TAG=$(shell date +'v4.%y.%-m' --date='last Month')

release:
	git tag $(TAG)
	git push origin $(TAG)


================================================
FILE: README.md
================================================
# gopsutil: psutil for Go

[![Test](https://github.com/shirou/gopsutil/actions/workflows/test.yml/badge.svg)](https://github.com/shirou/gopsutil/actions/workflows/test.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/shirou/gopsutil/v4.svg)](https://pkg.go.dev/github.com/shirou/gopsutil/v4) [![Calendar Versioning](https://img.shields.io/badge/calver-vMAJOR.YY.MM-22bfda.svg)](https://calver.org/)

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

## migration

### v4 migration

There are some breaking changes. Please see [v4 release note](https://github.com/shirou/gopsutil/releases/tag/v4.24.5).

## Tag semantics

gopsutil tag policy is almost same as Semantic Versioning, but
automatically increases like [Ubuntu versioning](https://calver.org/).

For example, v4.24.04 means

- v4: major version
- 24: release year, 2024
- 04: release month

gopsutil aims to keep backwards compatibility until major version change.

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

## Available Architectures

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

These have 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 structs to Go structs.

## Usage

```go
package main

import (
    "fmt"

    "github.com/shirou/gopsutil/v4/mem"
)

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 alternative locations for various system directories by using the following environment variables:

- /proc: `HOST_PROC`
- /sys: `HOST_SYS`
- /etc: `HOST_ETC`
- /var: `HOST_VAR`
- /run: `HOST_RUN`
- /dev: `HOST_DEV`
- /: `HOST_ROOT`
- /proc/N/mountinfo: `HOST_PROC_MOUNTINFO`

### Adding settings using `context` (from v3.23.6)

As of v3.23.6, it is now possible to pass a path location using `context`: import `"github.com/shirou/gopsutil/v3/common"` and pass a context with `common.EnvMap` set to `common.EnvKey`, and the location will be used within each function.

```
	ctx := context.WithValue(context.Background(), 
		common.EnvKey, common.EnvMap{common.HostProcEnvKey: "/myproc"},
	)
	v, err := mem.VirtualMemoryWithContext(ctx)
```

First priority is given to the value set in `context`, then the value from the environment variable, and finally the default location.

### Caching

As of v3.24.1, it is now possible to cached some values. These values default to false, not cached. 

Be very careful that enabling the cache may cause inconsistencies. For example, if you enable caching of boottime on Linux, be aware that unintended values may be returned if [the boottime is changed by NTP after booted](https://github.com/shirou/gopsutil/issues/1070#issuecomment-842512782).

- `host`
  - EnableBootTimeCache
- `process`
  - EnableBootTimeCache

### `Ex` struct (from v4.24.5)

gopsutil is designed to work across multiple platforms. However, there are differences in the information available on different platforms, such as memory information that exists on Linux but not on Windows.

As of v4.24.5, to access this platform-specific information, gopsutil provides functions named `Ex` within the package. Currently, these functions are available in the mem and sensor packages.

The Ex structs are specific to each platform. For example, on Linux, there is an `ExLinux` struct, which can be obtained using the `mem.NewExLinux()` function. On Windows, it's `mem.ExWindows()`. These Ex structs provide platform-specific information.

```
ex := NewExWindows()
v, err := ex.VirtualMemory()
if err != nil {
    panic(err)
}

fmt.Println(v.VirtualAvail)
fmt.Println(v.VirtualTotal)

// Output:
// 140731958648832
// 140737488224256
```

gopsutil aims to minimize platform differences by offering common functions. However, there are many requests to obtain unique information for each platform. The Ex structs are designed to meet those requests. Additional functionalities might be added in the future. The use of these structures makes it clear that the information they provide is specific to each platform, which is why they have been designed in this way.

## Documentation

See https://pkg.go.dev/github.com/shirou/gopsutil/v4 or https://godocs.io/github.com/shirou/gopsutil/v4

## Requirements

- go1.18 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
  - Label (linux only) The registered [device mapper
    name](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block-dm)
- 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/Avg() (linux, freebsd, solaris)
  - 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 code is ported from Ohai. Many thanks.

## Current Status

- x: works
- b: almost works, but something is broken

|name                  |Linux  |FreeBSD  |OpenBSD  |macOS   |Windows  |Solaris  |Plan 9   |AIX      |
|----------------------|-------|---------|---------|--------|---------|---------|---------|---------|
|cpu\_times            |x      |x        |x        |x       |x        |         |b        |x        |
|cpu\_count            |x      |x        |x        |x       |x        |         |x        |x        |
|cpu\_percent          |x      |x        |x        |x       |x        |         |         |x        |
|cpu\_times\_percent   |x      |x        |x        |x       |x        |         |         |x        |
|virtual\_memory       |x      |x        |x        |x       |x        |b        |x        |x        |
|swap\_memory          |x      |x        |x        |x       |         |         |x        |X        |
|disk\_partitions      |x      |x        |x        |x       |x        |         |         |x        |
|disk\_io\_counters    |x      |x        |x        |x       |x        |         |         |         |
|disk\_usage           |x      |x        |x        |x       |x        |         |         |x        |
|net\_io\_counters     |x      |x        |x        |b       |x        |x        |         |         |
|boot\_time            |x      |x        |x        |x       |x        |         |         |X        |
|users                 |x      |x        |x        |x       |x        |         |         |x        |
|pids                  |x      |x        |x        |x       |x        |         |         |         |
|pid\_exists           |x      |x        |x        |x       |x        |         |         |         |
|net\_connections      |x      |x        |x        |x       |         |         |         |x        |
|net\_protocols        |x      |         |         |        |         |         |         |x        |
|net\_if\_addrs        |       |         |         |        |         |         |         |x        |
|net\_if\_stats        |       |         |         |        |         |         |         |x        |
|netfilter\_conntrack  |x      |         |         |        |         |         |         |         |
|sensors_temperature   |x      |         |         |x       |x        |x        |         |         |


### Process class

|name                |Linux  |FreeBSD  |OpenBSD  |macOS  |Windows  |
|--------------------|-------|---------|---------|-------|---------|
|pid                 |x      |x        |x        |x      |x        |
|ppid                |x      |x        |x        |x      |x        |
|name                |x      |x        |x        |x      |x        |
|cmdline             |x      |x        |x        |x      |x        |
|create\_time        |x      |         |         |x      |x        |
|status              |x      |x        |x        |x      |         |
|cwd                 |x      |x        |x        |x      |x        |
|exe                 |x      |x        |x        |       |x        |
|uids                |x      |x        |x        |x      |         |
|gids                |x      |x        |x        |x      |         |
|terminal            |x      |x        |x        |       |         |
|io\_counters        |x      |x        |x        |       |x        |
|nice                |x      |x        |x        |x      |x        |
|num\_fds            |x      |         |         |x      |x        |
|num\_ctx\_switches  |x      |         |         |       |         |
|num\_threads        |x      |x        |x        |x      |x        |
|cpu\_times          |x      |         |         |       |x        |
|memory\_info        |x      |x        |x        |x      |x        |
|memory\_maps        |x      |         |         |       |         |
|open\_files         |x      |         |         |       |x        |
|send\_signal        |x      |x        |x        |x      |         |
|suspend             |x      |x        |x        |x      |x        |
|resume              |x      |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      |x        |
|cpu\_affinity       |       |         |         |       |         |
|memory\_percent     |x      |         |         |       |x        |
|parent              |x      |         |x        |x      |x        |
|children            |x      |x        |x        |x      |x        |
|connections         |x      |         |x        |x      |         |
|is\_running         |       |         |         |       |         |
|page\_faults        |x      |         |         |       |x        |

### gopsutil Original Metrics

|item                    |Linux  |FreeBSD  |OpenBSD  |macOS   |Windows |Solaris  |AIX      |
|------------------------|-------|---------|---------|--------|--------|---------|---------|
|**HostInfo**            |       |         |         |        |        |         |         |
|hostname                |x      |x        |x        |x       |x       |x        |X        |
|uptime                  |x      |x        |x        |x       |        |x        |x        |
|process                 |x      |x        |x        |        |        |x        |         |
|os                      |x      |x        |x        |x       |x       |x        |x        |
|platform                |x      |x        |x        |x       |        |x        |x        |
|platformfamily          |x      |x        |x        |x       |        |x        |x        |
|virtualization          |x      |         |         |        |        |         |         |
|**CPU**                 |       |         |         |        |        |         |         |
|VendorID                |x      |x        |x        |x       |x       |x        |x        |
|Family                  |x      |x        |x        |x       |x       |x        |x        |
|Model                   |x      |x        |x        |x       |x       |x        |x        |
|Stepping                |x      |x        |x        |x       |x       |x        |         |
|PhysicalID              |x      |         |         |        |        |x        |         |
|CoreID                  |x      |         |         |        |        |x        |         |
|Cores                   |x      |         |         |x       |x       |x        |x        |
|ModelName               |x      |x        |x        |x       |x       |x        |x        |
|Microcode               |x      |         |         |        |        |x        |         |
|**LoadAvg**             |       |         |         |        |        |         |         |
|Load1                   |x      |x        |x        |x       |x       |x        |x        |
|Load5                   |x      |x        |x        |x       |x       |x        |x        |
|Load15                  |x      |x        |x        |x       |x       |x        |x        |
|**Docker GetDockerID**  |       |         |         |        |        |         |         |
|container id            |x      |no       |no       |no      |no      |no       |no       |
|**Docker CgroupsCPU**   |       |         |         |        |        |         |         |
|user                    |x      |no       |no       |no      |no      |no       |no       |
|system                  |x      |no       |no       |no      |no      |no       |no       |
|**Docker CgroupsMem**   |       |         |         |        |        |         |         |
|various                 |x      |no       |no       |no      |no      |no       |no       |

- future work
  - process_iter
  - wait_procs
  - Process class
    - as_dict
    - wait
  - AIX processes

## License

New BSD License (same as psutil)

## Related Works

I have been influenced by the following great works:

- psutil: https://github.com/giampaolo/psutil
- dstat: https://github.com/dagwieers/dstat
- gosigar: https://github.com/cloudfoundry/gosigar/
- goprocinfo: https://github.com/c9s/goprocinfo
- go-ps: https://github.com/mitchellh/go-ps
- ohai: https://github.com/opscode/ohai/
- bosun:
  https://github.com/bosun-monitor/bosun/tree/master/cmd/scollector/collectors
- mackerel:
  https://github.com/mackerelio/mackerel-agent/tree/master/metrics

## 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

English is not my native language, so PRs correcting grammar or spelling are welcome and appreciated.


================================================
FILE: common/env.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package common

type EnvKeyType string

// EnvKey is a context key that can be used to set programmatically the environment
// gopsutil relies on to perform calls against the OS.
// Example of use:
//
//	ctx := context.WithValue(context.Background(), common.EnvKey, EnvMap{common.HostProcEnvKey: "/myproc"})
//	avg, err := load.AvgWithContext(ctx)
var EnvKey = EnvKeyType("env")

const (
	HostProcEnvKey    EnvKeyType = "HOST_PROC"
	HostSysEnvKey     EnvKeyType = "HOST_SYS"
	HostEtcEnvKey     EnvKeyType = "HOST_ETC"
	HostVarEnvKey     EnvKeyType = "HOST_VAR"
	HostRunEnvKey     EnvKeyType = "HOST_RUN"
	HostDevEnvKey     EnvKeyType = "HOST_DEV"
	HostRootEnvKey    EnvKeyType = "HOST_ROOT"
	HostProcMountinfo EnvKeyType = "HOST_PROC_MOUNTINFO"
)

type EnvMap map[EnvKeyType]string


================================================
FILE: cpu/cpu.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"math"
	"runtime"
	"strconv"
	"strings"
	"sync"
	"time"

	"github.com/shirou/gopsutil/v4/internal/common"
)

// TimesStat contains the amounts of time the CPU has spent performing different
// kinds of work. Time units are in seconds. It is based on linux /proc/stat file.
type TimesStat struct {
	CPU       string  `json:"cpu"`
	User      float64 `json:"user"`
	System    float64 `json:"system"`
	Idle      float64 `json:"idle"`
	Nice      float64 `json:"nice"`
	Iowait    float64 `json:"iowait"`
	Irq       float64 `json:"irq"`
	Softirq   float64 `json:"softirq"`
	Steal     float64 `json:"steal"`
	Guest     float64 `json:"guest"`
	GuestNice float64 `json:"guestNice"`
}

type InfoStat struct {
	CPU        int32    `json:"cpu"`
	VendorID   string   `json:"vendorId"`
	Family     string   `json:"family"`
	Model      string   `json:"model"`
	Stepping   int32    `json:"stepping"`
	PhysicalID string   `json:"physicalId"`
	CoreID     string   `json:"coreId"`
	Cores      int32    `json:"cores"`
	ModelName  string   `json:"modelName"`
	Mhz        float64  `json:"mhz"`
	CacheSize  int32    `json:"cacheSize"`
	Flags      []string `json:"flags"`
	Microcode  string   `json:"microcode"`
}

type lastPercent struct {
	sync.Mutex
	lastCPUTimes    []TimesStat
	lastPerCPUTimes []TimesStat
}

var (
	lastCPUPercent lastPercent
	invoke         common.Invoker = common.Invoke{}
)

func init() {
	lastCPUPercent.Lock()
	lastCPUPercent.lastCPUTimes, _ = Times(false)
	lastCPUPercent.lastPerCPUTimes, _ = Times(true)
	lastCPUPercent.Unlock()
}

// Counts returns the number of physical or logical cores in the system
func Counts(logical bool) (int, error) {
	return CountsWithContext(context.Background(), logical)
}

func (c TimesStat) String() string {
	v := []string{
		`"cpu":"` + c.CPU + `"`,
		`"user":` + strconv.FormatFloat(c.User, 'f', 1, 64),
		`"system":` + strconv.FormatFloat(c.System, 'f', 1, 64),
		`"idle":` + strconv.FormatFloat(c.Idle, 'f', 1, 64),
		`"nice":` + strconv.FormatFloat(c.Nice, 'f', 1, 64),
		`"iowait":` + strconv.FormatFloat(c.Iowait, 'f', 1, 64),
		`"irq":` + strconv.FormatFloat(c.Irq, 'f', 1, 64),
		`"softirq":` + strconv.FormatFloat(c.Softirq, 'f', 1, 64),
		`"steal":` + strconv.FormatFloat(c.Steal, 'f', 1, 64),
		`"guest":` + strconv.FormatFloat(c.Guest, 'f', 1, 64),
		`"guestNice":` + strconv.FormatFloat(c.GuestNice, 'f', 1, 64),
	}

	return `{` + strings.Join(v, ",") + `}`
}

// Deprecated: Total returns the total number of seconds in a CPUTimesStat
// Please do not use this internal function.
func (c TimesStat) Total() float64 {
	total := c.User + c.System + c.Idle + c.Nice + c.Iowait + c.Irq +
		c.Softirq + c.Steal + c.Guest + c.GuestNice

	return total
}

func (c InfoStat) String() string {
	s, _ := json.Marshal(c)
	return string(s)
}

func getAllBusy(t TimesStat) (float64, float64) {
	tot := t.Total()
	if runtime.GOOS == "linux" {
		tot -= t.Guest     // Linux 2.6.24+
		tot -= t.GuestNice // Linux 3.2.0+
	}

	busy := tot - t.Idle - t.Iowait

	return tot, busy
}

func calculateBusy(t1, t2 TimesStat) float64 {
	t1All, t1Busy := getAllBusy(t1)
	t2All, t2Busy := getAllBusy(t2)

	if t2Busy <= t1Busy {
		return 0
	}
	if t2All <= t1All {
		return 100
	}
	return math.Min(100, math.Max(0, (t2Busy-t1Busy)/(t2All-t1All)*100))
}

func calculateAllBusy(t1, t2 []TimesStat) ([]float64, error) {
	// Make sure the CPU measurements have the same length.
	if len(t1) != len(t2) {
		return nil, fmt.Errorf(
			"received two CPU counts: %d != %d",
			len(t1), len(t2),
		)
	}

	ret := make([]float64, len(t1))
	for i, t := range t2 {
		ret[i] = calculateBusy(t1[i], t)
	}
	return ret, nil
}

// Percent calculates the percentage of cpu used either per CPU or combined.
// If an interval of 0 is given it will compare the current cpu times against the last call.
// Returns one value per cpu, or a single value if percpu is set to false.
func Percent(interval time.Duration, percpu bool) ([]float64, error) {
	return PercentWithContext(context.Background(), interval, percpu)
}

func PercentWithContext(ctx context.Context, interval time.Duration, percpu bool) ([]float64, error) {
	if interval <= 0 {
		return percentUsedFromLastCallWithContext(ctx, percpu)
	}

	// Get CPU usage at the start of the interval.
	cpuTimes1, err := TimesWithContext(ctx, percpu)
	if err != nil {
		return nil, err
	}

	if err := common.Sleep(ctx, interval); err != nil {
		return nil, err
	}

	// And at the end of the interval.
	cpuTimes2, err := TimesWithContext(ctx, percpu)
	if err != nil {
		return nil, err
	}

	return calculateAllBusy(cpuTimes1, cpuTimes2)
}

func percentUsedFromLastCall(percpu bool) ([]float64, error) {
	return percentUsedFromLastCallWithContext(context.Background(), percpu)
}

func percentUsedFromLastCallWithContext(ctx context.Context, percpu bool) ([]float64, error) {
	cpuTimes, err := TimesWithContext(ctx, percpu)
	if err != nil {
		return nil, err
	}
	lastCPUPercent.Lock()
	defer lastCPUPercent.Unlock()
	var lastTimes []TimesStat
	if percpu {
		lastTimes = lastCPUPercent.lastPerCPUTimes
		lastCPUPercent.lastPerCPUTimes = cpuTimes
	} else {
		lastTimes = lastCPUPercent.lastCPUTimes
		lastCPUPercent.lastCPUTimes = cpuTimes
	}

	if lastTimes == nil {
		return nil, errors.New("error getting times for cpu percent. lastTimes was nil")
	}
	return calculateAllBusy(lastTimes, cpuTimes)
}


================================================
FILE: cpu/cpu_aix.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix

package cpu

import (
	"context"
)

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}


================================================
FILE: cpu/cpu_aix_cgo.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix && cgo

package cpu

import (
	"context"

	"github.com/power-devops/perfstat"
)

func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
	var ret []TimesStat
	if percpu {
		cpus, err := perfstat.CpuStat()
		if err != nil {
			return nil, err
		}
		for _, c := range cpus {
			ct := &TimesStat{
				CPU:    c.Name,
				Idle:   float64(c.Idle),
				User:   float64(c.User),
				System: float64(c.Sys),
				Iowait: float64(c.Wait),
			}
			ret = append(ret, *ct)
		}
	} else {
		c, err := perfstat.CpuTotalStat()
		if err != nil {
			return nil, err
		}
		ct := &TimesStat{
			CPU:    "cpu-total",
			Idle:   float64(c.Idle),
			User:   float64(c.User),
			System: float64(c.Sys),
			Iowait: float64(c.Wait),
		}
		ret = append(ret, *ct)
	}
	return ret, nil
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
	c, err := perfstat.CpuTotalStat()
	if err != nil {
		return nil, err
	}
	p, err := perfstat.LparInfo()
	if err != nil {
		return nil, err
	}
	info := InfoStat{
		CPU:       0,
		ModelName: c.Description,
		Mhz:       float64(c.ProcessorHz / 1000000),
		Cores:     int32(p.OnlineVCpus),
	}
	result := []InfoStat{info}
	return result, nil
}

func CountsWithContext(ctx context.Context, logical bool) (int, error) {
	if logical {
		c, err := perfstat.CpuTotalStat()
		if err != nil {
			return 0, err
		}
		return c.NCpusCfg, nil
	}
	// For physical count, use the number of online virtual CPUs (before SMT multiplications).
	p, err := perfstat.LparInfo()
	if err != nil {
		return 0, err
	}
	return int(p.OnlineVCpus), nil
}


================================================
FILE: cpu/cpu_aix_nocgo.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix && !cgo

package cpu

import (
	"context"
	"strconv"
	"strings"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
	var ret []TimesStat
	if percpu {
		perOut, err := invoke.CommandWithContext(ctx, "sar", "-u", "-P", "ALL", "10", "1")
		if err != nil {
			return nil, err
		}
		lines := strings.Split(string(perOut), "\n")
		if len(lines) < 6 {
			return []TimesStat{}, common.ErrNotImplementedError
		}

		hp := strings.Fields(lines[5]) // headers
		for l := 6; l < len(lines)-1; l++ {
			ct := &TimesStat{}
			v := strings.Fields(lines[l]) // values
			for i, header := range hp {
				// We're done in any of these use cases
				if i >= len(v) || v[0] == "-" {
					break
				}

				// Position variable for v
				pos := i
				// There is a missing field at the beginning of all but the first line
				// so adjust the position
				if l > 6 {
					pos = i - 1
				}
				// We don't want invalid positions
				if pos < 0 {
					continue
				}

				if t, err := strconv.ParseFloat(v[pos], 64); err == nil {
					switch header {
					case `cpu`:
						ct.CPU = strconv.FormatFloat(t, 'f', -1, 64)
					case `%usr`:
						ct.User = t
					case `%sys`:
						ct.System = t
					case `%wio`:
						ct.Iowait = t
					case `%idle`:
						ct.Idle = t
					}
				}
			}
			// Valid CPU data, so append it
			ret = append(ret, *ct)
		}
	} else {
		out, err := invoke.CommandWithContext(ctx, "sar", "-u", "10", "1")
		if err != nil {
			return nil, err
		}
		lines := strings.Split(string(out), "\n")
		if len(lines) < 5 {
			return []TimesStat{}, common.ErrNotImplementedError
		}

		ct := &TimesStat{CPU: "cpu-total"}
		h := strings.Fields(lines[len(lines)-3]) // headers
		v := strings.Fields(lines[len(lines)-2]) // values
		for i, header := range h {
			if t, err := strconv.ParseFloat(v[i], 64); err == nil {
				switch header {
				case `%usr`:
					ct.User = t
				case `%sys`:
					ct.System = t
				case `%wio`:
					ct.Iowait = t
				case `%idle`:
					ct.Idle = t
				}
			}
		}

		ret = append(ret, *ct)
	}

	return ret, nil
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
	out, err := invoke.CommandWithContext(ctx, "prtconf")
	if err != nil {
		return nil, err
	}

	ret := InfoStat{}
	for _, line := range strings.Split(string(out), "\n") {
		switch {
		case strings.HasPrefix(line, "Number Of Processors:"):
			p := strings.Fields(line)
			if len(p) > 3 {
				if t, err := strconv.ParseUint(p[3], 10, 64); err == nil {
					ret.Cores = int32(t)
				}
			}
		case strings.HasPrefix(line, "Processor Clock Speed:"):
			p := strings.Fields(line)
			if len(p) > 4 {
				if t, err := strconv.ParseFloat(p[3], 64); err == nil {
					switch strings.ToUpper(p[4]) {
					case "MHZ":
						ret.Mhz = t
					case "GHZ":
						ret.Mhz = t * 1000.0
					case "KHZ":
						ret.Mhz = t / 1000.0
					default:
						ret.Mhz = t
					}
				}
			}
		case strings.HasPrefix(line, "System Model:"):
			p := strings.Split(string(line), ":")
			if p != nil {
				ret.VendorID = strings.TrimSpace(p[1])
			}
		case strings.HasPrefix(line, "Processor Type:"):
			p := strings.Split(string(line), ":")
			if p != nil {
				c := strings.Split(string(p[1]), "_")
				if c != nil {
					ret.Family = strings.TrimSpace(c[0])
					ret.Model = strings.TrimSpace(c[1])
				}
			}
		}
	}
	return []InfoStat{ret}, nil
}

func CountsWithContext(ctx context.Context, _ bool) (int, error) {
	info, err := InfoWithContext(ctx)
	if err == nil {
		return int(info[0].Cores), nil
	}
	return 0, err
}


================================================
FILE: cpu/cpu_darwin.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin

package cpu

import (
	"context"
	"errors"
	"fmt"
	"strconv"
	"strings"
	"unsafe"

	"github.com/tklauser/go-sysconf"
	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

// sys/resource.h
const (
	CPUser    = 0
	cpNice    = 1
	cpSys     = 2
	cpIntr    = 3
	cpIdle    = 4
	cpUStates = 5
)

// mach/machine.h
const (
	cpuStateUser   = 0
	cpuStateSystem = 1
	cpuStateIdle   = 2
	cpuStateNice   = 3
	cpuStateMax    = 4
)

// mach/processor_info.h
const (
	processorCpuLoadInfo = 2 //nolint:revive //FIXME
)

type hostCpuLoadInfoData struct { //nolint:revive //FIXME
	cpuTicks [cpuStateMax]uint32
}

// default value. from time.h
var ClocksPerSec = float64(128)

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
	sys, err := common.NewSystemLib()
	if err != nil {
		return nil, err
	}
	defer sys.Close()

	if percpu {
		return perCPUTimes(sys)
	}

	return allCPUTimes(sys)
}

// Returns only one CPUInfoStat on FreeBSD
func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(_ context.Context) ([]InfoStat, error) {
	var ret []InfoStat

	c := InfoStat{}
	c.ModelName, _ = unix.Sysctl("machdep.cpu.brand_string")
	family, _ := unix.SysctlUint32("machdep.cpu.family")
	c.Family = strconv.FormatUint(uint64(family), 10)
	model, _ := unix.SysctlUint32("machdep.cpu.model")
	c.Model = strconv.FormatUint(uint64(model), 10)
	stepping, _ := unix.SysctlUint32("machdep.cpu.stepping")
	c.Stepping = int32(stepping)
	features, err := unix.Sysctl("machdep.cpu.features")
	if err == nil {
		for _, v := range strings.Fields(features) {
			c.Flags = append(c.Flags, strings.ToLower(v))
		}
	}
	leaf7Features, err := unix.Sysctl("machdep.cpu.leaf7_features")
	if err == nil {
		for _, v := range strings.Fields(leaf7Features) {
			c.Flags = append(c.Flags, strings.ToLower(v))
		}
	}
	extfeatures, err := unix.Sysctl("machdep.cpu.extfeatures")
	if err == nil {
		for _, v := range strings.Fields(extfeatures) {
			c.Flags = append(c.Flags, strings.ToLower(v))
		}
	}
	cores, _ := unix.SysctlUint32("machdep.cpu.core_count")
	c.Cores = int32(cores)
	cacheSize, _ := unix.SysctlUint32("machdep.cpu.cache.size")
	c.CacheSize = int32(cacheSize)
	c.VendorID, _ = unix.Sysctl("machdep.cpu.vendor")

	v, err := getFrequency()
	if err == nil {
		c.Mhz = v
	}

	return append(ret, c), nil
}

func CountsWithContext(_ context.Context, logical bool) (int, error) {
	var cpuArgument string
	if logical {
		cpuArgument = "hw.logicalcpu"
	} else {
		cpuArgument = "hw.physicalcpu"
	}

	count, err := unix.SysctlUint32(cpuArgument)
	if err != nil {
		return 0, err
	}

	return int(count), nil
}

func perCPUTimes(sys *common.SystemLib) ([]TimesStat, error) {
	var count, ncpu uint32
	var cpuload *hostCpuLoadInfoData

	status := sys.HostProcessorInfo(sys.MachHostSelf(), processorCpuLoadInfo,
		&ncpu, uintptr(unsafe.Pointer(&cpuload)), &count)

	if status != common.KERN_SUCCESS {
		return nil, fmt.Errorf("host_processor_info error=%d", status)
	}

	if cpuload == nil {
		return nil, errors.New("host_processor_info returned nil cpuload")
	}

	defer sys.VMDeallocate(sys.MachTaskSelf(), uintptr(unsafe.Pointer(cpuload)), uintptr(ncpu))

	ret := []TimesStat{}
	loads := unsafe.Slice(cpuload, ncpu)

	for i := 0; i < int(ncpu); i++ {
		c := TimesStat{
			CPU:    fmt.Sprintf("cpu%d", i),
			User:   float64(loads[i].cpuTicks[cpuStateUser]) / ClocksPerSec,
			System: float64(loads[i].cpuTicks[cpuStateSystem]) / ClocksPerSec,
			Nice:   float64(loads[i].cpuTicks[cpuStateNice]) / ClocksPerSec,
			Idle:   float64(loads[i].cpuTicks[cpuStateIdle]) / ClocksPerSec,
		}
		ret = append(ret, c)
	}

	return ret, nil
}

func allCPUTimes(sys *common.SystemLib) ([]TimesStat, error) {
	var cpuload hostCpuLoadInfoData
	count := uint32(cpuStateMax)

	status := sys.HostStatistics(sys.MachHostSelf(), common.HOST_CPU_LOAD_INFO,
		uintptr(unsafe.Pointer(&cpuload)), &count)

	if status != common.KERN_SUCCESS {
		return nil, fmt.Errorf("host_statistics error=%d", status)
	}

	c := TimesStat{
		CPU:    "cpu-total",
		User:   float64(cpuload.cpuTicks[cpuStateUser]) / ClocksPerSec,
		System: float64(cpuload.cpuTicks[cpuStateSystem]) / ClocksPerSec,
		Nice:   float64(cpuload.cpuTicks[cpuStateNice]) / ClocksPerSec,
		Idle:   float64(cpuload.cpuTicks[cpuStateIdle]) / ClocksPerSec,
	}

	return []TimesStat{c}, nil
}


================================================
FILE: cpu/cpu_darwin_arm64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin && arm64

package cpu

import (
	"encoding/binary"
	"fmt"
	"unsafe"

	"github.com/shirou/gopsutil/v4/internal/common"
)

// https://github.com/shoenig/go-m1cpu/blob/v0.1.6/cpu.go
func getFrequency() (float64, error) {
	iokit, err := common.NewIOKitLib()
	if err != nil {
		return 0, err
	}
	defer iokit.Close()

	corefoundation, err := common.NewCoreFoundationLib()
	if err != nil {
		return 0, err
	}
	defer corefoundation.Close()

	matching := iokit.IOServiceMatching("AppleARMIODevice")

	var iterator uint32
	if status := iokit.IOServiceGetMatchingServices(common.KIOMainPortDefault, uintptr(matching), &iterator); status != common.KERN_SUCCESS {
		return 0.0, fmt.Errorf("IOServiceGetMatchingServices error=%d", status)
	}
	defer iokit.IOObjectRelease(iterator)

	pCorekey := corefoundation.CFStringCreateWithCString(common.KCFAllocatorDefault, "voltage-states5-sram", common.KCFStringEncodingUTF8)
	defer corefoundation.CFRelease(uintptr(pCorekey))

	var pCoreHz uint32
	for {
		service := iokit.IOIteratorNext(iterator)
		if service <= 0 {
			break
		}

		buf := common.NewCStr(512)
		iokit.IORegistryEntryGetName(service, buf)

		if buf.GoString() == "pmgr" {
			pCoreRef := iokit.IORegistryEntryCreateCFProperty(service, uintptr(pCorekey), common.KCFAllocatorDefault, common.KNilOptions)
			length := corefoundation.CFDataGetLength(uintptr(pCoreRef))
			data := corefoundation.CFDataGetBytePtr(uintptr(pCoreRef))

			// composite uint32 from the byte array
			buf := unsafe.Slice((*byte)(data), length)

			// combine the bytes into a uint32 value
			b := buf[length-8 : length-4]
			pCoreHz = binary.LittleEndian.Uint32(b)
			corefoundation.CFRelease(uintptr(pCoreRef))
			iokit.IOObjectRelease(service)
			break
		}

		iokit.IOObjectRelease(service)
	}

	return float64(pCoreHz / 1_000_000), nil
}


================================================
FILE: cpu/cpu_darwin_fallback.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin && !arm64

package cpu

import "golang.org/x/sys/unix"

func getFrequency() (float64, error) {
	// Use the rated frequency of the CPU. This is a static value and does not
	// account for low power or Turbo Boost modes.
	cpuFrequency, err := unix.SysctlUint64("hw.cpufrequency")
	return float64(cpuFrequency) / 1000000.0, err
}


================================================
FILE: cpu/cpu_darwin_test.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin

package cpu

import (
	"os"
	"runtime"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestInfo_AppleSilicon(t *testing.T) {
	if runtime.GOARCH != "arm64" {
		t.Skip("wrong cpu type")
	}

	v, err := Info()
	require.NoErrorf(t, err, "cpu info should be implemented on darwin systems")

	for _, vv := range v {
		assert.NotEmptyf(t, vv.ModelName, "could not get CPU info: %v", vv)
		if vv.Mhz <= 0 && os.Getenv("CI") != "true" {
			t.Errorf("could not get frequency of: %s", vv.ModelName)
		}
		assert.LessOrEqualf(t, vv.Mhz, float64(6000), "cpu frequency is absurdly high value: %f MHz", vv.Mhz)
	}
}


================================================
FILE: cpu/cpu_dragonfly.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"context"
	"fmt"
	"reflect"
	"regexp"
	"runtime"
	"strconv"
	"strings"
	"unsafe"

	"github.com/tklauser/go-sysconf"
	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var (
	ClocksPerSec   = float64(128)
	cpuMatch       = regexp.MustCompile(`^CPU:`)
	originMatch    = regexp.MustCompile(`Origin\s*=\s*"(.+)"\s+Id\s*=\s*(.+)\s+Stepping\s*=\s*(.+)`)
	featuresMatch  = regexp.MustCompile(`Features=.+<(.+)>`)
	featuresMatch2 = regexp.MustCompile(`Features2=[a-f\dx]+<(.+)>`)
	cpuEnd         = regexp.MustCompile(`^Trying to mount root`)
	cpuTimesSize   int
	emptyTimes     cpuTimes
)

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

func timeStat(name string, t *cpuTimes) *TimesStat {
	return &TimesStat{
		User:   float64(t.User) / ClocksPerSec,
		Nice:   float64(t.Nice) / ClocksPerSec,
		System: float64(t.Sys) / ClocksPerSec,
		Idle:   float64(t.Idle) / ClocksPerSec,
		Irq:    float64(t.Intr) / ClocksPerSec,
		CPU:    name,
	}
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
	if percpu {
		buf, err := unix.SysctlRaw("kern.cp_times")
		if err != nil {
			return nil, err
		}

		// We can't do this in init due to the conflict with cpu.init()
		if cpuTimesSize == 0 {
			cpuTimesSize = int(reflect.TypeOf(cpuTimes{}).Size())
		}

		ncpus := len(buf) / cpuTimesSize
		ret := make([]TimesStat, 0, ncpus)
		for i := 0; i < ncpus; i++ {
			times := (*cpuTimes)(unsafe.Pointer(&buf[i*cpuTimesSize]))
			if *times == emptyTimes {
				// CPU not present
				continue
			}
			ret = append(ret, *timeStat(fmt.Sprintf("cpu%d", len(ret)), times))
		}
		return ret, nil
	}

	buf, err := unix.SysctlRaw("kern.cp_time")
	if err != nil {
		return nil, err
	}

	times := (*cpuTimes)(unsafe.Pointer(&buf[0]))
	return []TimesStat{*timeStat("cpu-total", times)}, nil
}

// Returns only one InfoStat on DragonflyBSD.  The information regarding core
// count, however is accurate and it is assumed that all InfoStat attributes
// are the same across CPUs.
func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(_ context.Context) ([]InfoStat, error) {
	const dmesgBoot = "/var/run/dmesg.boot"

	c, err := parseDmesgBoot(dmesgBoot)
	if err != nil {
		return nil, err
	}

	var u32 uint32
	if u32, err = unix.SysctlUint32("hw.clockrate"); err != nil {
		return nil, err
	}
	c.Mhz = float64(u32)

	var num int
	var buf string
	if buf, err = unix.Sysctl("hw.cpu_topology.tree"); err != nil {
		return nil, err
	}
	num = strings.Count(buf, "CHIP")
	c.Cores = int32(strings.Count(string(buf), "CORE") / num)

	if c.ModelName, err = unix.Sysctl("hw.model"); err != nil {
		return nil, err
	}

	ret := make([]InfoStat, num)
	for i := 0; i < num; i++ {
		ret[i] = c
	}

	return ret, nil
}

func parseDmesgBoot(fileName string) (InfoStat, error) {
	c := InfoStat{}
	lines, err := common.ReadLines(fileName)
	if err != nil {
		return c, fmt.Errorf("could not read %s: %w", fileName, err)
	}

	for _, line := range lines {
		if matches := cpuEnd.FindStringSubmatch(line); matches != nil {
			break
		} else if matches := originMatch.FindStringSubmatch(line); matches != nil {
			c.VendorID = matches[1]
			t, err := strconv.ParseInt(matches[2], 10, 32)
			if err != nil {
				return c, fmt.Errorf("unable to parse DragonflyBSD CPU stepping information from %q: %w", line, err)
			}
			c.Stepping = int32(t)
		} else if matches := featuresMatch.FindStringSubmatch(line); matches != nil {
			for _, v := range strings.Split(matches[1], ",") {
				c.Flags = append(c.Flags, strings.ToLower(v))
			}
		} else if matches := featuresMatch2.FindStringSubmatch(line); matches != nil {
			for _, v := range strings.Split(matches[1], ",") {
				c.Flags = append(c.Flags, strings.ToLower(v))
			}
		}
	}

	return c, nil
}

func CountsWithContext(_ context.Context, _ bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_dragonfly_amd64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_fallback.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !solaris && !windows && !dragonfly && !plan9 && !aix

package cpu

import (
	"context"
	"runtime"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
	return []TimesStat{}, common.ErrNotImplementedError
}

func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
	return []InfoStat{}, common.ErrNotImplementedError
}

func CountsWithContext(ctx context.Context, logical bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_freebsd.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"context"
	"fmt"
	"reflect"
	"regexp"
	"runtime"
	"strconv"
	"strings"
	"unsafe"

	"github.com/tklauser/go-sysconf"
	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var (
	ClocksPerSec   = float64(128)
	cpuMatch       = regexp.MustCompile(`^CPU:`)
	originMatch    = regexp.MustCompile(`Origin\s*=\s*"(.+)"\s+Id\s*=\s*(.+)\s+Family\s*=\s*(.+)\s+Model\s*=\s*(.+)\s+Stepping\s*=\s*(.+)`)
	featuresMatch  = regexp.MustCompile(`Features=.+<(.+)>`)
	featuresMatch2 = regexp.MustCompile(`Features2=[a-f\dx]+<(.+)>`)
	cpuEnd         = regexp.MustCompile(`^Trying to mount root`)
	cpuCores       = regexp.MustCompile(`FreeBSD/SMP: (\d*) package\(s\) x (\d*) core\(s\)`)
	cpuTimesSize   int
	emptyTimes     cpuTimes
)

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

func timeStat(name string, t *cpuTimes) *TimesStat {
	return &TimesStat{
		User:   float64(t.User) / ClocksPerSec,
		Nice:   float64(t.Nice) / ClocksPerSec,
		System: float64(t.Sys) / ClocksPerSec,
		Idle:   float64(t.Idle) / ClocksPerSec,
		Irq:    float64(t.Intr) / ClocksPerSec,
		CPU:    name,
	}
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
	if percpu {
		buf, err := unix.SysctlRaw("kern.cp_times")
		if err != nil {
			return nil, err
		}

		// We can't do this in init due to the conflict with cpu.init()
		if cpuTimesSize == 0 {
			cpuTimesSize = int(reflect.TypeOf(cpuTimes{}).Size())
		}

		ncpus := len(buf) / cpuTimesSize
		ret := make([]TimesStat, 0, ncpus)
		for i := 0; i < ncpus; i++ {
			times := (*cpuTimes)(unsafe.Pointer(&buf[i*cpuTimesSize]))
			if *times == emptyTimes {
				// CPU not present
				continue
			}
			ret = append(ret, *timeStat(fmt.Sprintf("cpu%d", len(ret)), times))
		}
		return ret, nil
	}

	buf, err := unix.SysctlRaw("kern.cp_time")
	if err != nil {
		return nil, err
	}

	times := (*cpuTimes)(unsafe.Pointer(&buf[0]))
	return []TimesStat{*timeStat("cpu-total", times)}, nil
}

// Returns only one InfoStat on FreeBSD.  The information regarding core
// count, however is accurate and it is assumed that all InfoStat attributes
// are the same across CPUs.
func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(_ context.Context) ([]InfoStat, error) {
	const dmesgBoot = "/var/run/dmesg.boot"

	c, num, err := parseDmesgBoot(dmesgBoot)
	if err != nil {
		return nil, err
	}

	var u32 uint32
	if u32, err = unix.SysctlUint32("hw.clockrate"); err != nil {
		return nil, err
	}
	c.Mhz = float64(u32)

	if u32, err = unix.SysctlUint32("hw.ncpu"); err != nil {
		return nil, err
	}
	c.Cores = int32(u32)

	if c.ModelName, err = unix.Sysctl("hw.model"); err != nil {
		return nil, err
	}

	ret := make([]InfoStat, num)
	for i := 0; i < num; i++ {
		ret[i] = c
	}

	return ret, nil
}

func parseDmesgBoot(fileName string) (InfoStat, int, error) {
	c := InfoStat{}
	lines, err := common.ReadLines(fileName)
	if err != nil {
		return c, 0, fmt.Errorf("could not read %s: %w", fileName, err)
	}

	cpuNum := 1 // default cpu num is 1
	for _, line := range lines {
		if matches := cpuEnd.FindStringSubmatch(line); matches != nil {
			break
		} else if matches := originMatch.FindStringSubmatch(line); matches != nil {
			c.VendorID = matches[1]
			c.Family = matches[3]
			c.Model = matches[4]
			t, err := strconv.ParseInt(matches[5], 10, 32)
			if err != nil {
				return c, 0, fmt.Errorf("unable to parse FreeBSD CPU stepping information from %q: %w", line, err)
			}
			c.Stepping = int32(t)
		} else if matches := featuresMatch.FindStringSubmatch(line); matches != nil {
			for _, v := range strings.Split(matches[1], ",") {
				c.Flags = append(c.Flags, strings.ToLower(v))
			}
		} else if matches := featuresMatch2.FindStringSubmatch(line); matches != nil {
			for _, v := range strings.Split(matches[1], ",") {
				c.Flags = append(c.Flags, strings.ToLower(v))
			}
		} else if matches := cpuCores.FindStringSubmatch(line); matches != nil {
			t, err := strconv.ParseInt(matches[1], 10, 32)
			if err != nil {
				return c, 0, fmt.Errorf("unable to parse FreeBSD CPU Nums from %q: %w", line, err)
			}
			cpuNum = int(t)
			t2, err := strconv.ParseInt(matches[2], 10, 32)
			if err != nil {
				return c, 0, fmt.Errorf("unable to parse FreeBSD CPU cores from %q: %w", line, err)
			}
			c.Cores = int32(t2)
		}
	}

	return c, cpuNum, nil
}

func CountsWithContext(_ context.Context, _ bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_freebsd_386.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint32
	Nice uint32
	Sys  uint32
	Intr uint32
	Idle uint32
}


================================================
FILE: cpu/cpu_freebsd_amd64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_freebsd_arm.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint32
	Nice uint32
	Sys  uint32
	Intr uint32
	Idle uint32
}


================================================
FILE: cpu/cpu_freebsd_arm64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_freebsd_test.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"path/filepath"
	"runtime"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func TestParseDmesgBoot(t *testing.T) {
	if runtime.GOOS != "freebsd" {
		t.SkipNow()
	}

	cpuTests := []struct {
		file   string
		cpuNum int
		cores  int32
	}{
		{"1cpu_2core.txt", 1, 2},
		{"1cpu_4core.txt", 1, 4},
		{"2cpu_4core.txt", 2, 4},
	}
	for _, tt := range cpuTests {
		v, num, err := parseDmesgBoot(filepath.Join("testdata", "freebsd", tt.file))
		require.NoErrorf(t, err, "parseDmesgBoot failed(%s), %v", tt.file, err)
		assert.Equalf(t, num, tt.cpuNum, "parseDmesgBoot wrong length(%s), %v", tt.file, err)
		assert.Equalf(t, v.Cores, tt.cores, "parseDmesgBoot wrong core(%s), %v", tt.file, err)
		assert.Truef(t, common.StringsContains(v.Flags, "fpu"), "parseDmesgBoot fail to parse features(%s), %v", tt.file, err)
	}
}


================================================
FILE: cpu/cpu_linux.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build linux

package cpu

import (
	"context"
	"errors"
	"fmt"
	"path/filepath"
	"strconv"
	"strings"

	"github.com/tklauser/go-sysconf"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var ClocksPerSec = float64(100)

var armModelToModelName = map[uint64]string{
	0x810: "ARM810",
	0x920: "ARM920",
	0x922: "ARM922",
	0x926: "ARM926",
	0x940: "ARM940",
	0x946: "ARM946",
	0x966: "ARM966",
	0xa20: "ARM1020",
	0xa22: "ARM1022",
	0xa26: "ARM1026",
	0xb02: "ARM11 MPCore",
	0xb36: "ARM1136",
	0xb56: "ARM1156",
	0xb76: "ARM1176",
	0xc05: "Cortex-A5",
	0xc07: "Cortex-A7",
	0xc08: "Cortex-A8",
	0xc09: "Cortex-A9",
	0xc0d: "Cortex-A17",
	0xc0f: "Cortex-A15",
	0xc0e: "Cortex-A17",
	0xc14: "Cortex-R4",
	0xc15: "Cortex-R5",
	0xc17: "Cortex-R7",
	0xc18: "Cortex-R8",
	0xc20: "Cortex-M0",
	0xc21: "Cortex-M1",
	0xc23: "Cortex-M3",
	0xc24: "Cortex-M4",
	0xc27: "Cortex-M7",
	0xc60: "Cortex-M0+",
	0xd01: "Cortex-A32",
	0xd02: "Cortex-A34",
	0xd03: "Cortex-A53",
	0xd04: "Cortex-A35",
	0xd05: "Cortex-A55",
	0xd06: "Cortex-A65",
	0xd07: "Cortex-A57",
	0xd08: "Cortex-A72",
	0xd09: "Cortex-A73",
	0xd0a: "Cortex-A75",
	0xd0b: "Cortex-A76",
	0xd0c: "Neoverse-N1",
	0xd0d: "Cortex-A77",
	0xd0e: "Cortex-A76AE",
	0xd13: "Cortex-R52",
	0xd20: "Cortex-M23",
	0xd21: "Cortex-M33",
	0xd40: "Neoverse-V1",
	0xd41: "Cortex-A78",
	0xd42: "Cortex-A78AE",
	0xd43: "Cortex-A65AE",
	0xd44: "Cortex-X1",
	0xd46: "Cortex-A510",
	0xd47: "Cortex-A710",
	0xd48: "Cortex-X2",
	0xd49: "Neoverse-N2",
	0xd4a: "Neoverse-E1",
	0xd4b: "Cortex-A78C",
	0xd4c: "Cortex-X1C",
	0xd4d: "Cortex-A715",
	0xd4e: "Cortex-X3",
	0xd4f: "Neoverse-V2",
	0xd81: "Cortex-A720",
	0xd82: "Cortex-X4",
	0xd84: "Neoverse-V3",
	0xd85: "Cortex-X925",
	0xd87: "Cortex-A725",
	0xd8e: "Neoverse-N3",
}

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
	filename := common.HostProcWithContext(ctx, "stat")
	lines := []string{}
	var err error
	if percpu {
		statlines, err := common.ReadLines(filename)
		if err != nil || len(statlines) < 2 {
			return []TimesStat{}, nil
		}
		for _, line := range statlines[1:] {
			if !strings.HasPrefix(line, "cpu") {
				break
			}
			lines = append(lines, line)
		}
	} else {
		lines, err = common.ReadLinesOffsetN(filename, 0, 1)
		if err != nil || len(lines) == 0 {
			return []TimesStat{}, nil
		}
	}

	ret := make([]TimesStat, 0, len(lines))

	for _, line := range lines {
		ct, err := parseStatLine(line)
		if err != nil {
			continue
		}
		ret = append(ret, *ct)

	}
	return ret, nil
}

func sysCPUPath(ctx context.Context, cpu int32, relPath string) string {
	return common.HostSysWithContext(ctx, fmt.Sprintf("devices/system/cpu/cpu%d", cpu), relPath)
}

func finishCPUInfo(ctx context.Context, c *InfoStat) {
	var lines []string
	var err error
	var value float64

	if c.CoreID == "" {
		lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "topology/core_id"))
		if err == nil {
			c.CoreID = lines[0]
		}
	}

	// override the value of c.Mhz with cpufreq/cpuinfo_max_freq regardless
	// of the value from /proc/cpuinfo because we want to report the maximum
	// clock-speed of the CPU for c.Mhz, matching the behaviour of Windows
	lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "cpufreq/cpuinfo_max_freq"))
	// if we encounter errors below such as there are no cpuinfo_max_freq file,
	// we just ignore. so let Mhz is 0.
	if err != nil || len(lines) == 0 {
		return
	}
	value, err = strconv.ParseFloat(lines[0], 64)
	if err != nil {
		return
	}
	c.Mhz = value / 1000.0 // value is in kHz
	if c.Mhz > 9999 {
		c.Mhz /= 1000.0 // value in Hz
	}
}

// CPUInfo on linux will return 1 item per physical thread.
//
// CPUs have three levels of counting: sockets, cores, threads.
// Cores with HyperThreading count as having 2 threads per core.
// Sockets often come with many physical CPU cores.
// For example a single socket board with two cores each with HT will
// return 4 CPUInfoStat structs on Linux and the "Cores" field set to 1.
func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
	filename := common.HostProcWithContext(ctx, "cpuinfo")
	lines, err := common.ReadLines(filename)
	if err != nil {
		return nil, fmt.Errorf("could not read %s: %w", filename, err)
	}

	var ret []InfoStat
	var processorName string

	c := InfoStat{CPU: -1, Cores: 1}
	for _, line := range lines {
		fields := strings.SplitN(line, ":", 2)
		if len(fields) < 2 {
			continue
		}
		key := strings.TrimSpace(fields[0])
		value := strings.TrimSpace(fields[1])

		switch key {
		case "Processor":
			processorName = value
		case "processor", "cpu number":
			if c.CPU >= 0 {
				finishCPUInfo(ctx, &c)
				ret = append(ret, c)
			}
			c = InfoStat{Cores: 1, ModelName: processorName}
			t, err := strconv.ParseInt(value, 10, 64)
			if err != nil {
				return ret, err
			}
			c.CPU = int32(t)
		case "vendorId", "vendor_id":
			c.VendorID = value
			if strings.Contains(value, "S390") {
				processorName = "S390"
			}
		case "mvendorid":
			if !strings.HasPrefix(value, "0x") {
				continue
			}

			if v, err := strconv.ParseUint(value[2:], 16, 32); err == nil {
				switch v {
				case 0x31e:
					c.VendorID = "Andes"
				case 0x029:
					c.VendorID = "Microchip"
				case 0x127:
					c.VendorID = "MIPS"
				case 0x489:
					c.VendorID = "SiFive"
				case 0x5b7:
					c.VendorID = "T-Head"
				}
			}
		case "CPU implementer":
			if v, err := strconv.ParseUint(value, 0, 8); err == nil {
				switch v {
				case 0x41:
					c.VendorID = "ARM"
				case 0x42:
					c.VendorID = "Broadcom"
				case 0x43:
					c.VendorID = "Cavium"
				case 0x44:
					c.VendorID = "DEC"
				case 0x46:
					c.VendorID = "Fujitsu"
				case 0x48:
					c.VendorID = "HiSilicon"
				case 0x49:
					c.VendorID = "Infineon"
				case 0x4d:
					c.VendorID = "Motorola/Freescale"
				case 0x4e:
					c.VendorID = "NVIDIA"
				case 0x50:
					c.VendorID = "APM"
				case 0x51:
					c.VendorID = "Qualcomm"
				case 0x56:
					c.VendorID = "Marvell"
				case 0x61:
					c.VendorID = "Apple"
				case 0x69:
					c.VendorID = "Intel"
				case 0xc0:
					c.VendorID = "Ampere"
				}
			}
		case "cpu family", "marchid":
			c.Family = value
		case "model", "CPU part", "mimpid":
			c.Model = value
			// if CPU is arm based, model name is found via model number. refer to: arch/arm64/kernel/cpuinfo.c
			if c.VendorID == "ARM" {
				if v, err := strconv.ParseUint(c.Model, 0, 16); err == nil {
					modelName, exist := armModelToModelName[v]
					if exist {
						c.ModelName = modelName
					} else {
						c.ModelName = "Undefined"
					}
				}
			}
		case "Model Name", "model name", "cpu", "uarch":
			c.ModelName = value
			if strings.Contains(value, "POWER") {
				c.Model = strings.Split(value, " ")[0]
				c.Family = "POWER"
				c.VendorID = "IBM"
			}
		case "stepping", "revision", "CPU revision":
			val := value

			if key == "revision" {
				val = strings.Split(value, ".")[0]
			}

			if strings.EqualFold(val, "unknown") {
				continue
			}

			t, err := strconv.ParseInt(val, 10, 64)
			if err != nil {
				return ret, err
			}
			c.Stepping = int32(t)
		case "cpu MHz", "clock", "cpu MHz dynamic":
			// treat this as the fallback value, thus we ignore error
			if t, err := strconv.ParseFloat(strings.Replace(value, "MHz", "", 1), 64); err == nil {
				c.Mhz = t
			}
		case "cache size":
			t, err := strconv.ParseInt(strings.Replace(value, " KB", "", 1), 10, 64)
			if err != nil {
				return ret, err
			}
			c.CacheSize = int32(t)
		case "physical id", "hart":
			c.PhysicalID = value
		case "core id":
			c.CoreID = value
		case "flags", "Features":
			c.Flags = strings.FieldsFunc(value, func(r rune) bool {
				return r == ',' || r == ' '
			})
		case "isa", "hart isa":
			if len(c.Flags) != 0 || !strings.HasPrefix(value, "rv64") {
				continue
			}
			c.Flags = riscvISAParse(value)
		case "microcode":
			c.Microcode = value
		}
	}
	if c.CPU >= 0 {
		finishCPUInfo(ctx, &c)
		ret = append(ret, c)
	}
	return ret, nil
}

func parseStatLine(line string) (*TimesStat, error) {
	fields := strings.Fields(line)

	if len(fields) < 8 {
		return nil, errors.New("stat does not contain cpu info")
	}

	if !strings.HasPrefix(fields[0], "cpu") {
		return nil, errors.New("not contain cpu")
	}

	cpu := fields[0]
	if cpu == "cpu" {
		cpu = "cpu-total"
	}
	user, err := strconv.ParseFloat(fields[1], 64)
	if err != nil {
		return nil, err
	}
	nice, err := strconv.ParseFloat(fields[2], 64)
	if err != nil {
		return nil, err
	}
	system, err := strconv.ParseFloat(fields[3], 64)
	if err != nil {
		return nil, err
	}
	idle, err := strconv.ParseFloat(fields[4], 64)
	if err != nil {
		return nil, err
	}
	iowait, err := strconv.ParseFloat(fields[5], 64)
	if err != nil {
		return nil, err
	}
	irq, err := strconv.ParseFloat(fields[6], 64)
	if err != nil {
		return nil, err
	}
	softirq, err := strconv.ParseFloat(fields[7], 64)
	if err != nil {
		return nil, err
	}

	ct := &TimesStat{
		CPU:     cpu,
		User:    user / ClocksPerSec,
		Nice:    nice / ClocksPerSec,
		System:  system / ClocksPerSec,
		Idle:    idle / ClocksPerSec,
		Iowait:  iowait / ClocksPerSec,
		Irq:     irq / ClocksPerSec,
		Softirq: softirq / ClocksPerSec,
	}
	if len(fields) > 8 { // Linux >= 2.6.11
		steal, err := strconv.ParseFloat(fields[8], 64)
		if err != nil {
			return nil, err
		}
		ct.Steal = steal / ClocksPerSec
	}
	if len(fields) > 9 { // Linux >= 2.6.24
		guest, err := strconv.ParseFloat(fields[9], 64)
		if err != nil {
			return nil, err
		}
		ct.Guest = guest / ClocksPerSec
	}
	if len(fields) > 10 { // Linux >= 3.2.0
		guestNice, err := strconv.ParseFloat(fields[10], 64)
		if err != nil {
			return nil, err
		}
		ct.GuestNice = guestNice / ClocksPerSec
	}

	return ct, nil
}

func CountsWithContext(ctx context.Context, logical bool) (int, error) {
	if logical {
		ret := 0
		// https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_pslinux.py#L599
		procCpuinfo := common.HostProcWithContext(ctx, "cpuinfo")
		lines, err := common.ReadLines(procCpuinfo)
		if err == nil {
			for _, line := range lines {
				line = strings.ToLower(line)
				if strings.HasPrefix(line, "processor") {
					_, err = strconv.ParseInt(strings.TrimSpace(line[strings.IndexByte(line, ':')+1:]), 10, 32)
					if err == nil {
						ret++
					}
				}
			}
		}
		if ret == 0 {
			procStat := common.HostProcWithContext(ctx, "stat")
			lines, err = common.ReadLines(procStat)
			if err != nil {
				return 0, err
			}
			for _, line := range lines {
				if len(line) >= 4 && strings.HasPrefix(line, "cpu") && '0' <= line[3] && line[3] <= '9' { // `^cpu\d` regexp matching
					ret++
				}
			}
		}
		return ret, nil
	}
	// physical cores
	// https://github.com/giampaolo/psutil/blob/8415355c8badc9c94418b19bdf26e622f06f0cce/psutil/_pslinux.py#L615-L628
	threadSiblingsLists := make(map[string]bool)
	// These 2 files are the same but */core_cpus_list is newer while */thread_siblings_list is deprecated and may disappear in the future.
	// https://www.kernel.org/doc/Documentation/admin-guide/cputopology.rst
	// https://github.com/giampaolo/psutil/pull/1727#issuecomment-707624964
	// https://lkml.org/lkml/2019/2/26/41
	for _, glob := range []string{"devices/system/cpu/cpu[0-9]*/topology/core_cpus_list", "devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list"} {
		if files, err := filepath.Glob(common.HostSysWithContext(ctx, glob)); err == nil {
			for _, file := range files {
				lines, err := common.ReadLines(file)
				if err != nil || len(lines) != 1 {
					continue
				}
				threadSiblingsLists[lines[0]] = true
			}
			ret := len(threadSiblingsLists)
			if ret != 0 {
				return ret, nil
			}
		}
	}
	// https://github.com/giampaolo/psutil/blob/122174a10b75c9beebe15f6c07dcf3afbe3b120d/psutil/_pslinux.py#L631-L652
	filename := common.HostProcWithContext(ctx, "cpuinfo")
	lines, err := common.ReadLines(filename)
	if err != nil {
		return 0, err
	}
	mapping := make(map[int]int)
	currentInfo := make(map[string]int)
	for _, line := range lines {
		line = strings.ToLower(strings.TrimSpace(line))
		if line == "" {
			// new section
			id, okID := currentInfo["physical id"]
			cores, okCores := currentInfo["cpu cores"]
			if okID && okCores {
				mapping[id] = cores
			}
			currentInfo = make(map[string]int)
			continue
		}
		fields := strings.SplitN(line, ":", 2)
		if len(fields) < 2 {
			continue
		}
		fields[0] = strings.TrimSpace(fields[0])
		if fields[0] == "physical id" || fields[0] == "cpu cores" {
			val, err := strconv.ParseInt(strings.TrimSpace(fields[1]), 10, 32)
			if err != nil {
				continue
			}
			currentInfo[fields[0]] = int(val)
		}
	}
	ret := 0
	for _, v := range mapping {
		ret += v
	}
	return ret, nil
}

func riscvISAParse(s string) []string {
	ext := strings.Split(s, "_")
	if len(ext[0]) <= 4 {
		return nil
	}
	// the base extensions must "rv64" prefix
	base := strings.Split(ext[0][4:], "")
	return append(base, ext[1:]...)
}


================================================
FILE: cpu/cpu_linux_test.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"context"
	"errors"
	"os/exec"
	"strconv"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func TestTimesEmpty(t *testing.T) {
	t.Setenv("HOST_PROC", "testdata/linux/times_empty")
	_, err := Times(true)
	require.NoErrorf(t, err, "Times(true) failed")
	_, err = Times(false)
	assert.NoErrorf(t, err, "Times(false) failed")
}

func TestParseStatLine_424(t *testing.T) {
	t.Setenv("HOST_PROC", "testdata/linux/424/proc")
	{
		l, err := Times(true)
		if err != nil || len(l) == 0 {
			t.Error("Times(true) failed")
		}
		t.Logf("Times(true): %#v", l)
	}
	{
		l, err := Times(false)
		if err != nil || len(l) == 0 {
			t.Error("Times(false) failed")
		}
		t.Logf("Times(false): %#v", l)
	}
}

func TestCountsAgainstLscpu(t *testing.T) {
	cmd := exec.CommandContext(context.Background(), "lscpu")
	cmd.Env = []string{"LC_ALL=C"}
	out, err := cmd.Output()
	if err != nil {
		if errors.Is(err, exec.ErrNotFound) {
			t.Skip("no lscpu to compare with")
		}
		t.Errorf("error executing lscpu: %v", err)
	}
	var threadsPerCore, coresPerSocket, sockets, books, drawers int
	books = 1
	drawers = 1
	lines := strings.Split(string(out), "\n")
	for _, line := range lines {
		fields := strings.Split(line, ":")
		if len(fields) < 2 {
			continue
		}
		switch fields[0] {
		case "Thread(s) per core":
			threadsPerCore, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
		case "Core(s) per socket":
			coresPerSocket, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
		case "Socket(s)", "Socket(s) per book":
			sockets, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
		case "Book(s) per drawer":
			books, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
		case "Drawer(s)":
			drawers, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
		}
	}
	if threadsPerCore == 0 || coresPerSocket == 0 || sockets == 0 {
		t.Errorf("missing info from lscpu: threadsPerCore=%d coresPerSocket=%d sockets=%d", threadsPerCore, coresPerSocket, sockets)
	}
	expectedPhysical := coresPerSocket * sockets * books * drawers
	expectedLogical := expectedPhysical * threadsPerCore
	physical, err := Counts(false)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	logical, err := Counts(true)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.Equalf(t, expectedPhysical, physical, "expected %v, got %v", expectedPhysical, physical)
	assert.Equalf(t, expectedLogical, logical, "expected %v, got %v", expectedLogical, logical)
}

func TestCountsLogicalAndroid_1037(t *testing.T) { // https://github.com/shirou/gopsutil/issues/1037
	t.Setenv("HOST_PROC", "testdata/linux/1037/proc")

	count, err := Counts(true)
	require.NoError(t, err)
	expected := 8
	assert.Equalf(t, expected, count, "expected %v, got %v", expected, count)
}

func TestCPUInfoModelNameWithColon_1958(t *testing.T) { // https://github.com/shirou/gopsutil/issues/1958
	t.Setenv("HOST_PROC", "testdata/linux/1958/proc")

	info, err := Info()
	require.NoError(t, err)
	require.Len(t, info, 1)

	expected := "Hygon C86-4G (OPN:5435)"
	assert.Equalf(t, expected, info[0].ModelName, "expected %v, got %v", expected, info[0].ModelName)
}


================================================
FILE: cpu/cpu_netbsd.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build netbsd

package cpu

import (
	"context"
	"fmt"
	"runtime"
	"unsafe"

	"github.com/tklauser/go-sysconf"
	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

const (
	// sys/sysctl.h
	ctlKern    = 1  // "high kernel": proc, limits
	ctlHw      = 6  // CTL_HW
	kernCpTime = 51 // KERN_CPTIME
)

var ClocksPerSec = float64(100)

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
	ret := make([]TimesStat, 0)
	if !percpu {
		mib := []int32{ctlKern, kernCpTime}
		buf, _, err := common.CallSyscall(mib)
		if err != nil {
			return ret, err
		}
		times := (*cpuTimes)(unsafe.Pointer(&buf[0]))
		ret = append(ret, TimesStat{
			CPU:    "cpu-total",
			User:   float64(times.User),
			Nice:   float64(times.Nice),
			System: float64(times.Sys),
			Idle:   float64(times.Idle),
			Irq:    float64(times.Intr),
		})
		return ret, nil
	}

	ncpu, err := unix.SysctlUint32("hw.ncpu")
	if err != nil {
		return ret, err
	}

	var i uint32
	for i = 0; i < ncpu; i++ {
		mib := []int32{ctlKern, kernCpTime, int32(i)}
		buf, _, err := common.CallSyscall(mib)
		if err != nil {
			return ret, err
		}

		stats := (*cpuTimes)(unsafe.Pointer(&buf[0]))
		ret = append(ret, TimesStat{
			CPU:    fmt.Sprintf("cpu%d", i),
			User:   float64(stats.User),
			Nice:   float64(stats.Nice),
			System: float64(stats.Sys),
			Idle:   float64(stats.Idle),
			Irq:    float64(stats.Intr),
		})
	}

	return ret, nil
}

// Returns only one (minimal) CPUInfoStat on NetBSD
func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(_ context.Context) ([]InfoStat, error) {
	var ret []InfoStat
	var err error

	c := InfoStat{}

	mhz, err := unix.Sysctl("machdep.dmi.processor-frequency")
	if err != nil {
		return nil, err
	}
	_, err = fmt.Sscanf(mhz, "%f", &c.Mhz)
	if err != nil {
		return nil, err
	}

	ncpu, err := unix.SysctlUint32("hw.ncpuonline")
	if err != nil {
		return nil, err
	}
	c.Cores = int32(ncpu)

	if c.ModelName, err = unix.Sysctl("machdep.dmi.processor-version"); err != nil {
		return nil, err
	}

	return append(ret, c), nil
}

func CountsWithContext(_ context.Context, _ bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_netbsd_amd64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_netbsd_arm.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint32
	Nice uint32
	Sys  uint32
	Intr uint32
	Idle uint32
}


================================================
FILE: cpu/cpu_netbsd_arm64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_openbsd.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build openbsd

package cpu

import (
	"context"
	"fmt"
	"runtime"
	"unsafe"

	"github.com/tklauser/go-sysconf"
	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

const (
	// sys/sched.h
	cpuOnline = 0x0001 // CPUSTATS_ONLINE

	// sys/sysctl.h
	ctlKern      = 1  // "high kernel": proc, limits
	ctlHw        = 6  // CTL_HW
	smt          = 24 // HW_SMT
	kernCpTime   = 40 // KERN_CPTIME
	kernCPUStats = 85 // KERN_CPUSTATS
)

var ClocksPerSec = float64(128)

type cpuStats struct {
	// cs_time[CPUSTATES]
	User uint64
	Nice uint64
	Sys  uint64
	Spin uint64
	Intr uint64
	Idle uint64

	// cs_flags
	Flags uint64
}

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
	ret := make([]TimesStat, 0)
	if !percpu {
		mib := []int32{ctlKern, kernCpTime}
		buf, _, err := common.CallSyscall(mib)
		if err != nil {
			return ret, err
		}
		times := (*cpuTimes)(unsafe.Pointer(&buf[0]))
		ret = append(ret, TimesStat{
			CPU:    "cpu-total",
			User:   float64(times.User) / ClocksPerSec,
			Nice:   float64(times.Nice) / ClocksPerSec,
			System: float64(times.Sys) / ClocksPerSec,
			Idle:   float64(times.Idle) / ClocksPerSec,
			Irq:    float64(times.Intr) / ClocksPerSec,
		})
		return ret, nil
	}

	ncpu, err := unix.SysctlUint32("hw.ncpu")
	if err != nil {
		return ret, err
	}

	var i uint32
	for i = 0; i < ncpu; i++ {
		mib := []int32{ctlKern, kernCPUStats, int32(i)}
		buf, _, err := common.CallSyscall(mib)
		if err != nil {
			return ret, err
		}

		stats := (*cpuStats)(unsafe.Pointer(&buf[0]))
		if (stats.Flags & cpuOnline) == 0 {
			continue
		}
		ret = append(ret, TimesStat{
			CPU:    fmt.Sprintf("cpu%d", i),
			User:   float64(stats.User) / ClocksPerSec,
			Nice:   float64(stats.Nice) / ClocksPerSec,
			System: float64(stats.Sys) / ClocksPerSec,
			Idle:   float64(stats.Idle) / ClocksPerSec,
			Irq:    float64(stats.Intr) / ClocksPerSec,
		})
	}

	return ret, nil
}

// Returns only one (minimal) CPUInfoStat on OpenBSD
func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(_ context.Context) ([]InfoStat, error) {
	var ret []InfoStat
	var err error

	c := InfoStat{}

	mhz, err := unix.SysctlUint32("hw.cpuspeed")
	if err != nil {
		return nil, err
	}
	c.Mhz = float64(mhz)

	ncpu, err := unix.SysctlUint32("hw.ncpuonline")
	if err != nil {
		return nil, err
	}
	c.Cores = int32(ncpu)

	if c.ModelName, err = unix.Sysctl("hw.model"); err != nil {
		return nil, err
	}

	return append(ret, c), nil
}

func CountsWithContext(_ context.Context, _ bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_openbsd_386.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint32
	Nice uint32
	Sys  uint32
	Spin uint32
	Intr uint32
	Idle uint32
}


================================================
FILE: cpu/cpu_openbsd_amd64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Spin uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_openbsd_arm.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint32
	Nice uint32
	Sys  uint32
	Spin uint32
	Intr uint32
	Idle uint32
}


================================================
FILE: cpu/cpu_openbsd_arm64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Spin uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_openbsd_riscv64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

type cpuTimes struct {
	User uint64
	Nice uint64
	Sys  uint64
	Spin uint64
	Intr uint64
	Idle uint64
}


================================================
FILE: cpu/cpu_plan9.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build plan9

package cpu

import (
	"context"
	"os"
	"runtime"

	stats "github.com/lufia/plan9stats"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(ctx context.Context, _ bool) ([]TimesStat, error) {
	// BUG: percpu flag is not supported yet.
	root := os.Getenv("HOST_ROOT")
	c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root))
	if err != nil {
		return nil, err
	}
	s, err := stats.ReadCPUStats(ctx, stats.WithRootDir(root))
	if err != nil {
		return nil, err
	}
	return []TimesStat{
		{
			CPU:    c.Name,
			User:   s.User.Seconds(),
			System: s.Sys.Seconds(),
			Idle:   s.Idle.Seconds(),
		},
	}, nil
}

func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(_ context.Context) ([]InfoStat, error) {
	return []InfoStat{}, common.ErrNotImplementedError
}

func CountsWithContext(_ context.Context, _ bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_plan9_test.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build plan9

package cpu

import (
	"errors"
	"path/filepath"
	"testing"

	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var timesTests = []struct {
	mockedRootFS string
	stats        []TimesStat
}{
	{
		"2cores",
		[]TimesStat{
			{
				CPU:    "Core i7/Xeon",
				User:   2780.0 / 1000.0,
				System: 30020.0 / 1000.0,
				Idle:   (1412961713341830*2)/1000000000.0 - 2.78 - 30.02,
			},
		},
	},
}

func TestTimesPlan9(t *testing.T) {
	for _, tt := range timesTests {
		t.Run(tt.mockedRootFS, func(t *testing.T) {
			t.Setenv("HOST_ROOT", filepath.Join("testdata", "plan9", tt.mockedRootFS))
			stats, err := Times(false)
			if errors.Is(err, common.ErrNotImplementedError) {
				t.Skip("not implemented")
			}
			require.NoError(t, err)
			eps := cmpopts.EquateApprox(0, 0.00000001)
			assert.Truef(t, cmp.Equal(stats, tt.stats, eps), "got: %+v\nwant: %+v", stats, tt.stats)
		})
	}
}


================================================
FILE: cpu/cpu_solaris.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"context"
	"errors"
	"fmt"
	"regexp"
	"runtime"
	"sort"
	"strconv"
	"strings"

	"github.com/tklauser/go-sysconf"
)

var ClocksPerSec = float64(128)

func init() {
	clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	// ignore errors
	if err == nil {
		ClocksPerSec = float64(clkTck)
	}
}

// sum all values in a float64 map with float64 keys
func msum(x map[float64]float64) float64 {
	total := 0.0
	for _, y := range x {
		total += y
	}
	return total
}

func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

var kstatSplit = regexp.MustCompile(`[:\s]+`)

func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
	kstatSysOut, err := invoke.CommandWithContext(ctx, "kstat", "-p", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/")
	if err != nil {
		return nil, fmt.Errorf("cannot execute kstat: %w", err)
	}
	cpu := make(map[float64]float64)
	idle := make(map[float64]float64)
	user := make(map[float64]float64)
	kern := make(map[float64]float64)
	iowt := make(map[float64]float64)
	// swap := make(map[float64]float64)
	for _, line := range strings.Split(string(kstatSysOut), "\n") {
		fields := kstatSplit.Split(line, -1)
		if fields[0] != "cpu_stat" {
			continue
		}
		cpuNumber, err := strconv.ParseFloat(fields[1], 64)
		if err != nil {
			return nil, fmt.Errorf("cannot parse cpu number: %w", err)
		}
		cpu[cpuNumber] = cpuNumber
		switch fields[3] {
		case "idle":
			idle[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
			if err != nil {
				return nil, fmt.Errorf("cannot parse idle: %w", err)
			}
		case "user":
			user[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
			if err != nil {
				return nil, fmt.Errorf("cannot parse user: %w", err)
			}
		case "kernel":
			kern[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
			if err != nil {
				return nil, fmt.Errorf("cannot parse kernel: %w", err)
			}
		case "iowait":
			iowt[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
			if err != nil {
				return nil, fmt.Errorf("cannot parse iowait: %w", err)
			}
			// not sure how this translates, don't report, add to kernel, something else?
			/*case "swap":
			swap[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
			if err != nil {
				return nil, fmt.Errorf("cannot parse swap: %s", err)
			} */
		}
	}
	ret := make([]TimesStat, 0, len(cpu))
	if percpu {
		for _, c := range cpu {
			ct := &TimesStat{
				CPU:    fmt.Sprintf("cpu%d", int(cpu[c])),
				Idle:   idle[c] / ClocksPerSec,
				User:   user[c] / ClocksPerSec,
				System: kern[c] / ClocksPerSec,
				Iowait: iowt[c] / ClocksPerSec,
			}
			ret = append(ret, *ct)
		}
	} else {
		ct := &TimesStat{
			CPU:    "cpu-total",
			Idle:   msum(idle) / ClocksPerSec,
			User:   msum(user) / ClocksPerSec,
			System: msum(kern) / ClocksPerSec,
			Iowait: msum(iowt) / ClocksPerSec,
		}
		ret = append(ret, *ct)
	}
	return ret, nil
}

func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
	psrInfoOut, err := invoke.CommandWithContext(ctx, "psrinfo", "-p", "-v")
	if err != nil {
		return nil, fmt.Errorf("cannot execute psrinfo: %w", err)
	}

	procs, err := parseProcessorInfo(string(psrInfoOut))
	if err != nil {
		return nil, fmt.Errorf("error parsing psrinfo output: %w", err)
	}

	isaInfoOut, err := invoke.CommandWithContext(ctx, "isainfo", "-b", "-v")
	if err != nil {
		return nil, fmt.Errorf("cannot execute isainfo: %w", err)
	}

	flags, err := parseISAInfo(string(isaInfoOut))
	if err != nil {
		return nil, fmt.Errorf("error parsing isainfo output: %w", err)
	}

	result := make([]InfoStat, 0, len(flags))
	for i := range procs {
		procWithFlags := procs[i]
		procWithFlags.Flags = flags
		result = append(result, procWithFlags)
	}

	return result, nil
}

var flagsMatch = regexp.MustCompile(`[\w.]+`)

func parseISAInfo(cmdOutput string) ([]string, error) {
	words := flagsMatch.FindAllString(cmdOutput, -1)

	// Sanity check the output
	if len(words) < 4 || words[1] != "bit" || words[3] != "applications" {
		return nil, errors.New("attempted to parse invalid isainfo output")
	}

	flags := words[4:]
	sort.Strings(flags)

	return flags, nil
}

var psrInfoMatch = regexp.MustCompile(`The physical processor has (?:([\d]+) virtual processors? \(([\d-]+)\)|([\d]+) cores and ([\d]+) virtual processors[^\n]+)\n(?:\s+ The core has.+\n)*\s+.+ \((\w+) ([\S]+) family (.+) model (.+) step (.+) clock (.+) MHz\)\n[\s]*(.*)`)

const (
	psrNumCoresOffset   = 1
	psrNumCoresHTOffset = 3
	psrNumHTOffset      = 4
	psrVendorIDOffset   = 5
	psrFamilyOffset     = 7
	psrModelOffset      = 8
	psrStepOffset       = 9
	psrClockOffset      = 10
	psrModelNameOffset  = 11
)

func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) {
	matches := psrInfoMatch.FindAllStringSubmatch(cmdOutput, -1)

	var infoStatCount int32
	result := make([]InfoStat, 0, len(matches))
	for physicalIndex, physicalCPU := range matches {
		var step int32
		var clock float64

		if physicalCPU[psrStepOffset] != "" {
			stepParsed, err := strconv.ParseInt(physicalCPU[psrStepOffset], 10, 32)
			if err != nil {
				return nil, fmt.Errorf("cannot parse value %q for step as 32-bit integer: %w", physicalCPU[9], err)
			}
			step = int32(stepParsed)
		}

		if physicalCPU[psrClockOffset] != "" {
			clockParsed, err := strconv.ParseInt(physicalCPU[psrClockOffset], 10, 64)
			if err != nil {
				return nil, fmt.Errorf("cannot parse value %q for clock as 32-bit integer: %w", physicalCPU[10], err)
			}
			clock = float64(clockParsed)
		}

		var err error
		var numCores int64
		var numHT int64
		switch {
		case physicalCPU[psrNumCoresOffset] != "":
			numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresOffset], 10, 32)
			if err != nil {
				return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %w", physicalCPU[1], err)
			}

			for i := 0; i < int(numCores); i++ {
				result = append(result, InfoStat{
					CPU:        infoStatCount,
					PhysicalID: strconv.Itoa(physicalIndex),
					CoreID:     strconv.Itoa(i),
					Cores:      1,
					VendorID:   physicalCPU[psrVendorIDOffset],
					ModelName:  physicalCPU[psrModelNameOffset],
					Family:     physicalCPU[psrFamilyOffset],
					Model:      physicalCPU[psrModelOffset],
					Stepping:   step,
					Mhz:        clock,
				})
				infoStatCount++
			}
		case physicalCPU[psrNumCoresHTOffset] != "":
			numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresHTOffset], 10, 32)
			if err != nil {
				return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %w", physicalCPU[3], err)
			}

			numHT, err = strconv.ParseInt(physicalCPU[psrNumHTOffset], 10, 32)
			if err != nil {
				return nil, fmt.Errorf("cannot parse value %q for hyperthread count as 32-bit integer: %w", physicalCPU[4], err)
			}

			for i := 0; i < int(numCores); i++ {
				result = append(result, InfoStat{
					CPU:        infoStatCount,
					PhysicalID: strconv.Itoa(physicalIndex),
					CoreID:     strconv.Itoa(i),
					Cores:      int32(numHT) / int32(numCores),
					VendorID:   physicalCPU[psrVendorIDOffset],
					ModelName:  physicalCPU[psrModelNameOffset],
					Family:     physicalCPU[psrFamilyOffset],
					Model:      physicalCPU[psrModelOffset],
					Stepping:   step,
					Mhz:        clock,
				})
				infoStatCount++
			}
		default:
			return nil, errors.New("values for cores with and without hyperthreading are both set")
		}
	}
	return result, nil
}

func CountsWithContext(_ context.Context, _ bool) (int, error) {
	return runtime.NumCPU(), nil
}


================================================
FILE: cpu/cpu_solaris_test.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"os"
	"path/filepath"
	"reflect"
	"sort"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestParseISAInfo(t *testing.T) {
	cases := []struct {
		filename string
		expected []string
	}{
		{
			"1cpu_1core_isainfo.txt",
			[]string{
				"rdseed", "adx", "avx2", "fma", "bmi2", "bmi1", "rdrand", "f16c", "vmx",
				"avx", "xsave", "pclmulqdq", "aes", "movbe", "sse4.2", "sse4.1", "ssse3", "popcnt",
				"tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8",
				"tsc", "fpu",
			},
		},
		{
			"2cpu_1core_isainfo.txt",
			[]string{
				"rdseed", "adx", "avx2", "fma", "bmi2", "bmi1", "rdrand", "f16c", "vmx",
				"avx", "xsave", "pclmulqdq", "aes", "movbe", "sse4.2", "sse4.1", "ssse3", "popcnt",
				"tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8",
				"tsc", "fpu",
			},
		},
		{
			"2cpu_8core_isainfo.txt",
			[]string{
				"vmx", "avx", "xsave", "pclmulqdq", "aes", "sse4.2", "sse4.1", "ssse3", "popcnt",
				"tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8",
				"tsc", "fpu",
			},
		},
		{
			"2cpu_12core_isainfo.txt",
			[]string{
				"amd_svm", "amd_lzcnt", "popcnt", "amd_sse4a", "tscp", "ahf", "cx16", "sse3", "sse2",
				"sse", "fxsr", "amd_3dnowx", "amd_3dnow", "amd_mmx", "mmx", "cmov", "amd_sysc", "cx8", "tsc", "fpu",
			},
		},
	}

	for _, tc := range cases {
		content, err := os.ReadFile(filepath.Join("testdata", "solaris", tc.filename))
		require.NoErrorf(t, err, "cannot read test case: %s", err)

		sort.Strings(tc.expected)

		flags, err := parseISAInfo(string(content))
		require.NoErrorf(t, err, "parseISAInfo: %s", err)

		require.Truef(t, reflect.DeepEqual(tc.expected, flags), "Bad flags\nExpected: %v\n   Actual: %v", tc.expected, flags)
	}
}

func TestParseProcessorInfo(t *testing.T) {
	cases := []struct {
		filename string
		expected []InfoStat
	}{
		{
			"1cpu_1core_psrinfo.txt",
			[]InfoStat{
				{CPU: 0, VendorID: "GenuineIntel", Family: "6", Model: "78", Stepping: 3, PhysicalID: "0", CoreID: "0", Cores: 1, ModelName: "Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz", Mhz: 3312},
			},
		},
		{
			"2cpu_1core_psrinfo.txt",
			[]InfoStat{
				{CPU: 0, VendorID: "GenuineIntel", Family: "6", Model: "78", Stepping: 3, PhysicalID: "0", CoreID: "0", Cores: 1, ModelName: "Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz", Mhz: 3312},
				{CPU: 1, VendorID: "GenuineIntel", Family: "6", Model: "78", Stepping: 3, PhysicalID: "1", CoreID: "0", Cores: 1, ModelName: "Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz", Mhz: 3312},
			},
		},
		{
			"2cpu_8core_psrinfo.txt",
			[]InfoStat{
				{CPU: 0, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "0", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 1, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "1", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 2, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "2", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 3, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "3", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 4, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "4", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 5, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "5", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 6, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "6", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 7, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "0", CoreID: "7", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 8, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "0", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 9, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "1", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 10, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "2", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 11, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "3", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 12, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "4", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 13, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "5", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 14, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "6", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
				{CPU: 15, VendorID: "GenuineIntel", Family: "6", Model: "45", Stepping: 7, PhysicalID: "1", CoreID: "7", Cores: 2, ModelName: "Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz", Mhz: 2600},
			},
		},
		{
			"2cpu_12core_psrinfo.txt",
			[]InfoStat{
				{CPU: 0, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "0", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 1, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "1", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 2, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "2", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 3, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "3", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 4, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "4", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 5, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "5", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 6, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "6", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 7, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "7", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 8, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "8", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 9, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "9", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 10, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "10", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 11, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "0", CoreID: "11", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 12, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "0", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 13, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "1", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 14, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "2", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 15, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "3", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 16, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "4", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 17, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "5", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 18, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "6", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 19, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "7", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 20, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "8", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 21, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "9", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 22, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "10", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
				{CPU: 23, VendorID: "AuthenticAMD", Family: "16", Model: "9", Stepping: 1, PhysicalID: "1", CoreID: "11", Cores: 1, ModelName: "AMD Opteron(tm) Processor 6176\t[ Socket: G34 ]", Mhz: 2300},
			},
		},
	}

	for _, tc := range cases {
		content, err := os.ReadFile(filepath.Join("testdata", "solaris", tc.filename))
		require.NoErrorf(t, err, "cannot read test case: %s", err)

		cpus, err := parseProcessorInfo(string(content))
		require.NoErrorf(t, err, "cannot parse processor info: %s", err)

		require.Truef(t, reflect.DeepEqual(tc.expected, cpus), "Bad Processor Info\nExpected: %v\n   Actual: %v", tc.expected, cpus)
	}
}


================================================
FILE: cpu/cpu_test.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package cpu

import (
	"errors"
	"os"
	"runtime"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func TestTimes(t *testing.T) {
	v, err := Times(false)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.NotEmptyf(t, v, "could not get CPUs: %s", err)
	empty := TimesStat{}
	for _, vv := range v {
		assert.NotEqualf(t, vv, empty, "could not get CPU User: %v", vv)
	}

	// test sum of per cpu stats is within margin of error for cpu total stats
	cpuTotal, err := Times(false)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.NotEmptyf(t, cpuTotal, "could not get CPUs: %s", err)
	perCPU, err := Times(true)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.NotEmptyf(t, perCPU, "could not get CPUs: %s", err)
	var perCPUUserTimeSum float64
	var perCPUSystemTimeSum float64
	var perCPUIdleTimeSum float64
	for _, pc := range perCPU {
		perCPUUserTimeSum += pc.User
		perCPUSystemTimeSum += pc.System
		perCPUIdleTimeSum += pc.Idle
	}
	margin := 2.0
	t.Log(cpuTotal[0])

	if cpuTotal[0].User == 0 && cpuTotal[0].System == 0 && cpuTotal[0].Idle == 0 {
		t.Error("could not get cpu values")
	}
	if cpuTotal[0].User != 0 {
		assert.InEpsilon(t, cpuTotal[0].User, perCPUUserTimeSum, margin)
	}
	if cpuTotal[0].System != 0 {
		assert.InEpsilon(t, cpuTotal[0].System, perCPUSystemTimeSum, margin)
	}
	if cpuTotal[0].Idle != 0 {
		assert.InEpsilon(t, cpuTotal[0].Idle, perCPUIdleTimeSum, margin)
	}
}

func TestCounts(t *testing.T) {
	logicalCount, err := Counts(true)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.NotZerof(t, logicalCount, "could not get logical CPU counts: %v", logicalCount)
	t.Logf("logical cores: %d", logicalCount)
	physicalCount, err := Counts(false)
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.NotZerof(t, physicalCount, "could not get physical CPU counts: %v", physicalCount)
	t.Logf("physical cores: %d", physicalCount)
	assert.GreaterOrEqualf(t, logicalCount, physicalCount, "logical CPU count should be greater than or equal to physical CPU count: %v >= %v", logicalCount, physicalCount)
}

func TestTimeStat_String(t *testing.T) {
	v := TimesStat{
		CPU:    "cpu0",
		User:   100.1,
		System: 200.1,
		Idle:   300.1,
	}
	e := `{"cpu":"cpu0","user":100.1,"system":200.1,"idle":300.1,"nice":0.0,"iowait":0.0,"irq":0.0,"softirq":0.0,"steal":0.0,"guest":0.0,"guestNice":0.0}`
	assert.JSONEqf(t, e, v.String(), "CPUTimesStat string is invalid: %v", v)
}

func TestInfo(t *testing.T) {
	v, err := Info()
	if errors.Is(err, common.ErrNotImplementedError) {
		t.Skip("not implemented")
	}
	require.NoError(t, err)
	assert.NotEmptyf(t, v, "could not get CPU Info")
	for _, vv := range v {
		assert.NotEmptyf(t, vv.ModelName, "could not get CPU Info: %v", vv)
		if runtime.GOOS == "windows" {
			assert.NotEmptyf(t, vv.VendorID, "could not get Vendor ID: %v", vv)
			assert.NotEmptyf(t, vv.Family, "could not get CPU Family: %v", vv)
			assert.Positivef(t, vv.Mhz, "could not get CPU Mhz: %v", vv)
			assert.Positivef(t, vv.Cores, "could not get CPU Cores: %v", vv)
		}
	}
	t.Log(v)
}

func testPercent(t *testing.T, percpu bool) {
	t.Helper()
	numcpu := runtime.NumCPU()
	testCount := 3

	if runtime.GOOS != "windows" {
		testCount = 100
		v, err := Percent(time.Millisecond, percpu)
		if errors.Is(err, common.ErrNotImplementedError) {
			t.Skip("not implemented")
		}
		require.NoError(t, err)
		// Skip CI which CPU num is different
		if os.Getenv("CI") != "true" {
			if (percpu && len(v) != numcpu) || (!percpu && len(v) != 1) {
				t.Fatalf("wrong number of entries from CPUPercent: %v", v)
			}
		}
	}
	for i := 0; i < testCount; i++ {
		duration := time.Duration(10) * time.Microsecond
		v, err := Percent(duration, percpu)
		if errors.Is(err, common.ErrNotImplementedError) {
			t.Skip("not implemented")
		}
		require.NoError(t, err)
		for _, percent := range v {
			// Check for slightly greater then 100% to account for any rounding issues.
			if percent < 0.0 || percent > 100.0001*float64(numcpu) {
				t.Fatalf("CPUPercent value is invalid: %f", percent)
			}
		}
	}
}

func testPercentLastUsed(t *testing.T, percpu bool) {
	t.Helper()
	numcpu := runtime.NumCPU()
	testCount := 10

	if runtime.GOOS != "windows" {
		testCount = 2
		v, err := Percent(time.Millisecond, percpu)
		if errors.Is(err, common.ErrNotImplementedError) {
			t.Skip("not implemented")
		}
		require.NoError(t, err)
		// Skip CI which CPU num is different
		if os.Getenv("CI") != "true" {
			if (percpu && len(v) != numcpu) || (!percpu && len(v) != 1) {
				t.Fatalf("wrong number of entries from CPUPercent: %v", v)
			}
		}
	}
	for i := 0; i < testCount; i++ {
		v, err := Percent(0, percpu)
		if errors.Is(err, common.ErrNotImplementedError) {
			t.Skip("not implemented")
		}
		require.NoError(t, err)
		time.Sleep(1 * time.Millisecond)
		for _, percent := range v {
			// Check for slightly greater then 100% to account for any rounding issues.
			if percent < 0.0 || percent > 100.0001*float64(numcpu) {
				t.Fatalf("CPUPercent value is invalid: %f", percent)
			}
		}
	}
}

func TestPercent(t *testing.T) {
	testPercent(t, false)
}

func TestPercentPerCpu(t *testing.T) {
	testPercent(t, true)
}

func TestPercentIntervalZero(t *testing.T) {
	testPercentLastUsed(t, false)
}

func TestPercentIntervalZeroPerCPU(t *testing.T) {
	testPercentLastUsed(t, true)
}


================================================
FILE: cpu/cpu_windows.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build windows

package cpu

import (
	"context"
	"errors"
	"fmt"
	"math/bits"
	"path/filepath"
	"strconv"
	"strings"
	"syscall"
	"unsafe"

	"golang.org/x/sys/windows"
	"golang.org/x/sys/windows/registry"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var (
	procGetNativeSystemInfo              = common.Modkernel32.NewProc("GetNativeSystemInfo")
	procGetLogicalProcessorInformationEx = common.Modkernel32.NewProc("GetLogicalProcessorInformationEx")
	procGetSystemFirmwareTable           = common.Modkernel32.NewProc("GetSystemFirmwareTable")
	procCallNtPowerInformation           = common.ModPowrProf.NewProc("CallNtPowerInformation")
)

type win32_Processor struct { //nolint:revive //FIXME
	Family                    uint16
	Manufacturer              string
	Name                      string
	NumberOfLogicalProcessors uint32
	NumberOfCores             uint32
	ProcessorID               *string
	Stepping                  *string
	MaxClockSpeed             uint32
}

// SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
// defined in windows api doc with the following
// https://docs.microsoft.com/en-us/windows/desktop/api/winternl/nf-winternl-ntquerysysteminformation#system_processor_performance_information
// additional fields documented here
// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/processor_performance.htm
type win32_SystemProcessorPerformanceInformation struct { //nolint:revive //FIXME
	IdleTime       int64  // idle time in 100ns (this is not a filetime).
	KernelTime     int64  // kernel time in 100ns.  kernel time includes idle time. (this is not a filetime).
	UserTime       int64  // usertime in 100ns (this is not a filetime).
	DpcTime        int64  // dpc time in 100ns (this is not a filetime).
	InterruptTime  int64  // interrupt time in 100ns
	InterruptCount uint64 // ULONG needs to be uint64
}

// https://learn.microsoft.com/en-us/windows/win32/power/processor-power-information-str
type processorPowerInformation struct {
	number           uint32 // http://download.microsoft.com/download/a/d/f/adf1347d-08dc-41a4-9084-623b1194d4b2/MoreThan64proc.docx
	maxMhz           uint32
	currentMhz       uint32
	mhzLimit         uint32
	maxIdleState     uint32
	currentIdleState uint32
}

const (
	ClocksPerSec = 10000000.0

	// systemProcessorPerformanceInformationClass information class to query with NTQuerySystemInformation
	// https://processhacker.sourceforge.io/doc/ntexapi_8h.html#ad5d815b48e8f4da1ef2eb7a2f18a54e0
	win32_SystemProcessorPerformanceInformationClass = 8 //nolint:revive //FIXME

	// size of systemProcessorPerformanceInfoSize in memory
	win32_SystemProcessorPerformanceInfoSize = uint32(unsafe.Sizeof(win32_SystemProcessorPerformanceInformation{})) //nolint:revive //FIXME

	firmwareTableProviderSignatureRSMB = 0x52534d42 // "RSMB"  https://gitlab.winehq.org/dreamer/wine/-/blame/wine-7.0-rc6/dlls/ntdll/unix/system.c#L230
	smBiosHeaderSize                   = 8          // SMBIOS header size
	smbiosEndOfTable                   = 127        // Minimum length for processor structure
	smbiosTypeProcessor                = 4          // SMBIOS Type 4: Processor Information
	smbiosProcessorMinLength           = 0x18       // Minimum length for processor structure

	centralProcessorRegistryKey = `HARDWARE\DESCRIPTION\System\CentralProcessor`
)

type relationship uint32

// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlogicalprocessorinformationex
const (
	relationProcessorCore    = relationship(0)
	relationProcessorPackage = relationship(3)
)

const (
	kAffinitySize = unsafe.Sizeof(int(0))
	// https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority
	maxLogicalProcessorsPerGroup = uint32(unsafe.Sizeof(kAffinitySize * 8))
	// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ne-wdm-power_information_level
	processorInformation = 11
)

// Times returns times stat per cpu and combined for all CPUs
func Times(percpu bool) ([]TimesStat, error) {
	return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
	if percpu {
		return perCPUTimes()
	}

	var ret []TimesStat
	var lpIdleTime common.FILETIME
	var lpKernelTime common.FILETIME
	var lpUserTime common.FILETIME
	// GetSystemTimes returns 0 for error, in which case we check err,
	// see https://pkg.go.dev/golang.org/x/sys/windows#LazyProc.Call
	r, _, err := common.ProcGetSystemTimes.Call(
		uintptr(unsafe.Pointer(&lpIdleTime)),
		uintptr(unsafe.Pointer(&lpKernelTime)),
		uintptr(unsafe.Pointer(&lpUserTime)))
	if r == 0 {
		return nil, err
	}

	LOT := float64(0.0000001)
	HIT := (LOT * 4294967296.0)
	idle := ((HIT * float64(lpIdleTime.DwHighDateTime)) + (LOT * float64(lpIdleTime.DwLowDateTime)))
	user := ((HIT * float64(lpUserTime.DwHighDateTime)) + (LOT * float64(lpUserTime.DwLowDateTime)))
	kernel := ((HIT * float64(lpKernelTime.DwHighDateTime)) + (LOT * float64(lpKernelTime.DwLowDateTime)))
	system := (kernel - idle)

	ret = append(ret, TimesStat{
		CPU:    "cpu-total",
		Idle:   float64(idle),
		User:   float64(user),
		System: float64(system),
	})
	return ret, nil
}

func Info() ([]InfoStat, error) {
	return InfoWithContext(context.Background())
}

// this function iterates over each set bit in the package affinity mask, each bit represent a logical processor in a group (assuming you are iteriang over a package mask)
// the function is used also to compute the global logical processor number
// https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups
// see https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-group_affinity
// and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-processor_relationship
// and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-system_logical_processor_information_ex
func forEachSetBit64(mask uint64, fn func(bit int)) {
	m := mask
	for m != 0 {
		b := bits.TrailingZeros64(m)
		fn(b)
		m &= m - 1
	}
}

func getProcessorPowerInformation(ctx context.Context) ([]processorPowerInformation, error) {
	numLP, countErr := CountsWithContext(ctx, true)
	if countErr != nil {
		return nil, fmt.Errorf("failed to get logical processor count: %w", countErr)
	}
	if numLP <= 0 {
		return nil, fmt.Errorf("invalid logical processor count: %d", numLP)
	}

	ppiSize := uintptr(numLP) * unsafe.Sizeof(processorPowerInformation{})
	buf := make([]byte, ppiSize)
	ppi, _, err := procCallNtPowerInformation.Call(
		uintptr(processorInformation),
		0,
		0,
		uintptr(unsafe.Pointer(&buf[0])),
		uintptr(ppiSize),
	)
	if ppi != 0 {
		return nil, fmt.Errorf("CallNtPowerInformation failed with code %d: %w", ppi, err)
	}
	ppis := unsafe.Slice((*processorPowerInformation)(unsafe.Pointer(&buf[0])), numLP)
	return ppis, nil
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
	var ret []InfoStat
	processorPackages, err := getSystemLogicalProcessorInformationEx(relationProcessorPackage)
	if err != nil {
		return ret, fmt.Errorf("failed to get processor package information: %w", err)
	}

	ppis, powerInformationErr := getProcessorPowerInformation(ctx)
	if powerInformationErr != nil {
		return ret, fmt.Errorf("failed to get processor power information: %w", powerInformationErr)
	}

	family, processorId, smBIOSErr := getSMBIOSProcessorInfo()
	if smBIOSErr != nil {
		return ret, smBIOSErr
	}

	for i, pkg := range processorPackages {
		logicalCount := 0
		maxMhz := 0
		model := ""
		vendorId := ""
		// iterate over each set bit in the package affinity mask
		for _, ga := range pkg.processor.groupMask {
			g := int(ga.group)
			forEachSetBit64(uint64(ga.mask), func(bit int) {
				// the global logical processor label
				globalLpl := g*int(maxLogicalProcessorsPerGroup) + bit
				if globalLpl >= 0 && globalLpl < len(ppis) {
					logicalCount++
					m := int(ppis[globalLpl].maxMhz)
					if m > maxMhz {
						maxMhz = m
					}
				}

				registryKeyPath := filepath.Join(centralProcessorRegistryKey, strconv.Itoa(globalLpl))
				key, err := registry.OpenKey(registry.LOCAL_MACHINE, registryKeyPath, registry.QUERY_VALUE|registry.READ)
				if err == nil {
					model = getRegistryStringValueIfUnset(key, "ProcessorNameString", model)
					vendorId = getRegistryStringValueIfUnset(key, "VendorIdentifier", vendorId)
					_ = key.Close()
				}
			})
		}
		ret = append(ret, InfoStat{
			CPU:        int32(i),
			Family:     strconv.FormatUint(uint64(family), 10),
			VendorID:   vendorId,
			ModelName:  model,
			Cores:      int32(logicalCount),
			PhysicalID: processorId,
			Mhz:        float64(maxMhz),
			Flags:      []string{},
		})
	}

	return ret, nil
}

// perCPUTimes returns times stat per cpu, per core and overall for all CPUs
func perCPUTimes() ([]TimesStat, error) {
	var ret []TimesStat
	stats, err := perfInfo()
	if err != nil {
		return nil, err
	}
	for core, v := range stats {
		c := TimesStat{
			CPU:    fmt.Sprintf("cpu%d", core),
			User:   float64(v.UserTime) / ClocksPerSec,
			System: float64(v.KernelTime-v.IdleTime) / ClocksPerSec,
			Idle:   float64(v.IdleTime) / ClocksPerSec,
			Irq:    float64(v.InterruptTime) / ClocksPerSec,
		}
		ret = append(ret, c)
	}
	return ret, nil
}

// makes call to Windows API function to retrieve performance information for each core
func perfInfo() ([]win32_SystemProcessorPerformanceInformation, error) {
	// Make maxResults large for safety.
	// We can't invoke the api call with a results array that's too small.
	// If we have more than 2056 cores on a single host, then it's probably the future.
	maxBuffer := 2056
	// buffer for results from the windows proc
	resultBuffer := make([]win32_SystemProcessorPerformanceInformation, maxBuffer)
	// size of the buffer in memory
	bufferSize := uintptr(win32_SystemProcessorPerformanceInfoSize) * uintptr(maxBuffer)
	// size of the returned response
	var retSize uint32

	// Invoke windows api proc.
	// The returned err from the windows dll proc will always be non-nil even when successful.
	// See https://godoc.org/golang.org/x/sys/windows#LazyProc.Call for more information
	retCode, _, err := common.ProcNtQuerySystemInformation.Call(
		win32_SystemProcessorPerformanceInformationClass, // System Information Class -> SystemProcessorPerformanceInformation
		uintptr(unsafe.Pointer(&resultBuffer[0])),        // pointer to first element in result buffer
		bufferSize,                        // size of the buffer in memory
		uintptr(unsafe.Pointer(&retSize)), // pointer to the size of the returned results the windows proc will set this
	)

	// check return code for errors
	if retCode != 0 {
		return nil, fmt.Errorf("call to NtQuerySystemInformation returned %d. err: %s", retCode, err.Error())
	}

	// calculate the number of returned elements based on the returned size
	numReturnedElements := retSize / win32_SystemProcessorPerformanceInfoSize

	// trim results to the number of returned elements
	resultBuffer = resultBuffer[:numReturnedElements]

	return resultBuffer, nil
}

// SystemInfo is an equivalent representation of SYSTEM_INFO in the Windows API.
// https://msdn.microsoft.com/en-us/library/ms724958%28VS.85%29.aspx?f=255&MSPPError=-2147217396
// https://github.com/elastic/go-windows/blob/bb1581babc04d5cb29a2bfa7a9ac6781c730c8dd/kernel32.go#L43
type systemInfo struct {
	wProcessorArchitecture      uint16
	wReserved                   uint16
	dwPageSize                  uint32
	lpMinimumApplicationAddress uintptr
	lpMaximumApplicationAddress uintptr
	dwActiveProcessorMask       uintptr
	dwNumberOfProcessors        uint32
	dwProcessorType             uint32
	dwAllocationGranularity     uint32
	wProcessorLevel             uint16
	wProcessorRevision          uint16
}

type groupAffinity struct {
	mask     uintptr // https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority#about-kaffinity
	group    uint16
	reserved [3]uint16
}

// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-processor_relationship
type processorRelationship struct {
	flags          byte
	efficientClass byte
	reserved       [20]byte
	groupCount     uint16
	groupMask      [1]groupAffinity
}

// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-system_logical_processor_information_ex
type systemLogicalProcessorInformationEx struct {
	relationship uint32
	size         uint32
	processor    processorRelationship
}

// getSMBIOSProcessorInfo reads the SMBIOS Type 4 (Processor Information) structure and returns the Processor Family and ProcessorId fields.
// If not found, returns 0 and an empty string.
func getSMBIOSProcessorInfo() (family uint8, processorId string, err error) {
	// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemfirmwaretable
	size, _, err := procGetSystemFirmwareTable.Call(
		uintptr(firmwareTableProviderSignatureRSMB),
		0,
		0,
		0,
	)
	if size == 0 {
		return 0, "", fmt.Errorf("failed to get SMBIOS table size: %w", err)
	}
	buf := make([]byte, size)
	ret, _, err := procGetSystemFirmwareTable.Call(
		uintptr(firmwareTableProviderSignatureRSMB),
		0,
		uintptr(unsafe.Pointer(&buf[0])),
		uintptr(size),
	)
	if ret == 0 {
		return 0, "", fmt.Errorf("failed to read SMBIOS table: %w", err)
	}
	// https://wiki.osdev.org/System_Management_BIOS
	i := smBiosHeaderSize // skip SMBIOS header (first 8 bytes)
	maxIterations := len(buf) * 2
	iterations := 0
	for i < len(buf) && iterations < maxIterations {
		iterations++
		if i+4 > len(buf) {
			break
		}
		typ := buf[i]
		length := buf[i+1]
		if typ == smbiosEndOfTable {
			break
		}
		if typ == smbiosTypeProcessor && length >= smbiosProcessorMinLength && i+int(length) <= len(buf) {
			// Ensure we have enough bytes for procIdBytes
			if i+16 > len(buf) {
				break
			}
			// Get the processor family from byte at offset 6
			family = buf[i+6]
			// Extract processor ID bytes (8 bytes total) from offsets 8-15
			procIdBytes := buf[i+8 : i+16]
			// Convert first 4 bytes to 32-bit EAX register value (little endian)
			eax := uint32(procIdBytes[0]) | uint32(procIdBytes[1])<<8 | uint32(procIdBytes[2])<<16 | uint32(procIdBytes[3])<<24
			// Convert last 4 bytes to 32-bit EDX register value (little endian)
			edx := uint32(procIdBytes[4]) | uint32(procIdBytes[5])<<8 | uint32(procIdBytes[6])<<16 | uint32(procIdBytes[7])<<24
			// Format processor ID as 16 character hex string (EDX+EAX)
			procId := fmt.Sprintf("%08X%08X", edx, eax)
			return family, procId, nil
		}
		// skip to next structure
		j := i + int(length)
		innerIterations := 0
		maxInner := len(buf) // failsafe for inner loop
		for j+1 < len(buf) && innerIterations < maxInner {
			innerIterations++
			if buf[j] == 0 && buf[j+1] == 0 {
				j += 2
				break
			}
			j++
		}
		if innerIterations >= maxInner {
			break // malformed buffer, avoid infinite loop
		}
		i = j
	}
	return 0, "", fmt.Errorf("SMBIOS processor information not found: %w", syscall.ERROR_NOT_FOUND)
}

func getSystemLogicalProcessorInformationEx(relationship relationship) ([]systemLogicalProcessorInformationEx, error) {
	var length uint32
	// First call to determine the required buffer size
	_, _, err := procGetLogicalProcessorInformationEx.Call(uintptr(relationship), 0, uintptr(unsafe.Pointer(&length)))
	if err != nil && !errors.Is(err, windows.ERROR_INSUFFICIENT_BUFFER) {
		return nil, fmt.Errorf("failed to get buffer size: %w", err)
	}

	// Allocate the buffer
	buffer := make([]byte, length)

	// Second call to retrieve the processor information
	_, _, err = procGetLogicalProcessorInformationEx.Call(uintptr(relationship), uintptr(unsafe.Pointer(&buffer[0])), uintptr(unsafe.Pointer(&length)))
	if err != nil && !errors.Is(err, windows.NTE_OP_OK) {
		return nil, fmt.Errorf("failed to get logical processor information: %w", err)
	}

	// Convert the byte slice into a slice of systemLogicalProcessorInformationEx structs
	offset := uintptr(0)
	var infos []systemLogicalProcessorInformationEx
	for offset < uintptr(length) {
		info := (*systemLogicalProcessorInformationEx)(unsafe.Pointer(uintptr(unsafe.Pointer(&buffer[0])) + offset))
		infos = append(infos, *info)
		offset += uintptr(info.size)
	}

	return infos, nil
}

func getPhysicalCoreCount() (int, error) {
	infos, err := getSystemLogicalProcessorInformationEx(relationProcessorCore)
	return len(infos), err
}

func getRegistryStringValueIfUnset(key registry.Key, keyName, value string) string {
	if value != "" {
		return value
	}
	val, _, err := key.GetStringValue(keyName)
	if err == nil {
		return strings.TrimSpace(val)
	}
	return ""
}

func CountsWithContext(_ context.Context, logical bool) (int, error) {
	if logical {
		// Get logical processor count https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_psutil_windows.c#L97
		ret := windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)
		if ret != 0 {
			return int(ret), nil
		}

		var sInfo systemInfo
		_, _, err := procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sInfo)))
		if sInfo.dwNumberOfProcessors == 0 {
			return 0, err
		}
		return int(sInfo.dwNumberOfProcessors), nil
	}

	// Get physical core count https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_psutil_windows.c#L499
	return getPhysicalCoreCount()
}


================================================
FILE: cpu/testdata/aix/prtconf
================================================
System Model: IBM pSeries (emulated by qemu)
Machine Serial Number: Not Available
Processor Type: PowerPC_POWER8
Processor Implementation Mode: POWER 8
Processor Version: PV_8_Compat
Number Of Processors: 4
Processor Clock Speed: 1000 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 0 aix_7200-04-02-2027
Memory Size: 4096 MB
Good Memory Size: 4096 MB
Platform Firmware level: Not Available
Firmware Version: SLOF,HEAD
Console Login: enable
Auto Restart: true
Full Core: false
NX Crypto Acceleration: Not Capable
In-Core Crypto Acceleration: Capable, but not Enabled
 
en0
Network Information
	Host Name: aix72-dylan
	IP Address: 192.168.124.53
	Sub Netmask: 
	Gateway: 192.168.124.1
	Name Server: 
	Domain Name: 
 
Paging Space Information
	Total Paging Space: 512MB
	Percent Used: 1%
 
Volume Groups Information
============================================================================== 
Active VGs
============================================================================== 
rootvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk0            active            999         809         199..193..17..200..200
============================================================================== 
 
INSTALLED RESOURCE LIST

The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
*   = Diagnostic support not available.
	
  Model Architecture: chrp
  Model Implementation: Uni-Processor, PCI bus
	
+ sys0                                                     System Object
+ sysplanar0                                               System Planar
* vio0                                                     Virtual I/O Bus
* ent0                                                     Virtual I/O Ethernet Adapter (l-lan)
* vscsi0                                                   Virtual SCSI Client Adapter
* cd0                                                      Virtual SCSI Optical Served by VIO Server
* vsa0                                                     LPAR Virtual Serial Adapter
* vty0                                                     Asynchronous Terminal
* pci0                                                     PCI Bus
* scsi0            qemu_virtio-scsi-pci:0000:00:02.0       Virtio SCSI Client Adapter (f41a0800)
* hdisk0           qemu_virtio-scsi-pci:0000:00:02.0-LW_0  MPIO Other Virtio SCSI Disk Drive
+ L2cache0                                                 L2 Cache
+ mem0                                                     Memory
+ proc0                                                    Processor
+ proc1                                                    Processor
+ proc2                                                    Processor
+ proc3                                                    Processor


================================================
FILE: cpu/testdata/aix/sar-u-PALL101
================================================

AIX aix72-dylan 2 7 000000000000    05/15/24

System configuration: lcpu=4 ent=4.00 mode=Capped 

11:19:03 cpu    %usr    %sys    %wio   %idle   physc   %entc
11:19:13  0        1      11       0      88    1.00    25.0
          1        0       0       0     100    1.00    25.0
          2        0       0       0     100    1.00    25.0
          3        0       0       0     100    1.00    25.0
          -        0       3       0      97    4.00   100.0


================================================
FILE: cpu/testdata/aix/sar-u101
================================================

AIX aix72-dylan 2 7 000000000000    05/15/24

System configuration: lcpu=4 ent=4.00 mode=Capped 

11:19:44    %usr    %sys    %wio   %idle   physc   %entc
11:19:54       0       3       0      96    4.00   100.0


================================================
FILE: cpu/testdata/freebsd/1cpu_2core.txt
================================================
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016
    root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
VT(vga): resolution 640x480
CPU: Intel(R) Core(TM) i3 CPU         550  @ 3.20GHz (3192.07-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x20655  Family=0x6  Model=0x25  Stepping=5
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x9ae3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 8589934592 (8192 MB)
avail memory = 8046452736 (7673 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <INTEL  DH55HC  >
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads
random: unblocking device.
ioapic0 <Version 2.0> irqs 0-23 on motherboard
random: entropy device external interface
kbd1 at kbdmux0
netmap: loaded module
module_register_init: MOD_LOAD (vesa, 0xffffffff8101c970, 0) error 19
vtvga0: <VT VGA driver> on motherboard
cryptosoft0: <software crypto> on motherboard
aesni0: No AESNI support.
acpi0: <INTEL DH55HC> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
ACPI BIOS Warning (bug): Incorrect checksum in table [SSDT] - 0x3F, should be 0x1F (20160527/tbprint-229)
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
Event timer "RTC" frequency 32768 Hz quality 0

================================================
FILE: cpu/testdata/freebsd/1cpu_4core.txt
================================================
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.3-RELEASE-p4 #0: Sat May 28 12:23:44 UTC 2016
    root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz (3700.09-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x306e4  Family=0x6  Model=0x3e  Stepping=4
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x7fbee3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  Structured Extended Features=0x281<FSGSBASE,SMEP,ERMS>
  XSAVE Features=0x1<XSAVEOPT>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr
  TSC: P-state invariant, performance statistics
real memory  = 34368126976 (32776 MB)
avail memory = 33228333056 (31689 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: < >
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 SMT threads
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  2
 cpu3 (AP): APIC ID:  3
 cpu4 (AP): APIC ID:  4
 cpu5 (AP): APIC ID:  5
 cpu6 (AP): APIC ID:  6
 cpu7 (AP): APIC ID:  7
random: <Software, Yarrow> initialized
ioapic0 <Version 2.0> irqs 0-23 on motherboard
ioapic1 <Version 2.0> irqs 24-47 on motherboard
kbd1 at kbdmux0
cryptosoft0: <software crypto> on motherboard
aesni0: <AES-CBC,AES-XTS> on motherboard
acpi0: <SUPERM SMCI--MB> on motherboard

================================================
FILE: cpu/testdata/freebsd/2cpu_4core.txt
================================================
Copyright (c) 1992-2011 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.2-RELEASE #1: Sat Mar  5 23:03:14 CET 2011
    root@host1:/usr/obj/usr/src/sys/MYKERNEL amd64
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Xeon(R) CPU           E5420  @ 2.50GHz (2500.11-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x10676  Family = 6  Model = 17  Stepping = 6
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0xce3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1>
  AMD Features=0x20100800<SYSCALL,NX,LM>
  AMD Features2=0x1<LAHF>
  TSC: P-state invariant
real memory  = 17179869184 (16384 MB)
avail memory = 16531587072 (15765 MB)
ACPI APIC Table: <PTLTD          APIC  >
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
FreeBSD/SMP: 2 package(s) x 4 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  2
 cpu3 (AP): APIC ID:  3
 cpu4 (AP): APIC ID:  4
 cpu5 (AP): APIC ID:  5
 cpu6 (AP): APIC ID:  6
 cpu7 (AP): APIC ID:  7
ioapic0 <Version 2.0> irqs 0-23 on motherboard
ioapic1 <Version 2.0> irqs 24-47 on motherboard
kbd1 at kbdmux0
acpi0: <PTLTD    XSDT> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
unknown: I/O range not supported
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
cpu4: <ACPI CPU> on acpi0
cpu5: <ACPI CPU> on acpi0
cpu6: <ACPI CPU> on acpi0
cpu7: <ACPI CPU> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0

================================================
FILE: cpu/testdata/linux/1037/proc/cpuinfo
================================================
processor	: 0
Processor	: ARMv7 Processor rev 4 (v7l)
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 42.43
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 1
Processor	: ARMv7 Processor rev 4 (v7l)
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 42.43
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 2
Processor	: ARMv7 Processor rev 4 (v7l)
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 42.43
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 3
Processor	: ARMv7 Processor rev 4 (v7l)
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 42.43
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 4
Processor	: ARMv7 Processor rev 2 (v7l)
model name	: ARMv7 Processor rev 2 (v7l)
BogoMIPS	: 29.52
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd09
CPU revision	: 2

processor	: 5
Processor	: ARMv7 Processor rev 2 (v7l)
model name	: ARMv7 Processor rev 2 (v7l)
BogoMIPS	: 29.52
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd09
CPU revision	: 2

processor	: 6
Processor	: ARMv7 Processor rev 2 (v7l)
model name	: ARMv7 Processor rev 2 (v7l)
BogoMIPS	: 29.52
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd09
CPU revision	: 2

processor	: 7
Processor	: ARMv7 Processor rev 2 (v7l)
model name	: ARMv7 Processor rev 2 (v7l)
BogoMIPS	: 29.52
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd09
CPU revision	: 2

Hardware	: MT8183
Revision	: 0000
Serial		: 29aa1cf5ba0159c3


================================================
FILE: cpu/testdata/linux/1958/proc/cpuinfo
================================================
processor	: 0
vendor_id	: HygonGenuine
cpu family	: 24
model		: 6
model name	: Hygon C86-4G (OPN:5435)
stepping	: 1
microcode	: 0x90610009
cpu MHz		: 2799.751
cache size	: 512 KB
physical id	: 0
siblings	: 32
core id		: 0
cpu cores	: 16
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 16
wp		: yes
flags		: fpu vme de pse
bogomips	: 5599.50


================================================
FILE: cpu/testdata/linux/424/proc/stat
================================================
cpu  23644 6695 4764 134931750 22115 0 473 5892 0 0
cpu0 6418 888 1230 33730755 5043 0 4 1046 0 0
cpu1 6858 4870 1632 33716510 12327 0 235 1765 0 0
cpu2 4859 622 915 33742072 2312 0 25 1546 0 0
cpu3 5507 314 986 33742411 2432 0 208 1534 0 0
intr 32552791 35 9 0 0 2335 0 3 0 2 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3107077 2985327 15704 0 6672 0 3218027 3063711 11558 0 6151 0 2160633 2194945 15838 0 6565 0 1595129 2134446 15337 0 5715 0 157 112837 717318 710764 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 41317767
btime 1505515383
processes 41562
procs_running 1
procs_blocked 0
softirq 5433315 0 1644387 67542 1428221 0 0 12270 1573783 0 707112

================================================
FILE: cpu/testdata/linux/times_empty/proc/stat
================================================


================================================
FILE: cpu/testdata/plan9/2cores/dev/cputype
================================================
Core i7/Xeon 2403


================================================
FILE: cpu/testdata/plan9/2cores/dev/sysstat
================================================
          0    59251106    37524162     1208203       65907           0           0           7         100           0 
          1   219155408    28582838     5017097     1002072           0           0           0          98           1 


================================================
FILE: cpu/testdata/plan9/2cores/dev/time
================================================
 1633882064   1633882064926300833      2825920097745864            1999997644 

================================================
FILE: cpu/testdata/plan9/2cores/proc/1/status
================================================
init                        bootes                      Await                10          20  1404307210         110          20           0         116          10          10 

================================================
FILE: cpu/testdata/plan9/2cores/proc/331/.gitkeep
================================================


================================================
FILE: cpu/testdata/plan9/2cores/proc/54384/status
================================================
rc                          lufia                       Await                 0           0      589160        8770        3260           0         248          10          10 

================================================
FILE: cpu/testdata/plan9/2cores/proc/54412/status
================================================
git-remote-https            lufia                       Semacquire          390         310      370670           0           0           0       98368          10          10 

================================================
FILE: cpu/testdata/plan9/2cores/proc/72/status
================================================
httpd                       none                        Open               2380       29690  1404804330           0           0           0       23616          10          10 

================================================
FILE: cpu/testdata/solaris/1cpu_1core_isainfo.txt
================================================
64-bit amd64 applications
        rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq
        aes movbe sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr
        mmx cmov amd_sysc cx8 tsc fpu

================================================
FILE: cpu/testdata/solaris/1cpu_1core_psrinfo.txt
================================================
The physical processor has 1 virtual processor (0)
  x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz)
        Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz

================================================
FILE: cpu/testdata/solaris/2cpu_12core_isainfo.txt
================================================
64-bit amd64 applications
	amd_svm amd_lzcnt popcnt amd_sse4a tscp ahf cx16 sse3 sse2 sse fxsr
	amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8 tsc fpu


================================================
FILE: cpu/testdata/solaris/2cpu_12core_psrinfo.txt
================================================
The physical processor has 12 virtual processors (0-11)
  x86 (AuthenticAMD 100F91 family 16 model 9 step 1 clock 2300 MHz)
	AMD Opteron(tm) Processor 6176	[ Socket: G34 ]
The physical processor has 12 virtual processors (12-23)
  x86 (AuthenticAMD 100F91 family 16 model 9 step 1 clock 2300 MHz)
	AMD Opteron(tm) Processor 6176	[ Socket: G34 ]


================================================
FILE: cpu/testdata/solaris/2cpu_1core_isainfo.txt
================================================
64-bit amd64 applications
        rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq
        aes movbe sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr
        mmx cmov amd_sysc cx8 tsc fpu

================================================
FILE: cpu/testdata/solaris/2cpu_1core_psrinfo.txt
================================================
The physical processor has 1 virtual processor (0)
  x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz)
        Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz
The physical processor has 1 virtual processor (1)
  x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz)
        Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz

================================================
FILE: cpu/testdata/solaris/2cpu_8core_isainfo.txt
================================================
64-bit amd64 applications
        vmx avx xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp cx16
        sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu

================================================
FILE: cpu/testdata/solaris/2cpu_8core_psrinfo.txt
================================================
The physical processor has 8 cores and 16 virtual processors (0-7 16-23)
  The core has 2 virtual processors (0 16)
  The core has 2 virtual processors (1 17)
  The core has 2 virtual processors (2 18)
  The core has 2 virtual processors (3 19)
  The core has 2 virtual processors (4 20)
  The core has 2 virtual processors (5 21)
  The core has 2 virtual processors (6 22)
  The core has 2 virtual processors (7 23)
    x86 (GenuineIntel 206D7 family 6 model 45 step 7 clock 2600 MHz)
      Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz
The physical processor has 8 cores and 16 virtual processors (8-15 24-31)
  The core has 2 virtual processors (8 24)
  The core has 2 virtual processors (9 25)
  The core has 2 virtual processors (10 26)
  The core has 2 virtual processors (11 27)
  The core has 2 virtual processors (12 28)
  The core has 2 virtual processors (13 29)
  The core has 2 virtual processors (14 30)
  The core has 2 virtual processors (15 31)
    x86 (GenuineIntel 206D7 family 6 model 45 step 7 clock 2600 MHz)
      Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz

================================================
FILE: disk/disk.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
package disk

import (
	"context"
	"encoding/json"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var invoke common.Invoker = common.Invoke{}

type Warnings = common.Warnings

type UsageStat struct {
	Path              string  `json:"path"`
	Fstype            string  `json:"fstype"`
	Total             uint64  `json:"total"`
	Free              uint64  `json:"free"`
	Used              uint64  `json:"used"`
	UsedPercent       float64 `json:"usedPercent"`
	InodesTotal       uint64  `json:"inodesTotal"`
	InodesUsed        uint64  `json:"inodesUsed"`
	InodesFree        uint64  `json:"inodesFree"`
	InodesUsedPercent float64 `json:"inodesUsedPercent"`
}

type PartitionStat struct {
	Device     string   `json:"device"`
	Mountpoint string   `json:"mountpoint"`
	Fstype     string   `json:"fstype"`
	Opts       []string `json:"opts"`
}

type IOCountersStat struct {
	ReadCount        uint64 `json:"readCount"`
	MergedReadCount  uint64 `json:"mergedReadCount"`
	WriteCount       uint64 `json:"writeCount"`
	MergedWriteCount uint64 `json:"mergedWriteCount"`
	ReadBytes        uint64 `json:"readBytes"`
	WriteBytes       uint64 `json:"writeBytes"`
	ReadTime         uint64 `json:"readTime"`
	WriteTime        uint64 `json:"writeTime"`
	IopsInProgress   uint64 `json:"iopsInProgress"`
	IoTime           uint64 `json:"ioTime"`
	WeightedIO       uint64 `json:"weightedIO"`
	Name             string `json:"name"`
	SerialNumber     string `json:"serialNumber"`
	Label            string `json:"label"`
}

func (d UsageStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

func (d PartitionStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

func (d IOCountersStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

// Usage returns a file system usage. path is a filesystem path such
// as "/", not device file path like "/dev/vda1".  If you want to use
// a return value of disk.Partitions, use "Mountpoint" not "Device".
func Usage(path string) (*UsageStat, error) {
	return UsageWithContext(context.Background(), path)
}

// Partitions returns disk partitions. If all is false, returns
// physical devices only (e.g. hard disks, cd-rom drives, USB keys)
// and ignore all others (e.g. memory partitions such as /dev/shm)
//
// 'all' argument is ignored for BSD, see: https://github.com/giampaolo/psutil/issues/906
func Partitions(all bool) ([]PartitionStat, error) {
	return PartitionsWithContext(context.Background(), all)
}

func IOCounters(names ...string) (map[string]IOCountersStat, error) {
	return IOCountersWithContext(context.Background(), names...)
}

// SerialNumber returns Serial Number of given device or empty string
// on error. Name of device is expected, eg. /dev/sda
func SerialNumber(name string) (string, error) {
	return SerialNumberWithContext(context.Background(), name)
}

// Label returns label of given device or empty string on error.
// Name of device is expected, eg. /dev/sda
// Supports label based on devicemapper name
// See https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block-dm
func Label(name string) (string, error) {
	return LabelWithContext(context.Background(), name)
}


================================================
FILE: disk/disk_aix.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix

package disk

import (
	"context"
	"errors"
	"strings"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func LabelWithContext(_ context.Context, _ string) (string, error) {
	return "", common.ErrNotImplementedError
}

// Using lscfg and a device name, we can get the device information
// This is a pure go implementation, and should be moved to disk_aix_nocgo.go
// if a more efficient CGO method is introduced in disk_aix_cgo.go
func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
	// This isn't linux, these aren't actual disk devices
	if strings.HasPrefix(name, "/dev/") {
		return "", errors.New("devices on /dev are not physical disks on aix")
	}
	out, err := invoke.CommandWithContext(ctx, "lscfg", "-vl", name)
	if err != nil {
		return "", err
	}

	ret := ""
	// Kind of inefficient, but it works
	lines := strings.Split(string(out), "\n")
	for line := 1; line < len(lines); line++ {
		v := strings.TrimSpace(lines[line])
		if strings.HasPrefix(v, "Serial Number...............") {
			ret = strings.TrimPrefix(v, "Serial Number...............")
			if ret == "" {
				return "", errors.New("empty serial for disk")
			}
			return ret, nil
		}
	}

	return ret, errors.New("serial entry not found for disk")
}


================================================
FILE: disk/disk_aix_cgo.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix && cgo

package disk

/*
#include <unistd.h>
*/
import "C"

import (
	"context"
	"fmt"

	"github.com/power-devops/perfstat"
)

func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
	disks, err := perfstat.DiskStat()
	if err != nil {
		return nil, err
	}

	nameSet := make(map[string]bool, len(names))
	for _, n := range names {
		nameSet[n] = true
	}

	clkTck := uint64(C.sysconf(C._SC_CLK_TCK))

	ret := make(map[string]IOCountersStat, len(disks))
	for _, d := range disks {
		if len(nameSet) > 0 && !nameSet[d.Name] {
			continue
		}

		ret[d.Name] = IOCountersStat{
			Name:       d.Name,
			ReadCount:  uint64(d.XRate),
			WriteCount: uint64(d.Xfers - d.XRate),
			ReadBytes:  uint64(d.Rblks) * uint64(d.BSize),
			WriteBytes: uint64(d.Wblks) * uint64(d.BSize),
			// perfstat Rserv, Wserv, and WqTime are in nanoseconds;
			// IOCountersStat expects milliseconds.
			ReadTime:       uint64(d.Rserv) / 1_000_000,
			WriteTime:      uint64(d.Wserv) / 1_000_000,
			IoTime:         uint64(d.Time) * 1000 / clkTck, // d.Time is in kernel ticks; convert to ms
			WeightedIO:     uint64(d.WqTime) / 1_000_000,
			IopsInProgress: uint64(d.QDepth),
		}
	}
	return ret, nil
}

var FSType map[int]string

func init() {
	FSType = map[int]string{
		0: "jfs2", 1: "namefs", 2: "nfs", 3: "jfs", 5: "cdrom", 6: "proc",
		16: "special-fs", 17: "cache-fs", 18: "nfs3", 19: "automount-fs", 20: "pool-fs", 32: "vxfs",
		33: "veritas-fs", 34: "udfs", 35: "nfs4", 36: "nfs4-pseudo", 37: "smbfs", 38: "mcr-pseudofs",
		39: "ahafs", 40: "sterm-nfs", 41: "asmfs",
	}
}

func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
	f, err := perfstat.FileSystemStat()
	if err != nil {
		return nil, err
	}
	ret := make([]PartitionStat, 0, len(f))

	for _, fs := range f {
		fstyp, exists := FSType[fs.FSType]
		if !exists {
			fstyp = "unknown"
		}
		info := PartitionStat{
			Device:     fs.Device,
			Mountpoint: fs.MountPoint,
			Fstype:     fstyp,
		}
		ret = append(ret, info)
	}

	return ret, err
}

func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
	f, err := perfstat.FileSystemStat()
	if err != nil {
		return nil, err
	}

	blocksize := uint64(512)
	for _, fs := range f {
		if path == fs.MountPoint {
			fstyp, exists := FSType[fs.FSType]
			if !exists {
				fstyp = "unknown"
			}
			info := UsageStat{
				Path:        path,
				Fstype:      fstyp,
				Total:       uint64(fs.TotalBlocks) * blocksize,
				Free:        uint64(fs.FreeBlocks) * blocksize,
				Used:        uint64(fs.TotalBlocks-fs.FreeBlocks) * blocksize,
				InodesTotal: uint64(fs.TotalInodes),
				InodesFree:  uint64(fs.FreeInodes),
				InodesUsed:  uint64(fs.TotalInodes - fs.FreeInodes),
			}
			info.UsedPercent = (float64(info.Used) / float64(info.Total)) * 100.0
			info.InodesUsedPercent = (float64(info.InodesUsed) / float64(info.InodesTotal)) * 100.0
			return &info, nil
		}
	}
	return nil, fmt.Errorf("mountpoint %s not found", path)
}


================================================
FILE: disk/disk_aix_nocgo.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix && !cgo

package disk

import (
	"context"
	"regexp"
	"strconv"
	"strings"

	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

var startBlank = regexp.MustCompile(`^\s+`)

var (
	ignoreFSType = map[string]bool{"procfs": true}
	FSType       = map[int]string{
		0: "jfs2", 1: "namefs", 2: "nfs", 3: "jfs", 5: "cdrom", 6: "proc",
		16: "special-fs", 17: "cache-fs", 18: "nfs3", 19: "automount-fs", 20: "pool-fs", 32: "vxfs",
		33: "veritas-fs", 34: "udfs", 35: "nfs4", 36: "nfs4-pseudo", 37: "smbfs", 38: "mcr-pseudofs",
		39: "ahafs", 40: "sterm-nfs", 41: "asmfs",
	}
)

func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
	return nil, common.ErrNotImplementedError
}

func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat, error) {
	var ret []PartitionStat

	out, err := invoke.CommandWithContext(ctx, "mount")
	if err != nil {
		return nil, err
	}

	// parse head lines for column names
	colidx := make(map[string]int)
	lines := strings.Split(string(out), "\n")
	if len(lines) < 3 {
		return nil, common.ErrNotImplementedError
	}

	idx := 0
	start := 0
	finished := false
	for pos, ch := range lines[1] {
		if ch == ' ' && !finished {
			name := strings.TrimSpace(lines[0][start:pos])
			colidx[name] = idx
			finished = true
		} else if ch == '-' && finished {
			idx++
			start = pos
			finished = false
		}
	}
	name := strings.TrimSpace(lines[0][start:len(lines[1])])
	colidx[name] = idx

	for idx := 2; idx < len(lines); idx++ {
		line := lines[idx]
		if startBlank.MatchString(line) {
			line = "localhost" + line
		}
		p := strings.Fields(line)
		if len(p) < 5 || ignoreFSType[p[colidx["vfs"]]] {
			continue
		}
		d := PartitionStat{
			Device:     p[colidx["mounted"]],
			Mountpoint: p[colidx["mounted over"]],
			Fstype:     p[colidx["vfs"]],
			Opts:       strings.Split(p[colidx["options"]], ","),
		}

		ret = append(ret, d)
	}

	return ret, nil
}

func getFsType(stat unix.Statfs_t) string {
	return FSType[int(stat.Vfstype)]
}

func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
	out, err := invoke.CommandWithContext(ctx, "df", "-v")
	if err != nil {
		return nil, err
	}

	ret := &UsageStat{}

	blocksize := uint64(512)
	lines := strings.Split(string(out), "\n")
	if len(lines) < 2 {
		return &UsageStat{}, common.ErrNotImplementedError
	}

	hf := strings.Fields(strings.ReplaceAll(lines[0], "Mounted on", "Path")) // headers
	for line := 1; line < len(lines); line++ {
		fs := strings.Fields(lines[line]) // values
		for i, header := range hf {
			// We're done in any of these use cases
			if i >= len(fs) {
				break
			}

			switch header {
			case `Filesystem`:
				// This is not a valid fs for us to parse
				if fs[i] == "/proc" || fs[i] == "/ahafs" || fs[i] != path {
					break
				}

				ret.Fstype, err = GetMountFSTypeWithContext(ctx, fs[i])
				if err != nil {
					return nil, err
				}
			case `Path`:
				ret.Path = fs[i]
			case `512-blocks`:
				total, err := strconv.ParseUint(fs[i], 10, 64)
				ret.Total = total * blocksize
				if err != nil {
					return nil, err
				}
			case `Used`:
				ret.Used, err = strconv.ParseUint(fs[i], 10, 64)
				if err != nil {
					return nil, err
				}
			case `Free`:
				ret.Free, err = strconv.ParseUint(fs[i], 10, 64)
				if err != nil {
					return nil, err
				}
			case `%Used`:
				val, err := strconv.ParseInt(strings.ReplaceAll(fs[i], "%", ""), 10, 32)
				if err != nil {
					return nil, err
				}
				ret.UsedPercent = float64(val) / float64(100)
			case `Ifree`:
				ret.InodesFree, err = strconv.ParseUint(fs[i], 10, 64)
				if err != nil {
					return nil, err
				}
			case `Iused`:
				ret.InodesUsed, err = strconv.ParseUint(fs[i], 10, 64)
				if err != nil {
					return nil, err
				}
			case `%Iused`:
				val, err := strconv.ParseInt(strings.ReplaceAll(fs[i], "%", ""), 10, 32)
				if err != nil {
					return nil, err
				}
				ret.InodesUsedPercent = float64(val) / float64(100)
			}
		}

		// Calculated value, since it isn't returned by the command
		ret.InodesTotal = ret.InodesUsed + ret.InodesFree

		// Valid Usage data, so append it
		return ret, nil
	}

	return ret, nil
}

func GetMountFSTypeWithContext(ctx context.Context, mp string) (string, error) {
	out, err := invoke.CommandWithContext(ctx, "mount")
	if err != nil {
		return "", err
	}

	// Kind of inefficient, but it works
	lines := strings.Split(string(out), "\n")
	for line := 1; line < len(lines); line++ {
		fields := strings.Fields(lines[line])
		if strings.TrimSpace(fields[0]) == mp {
			return fields[2], nil
		}
	}

	return "", nil
}


================================================
FILE: disk/disk_darwin.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin

package disk

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"strings"
	"unsafe"

	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

// PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
	var ret []PartitionStat

	count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
	if err != nil {
		return ret, err
	}
	fs := make([]unix.Statfs_t, count)
	count, err = unix.Getfsstat(fs, unix.MNT_WAIT)
	if err != nil {
		return ret, err
	}
	// On 10.14, and possibly other OS versions, the actual count may
	// be less than from the first call. Truncate to the returned count
	// to prevent accessing uninitialized entries.
	// https://github.com/shirou/gopsutil/issues/1390
	fs = fs[:count]
	for i := range fs {
		stat := &fs[i]
		opts := []string{"rw"}
		if stat.Flags&unix.MNT_RDONLY != 0 {
			opts = []string{"ro"}
		}
		if stat.Flags&unix.MNT_SYNCHRONOUS != 0 {
			opts = append(opts, "sync")
		}
		if stat.Flags&unix.MNT_NOEXEC != 0 {
			opts = append(opts, "noexec")
		}
		if stat.Flags&unix.MNT_NOSUID != 0 {
			opts = append(opts, "nosuid")
		}
		if stat.Flags&unix.MNT_UNION != 0 {
			opts = append(opts, "union")
		}
		if stat.Flags&unix.MNT_ASYNC != 0 {
			opts = append(opts, "async")
		}
		if stat.Flags&unix.MNT_DONTBROWSE != 0 {
			opts = append(opts, "nobrowse")
		}
		if stat.Flags&unix.MNT_AUTOMOUNTED != 0 {
			opts = append(opts, "automounted")
		}
		if stat.Flags&unix.MNT_JOURNALED != 0 {
			opts = append(opts, "journaled")
		}
		if stat.Flags&unix.MNT_MULTILABEL != 0 {
			opts = append(opts, "multilabel")
		}
		if stat.Flags&unix.MNT_NOATIME != 0 {
			opts = append(opts, "noatime")
		}
		if stat.Flags&unix.MNT_NODEV != 0 {
			opts = append(opts, "nodev")
		}
		if stat.Flags&unix.MNT_LOCAL != 0 {
			opts = append(opts, "local")
		}
		if stat.Flags&unix.MNT_CPROTECT != 0 {
			opts = append(opts, "protect")
		}
		d := PartitionStat{
			Device:     common.ByteToString(stat.Mntfromname[:]),
			Mountpoint: common.ByteToString(stat.Mntonname[:]),
			Fstype:     common.ByteToString(stat.Fstypename[:]),
			Opts:       opts,
		}

		ret = append(ret, d)
	}

	return ret, nil
}

func getFsType(stat unix.Statfs_t) string {
	return common.ByteToString(stat.Fstypename[:])
}

type spnvmeDataTypeItem struct {
	Name              string `json:"_name"`
	BsdName           string `json:"bsd_name"`
	DetachableDrive   string `json:"detachable_drive"`
	DeviceModel       string `json:"device_model"`
	DeviceRevision    string `json:"device_revision"`
	DeviceSerial      string `json:"device_serial"`
	PartitionMapType  string `json:"partition_map_type"`
	RemovableMedia    string `json:"removable_media"`
	Size              string `json:"size"`
	SizeInBytes       int64  `json:"size_in_bytes"`
	SmartStatus       string `json:"smart_status"`
	SpnvmeTrimSupport string `json:"spnvme_trim_support"`
	Volumes           []struct {
		Name        string `json:"_name"`
		BsdName     string `json:"bsd_name"`
		Iocontent   string `json:"iocontent"`
		Size        string `json:"size"`
		SizeInBytes int    `json:"size_in_bytes"`
	} `json:"volumes"`
}

type spnvmeDataWrapper struct {
	SPNVMeDataType []struct {
		Items []spnvmeDataTypeItem `json:"_items"`
	} `json:"SPNVMeDataType"`
}

func SerialNumberWithContext(ctx context.Context, _ string) (string, error) {
	output, err := invoke.CommandWithContext(ctx, "system_profiler", "SPNVMeDataType", "-json")
	if err != nil {
		return "", err
	}

	var data spnvmeDataWrapper
	if err := json.Unmarshal(output, &data); err != nil {
		return "", fmt.Errorf("failed to unmarshal JSON: %w", err)
	}

	// Extract all serial numbers into a single string
	var serialNumbers []string
	for i := range data.SPNVMeDataType {
		spnvmeData := &data.SPNVMeDataType[i]
		for j := range spnvmeData.Items {
			item := &spnvmeData.Items[j]
			serialNumbers = append(serialNumbers, item.DeviceSerial)
		}
	}

	if len(serialNumbers) == 0 {
		return "", errors.New("no serial numbers found")
	}

	return strings.Join(serialNumbers, ", "), nil
}

func LabelWithContext(_ context.Context, _ string) (string, error) {
	return "", common.ErrNotImplementedError
}

func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
	iokit, err := common.NewIOKitLib()
	if err != nil {
		return nil, err
	}
	defer iokit.Close()

	corefoundation, err := common.NewCoreFoundationLib()
	if err != nil {
		return nil, err
	}
	defer corefoundation.Close()

	match := iokit.IOServiceMatching("IOMedia")

	key := corefoundation.CFStringCreateWithCString(common.KCFAllocatorDefault, common.KIOMediaWholeKey, common.KCFStringEncodingUTF8)
	defer corefoundation.CFRelease(uintptr(key))

	kCFBooleanTruePtr, _ := corefoundation.Dlsym("kCFBooleanTrue")
	kCFBooleanTrue := **(**uintptr)(unsafe.Pointer(&kCFBooleanTruePtr))
	corefoundation.CFDictionaryAddValue(uintptr(match), uintptr(key), kCFBooleanTrue)

	var drives uint32
	if status := iokit.IOServiceGetMatchingServices(common.KIOMainPortDefault, uintptr(match), &drives); status != common.KERN_SUCCESS {
		return nil, fmt.Errorf("IOServiceGetMatchingServices error=%d", status)
	}
	defer iokit.IOObjectRelease(drives)

	ic := &ioCounters{
		iokit:          iokit,
		corefoundation: corefoundation,
	}

	stats := make([]IOCountersStat, 0, 16)
	for {
		d := iokit.IOIteratorNext(drives)
		if d <= 0 {
			break
		}

		stat, err := ic.getDriveStat(d)
		if err != nil {
			return nil, err
		}

		if stat != nil {
			stats = append(stats, *stat)
		}

		iokit.IOObjectRelease(d)
	}

	ret := make(map[string]IOCountersStat, 0)
	for i := 0; i < len(stats); i++ {
		if len(names) > 0 && !common.StringsHas(names, stats[i].Name) {
			continue
		}

		stats[i].ReadTime = stats[i].ReadTime / 1000 / 1000 // note: read/write time are in ns, but we want ms.
		stats[i].WriteTime = stats[i].WriteTime / 1000 / 1000
		stats[i].IoTime = stats[i].ReadTime + stats[i].WriteTime

		ret[stats[i].Name] = stats[i]
	}

	return ret, nil
}

const (
	kIOBSDNameKey = "BSD Name"
	// kIOMediaSizeKey               = "Size"
	// kIOMediaPreferredBlockSizeKey = "Preferred Block Size"

	kIOBlockStorageDriverStatisticsKey               = "Statistics"
	kIOBlockStorageDriverStatisticsBytesReadKey      = "Bytes (Read)"
	kIOBlockStorageDriverStatisticsBytesWrittenKey   = "Bytes (Write)"
	kIOBlockStorageDriverStatisticsReadsKey          = "Operations (Read)"
	kIOBlockStorageDriverStatisticsWritesKey         = "Operations (Write)"
	kIOBlockStorageDriverStatisticsTotalReadTimeKey  = "Total Time (Read)"
	kIOBlockStorageDriverStatisticsTotalWriteTimeKey = "Total Time (Write)"
)

type ioCounters struct {
	iokit          *common.IOKitLib
	corefoundation *common.CoreFoundationLib
}

func (i *ioCounters) getDriveStat(d uint32) (*IOCountersStat, error) {
	var parent uint32
	if status := i.iokit.IORegistryEntryGetParentEntry(d, common.KIOServicePlane, &parent); status != common.KERN_SUCCESS {
		return nil, fmt.Errorf("IORegistryEntryGetParentEntry error=%d", status)
	}
	defer i.iokit.IOObjectRelease(parent)

	if !i.iokit.IOObjectConformsTo(parent, "IOBlockStorageDriver") {
		// return nil, fmt.Errorf("ERROR: the object is not of the IOBlockStorageDriver class")
		return nil, nil
	}

	var props unsafe.Pointer
	if status := i.iokit.IORegistryEntryCreateCFProperties(d, unsafe.Pointer(&props), common.KCFAllocatorDefault, common.KNilOptions); status != common.KERN_SUCCESS {
		return nil, fmt.Errorf("IORegistryEntryCreateCFProperties error=%d", status)
	}
	defer i.corefoundation.CFRelease(uintptr(props))

	key := i.cfStr(kIOBSDNameKey)
	defer i.corefoundation.CFRelease(uintptr(key))
	name := i.corefoundation.CFDictionaryGetValue(uintptr(props), uintptr(key))

	buf := common.NewCStr(common.GetCFStringBufLengthForUTF8(i.corefoundation.CFStringGetLength(uintptr(name))))
	i.corefoundation.CFStringGetCString(uintptr(name), buf, buf.Length(), common.KCFStringEncodingUTF8)

	stat, err := i.fillStat(parent)
	if err != nil {
		return nil, err
	}

	if stat != nil {
		stat.Name = buf.GoString()
		return stat, nil
	}
	return nil, nil
}

func (i *ioCounters) fillStat(d uint32) (*IOCountersStat, error) {
	var props unsafe.Pointer
	status := i.iokit.IORegistryEntryCreateCFProperties(d, unsafe.Pointer(&props), common.KCFAllocatorDefault, common.KNilOptions)
	if status != common.KERN_SUCCESS {
		return nil, fmt.Errorf("IORegistryEntryCreateCFProperties error=%d", status)
	}
	if props == nil {
		return nil, nil
	}
	defer i.corefoundation.CFRelease(uintptr(props))

	key := i.cfStr(kIOBlockStorageDriverStatisticsKey)
	defer i.corefoundation.CFRelease(uintptr(key))

	v := i.corefoundation.CFDictionaryGetValue(uintptr(props), uintptr(key))
	if v == nil {
		return nil, errors.New("CFDictionaryGetValue failed")
	}

	var stat IOCountersStat
	statstab := map[string]uintptr{
		kIOBlockStorageDriverStatisticsBytesReadKey:      unsafe.Offsetof(stat.ReadBytes),
		kIOBlockStorageDriverStatisticsBytesWrittenKey:   unsafe.Offsetof(stat.WriteBytes),
		kIOBlockStorageDriverStatisticsReadsKey:          unsafe.Offsetof(stat.ReadCount),
		kIOBlockStorageDriverStatisticsWritesKey:         unsafe.Offsetof(stat.WriteCount),
		kIOBlockStorageDriverStatisticsTotalReadTimeKey:  unsafe.Offsetof(stat.ReadTime),
		kIOBlockStorageDriverStatisticsTotalWriteTimeKey: unsafe.Offsetof(stat.WriteTime),
	}

	for key, off := range statstab {
		s := i.cfStr(key)
		if num := i.corefoundation.CFDictionaryGetValue(uintptr(v), uintptr(s)); num != nil {
			i.corefoundation.CFNumberGetValue(uintptr(num), common.KCFNumberSInt64Type, uintptr(unsafe.Add(unsafe.Pointer(&stat), off)))
		}
		i.corefoundation.CFRelease(uintptr(s))
	}

	return &stat, nil
}

func (i *ioCounters) cfStr(str string) unsafe.Pointer {
	return i.corefoundation.CFStringCreateWithCString(common.KCFAllocatorDefault, str, common.KCFStringEncodingUTF8)
}


================================================
FILE: disk/disk_fallback.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !windows && !solaris && !aix

package disk

import (
	"context"

	"github.com/shirou/gopsutil/v4/internal/common"
)

func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
	return nil, common.ErrNotImplementedError
}

func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
	return []PartitionStat{}, common.ErrNotImplementedError
}

func UsageWithContext(_ context.Context, _ string) (*UsageStat, error) {
	return nil, common.ErrNotImplementedError
}

func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
	return "", common.ErrNotImplementedError
}

func LabelWithContext(_ context.Context, _ string) (string, error) {
	return "", common.ErrNotImplementedError
}


================================================
FILE: disk/disk_freebsd.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
//go:build freebsd

package disk

import (
	"bufio"
	"bytes"
	"context"
	"encoding/binary"
	"fmt"
	"strconv"
	"strings"

	"golang.org/x/sys/unix"

	"github.com/shirou/gopsutil/v4/internal/common"
)

// PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
	var ret []PartitionStat

	// get length
	count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
	if err != nil {
		return ret, err
	}

	fs := make([]unix.Statfs_t, count)
	if _, err = unix.Getfsstat(fs, unix.MNT_WAIT); err != nil {
		return ret, err
	}

	for i := range fs {
		stat := &fs[i]
		opts := []string{"rw"}
		if stat.Flags&unix.MNT_RDONLY != 0 {
			opts = []string{"ro"}
		}
		if stat.Flags&unix.MNT_SYNCHRONOUS != 0 {
			opts = append(opts, "sync")
		}
		if stat.Flags&unix.MNT_NOEXEC != 0 {
			opts = append(opts, "noexec")
		}
		if stat.Flags&unix.MNT_NOSUID != 0 {
			opts = append(opts, "nosuid")
		}
		if stat.Flags&unix.MNT_UNION != 0 {
			opts = append(opts, "union")
		}
		if stat.Flags&unix.MNT_ASYNC != 0 {
			opts = append(opts, "async")
		}
		if stat.Flags&unix.MNT_SUIDDIR != 0 {
			opts = append(opts, "suiddir")
		}
		if stat.Flags&unix.MNT_SOFTDEP != 0 {
			opts = append(opts, "softdep")
		}
		if stat.Flags&unix.MNT_NOSYMFOLLOW != 0 {
			opts = append(opts, "nosymfollow")
		}
		if stat.Flags&unix.MNT_GJOURNAL != 0 {
			opts = append(opts, "gjournal")
		}
		if stat.Flags&unix.MNT_MULTILABEL != 0 {
			opts = append(opts, "multilabel")
		}
		if stat.Flags&unix.MNT_ACLS != 0 {
			opts = append(opts, "acls")
		}
		if stat.Flags&unix.MNT_NOATIME != 0 {
			opts = append(opts, "noatime")
		}
		if stat.Flags&unix.MNT_NOCLUSTERR != 0 {
			opts = append(opts, "noclusterr")
		}
		if stat.Flags&unix.MNT_NOCLUSTERW != 0 {
			opts = append(opts, "noclusterw")
		}
		if stat.Flags&unix.MNT_NFS4ACLS != 0 {
			opts = append(opts, "nfsv4acls")
		}

		d := PartitionStat{
			Device:     common.ByteToString(stat.Mntfromname[:]),
			Mountpoint: common.ByteToString(stat.Mntonname[:]),
			Fstype:     common.ByteToString(stat.Fstypename[:]),
			Opts:       opts,
		}

		ret = append(ret, d)
	}

	return ret, nil
}

func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
	// statinfo->devinfo->devstat
	// /usr/include/devinfo.h
	ret := make(map[string]IOCountersStat)

	r, err := unix.Sysctl("kern.devstat.all")
	if err != nil {
		return nil, err
	}
	buf := []byte(r)
	length := len(buf)

	count := int(uint64(length) / uint64(sizeOfdevstat))

	buf = buf[8:] // devstat.all has version in the head.
	// parse buf to devstat
	for i := 0; i < count; i++ {
		b := buf[i*sizeOfdevstat : i*sizeOfdevstat+sizeOfdevstat]
		d, err := parsedevstat(b)
		if err != nil {
			continue
		}
		un := strconv.Itoa(int(d.Unit_number))
		name := common.IntToString(d.Device_name[:]) + un

		if len(names) > 0 && !common.StringsHas(names, name) {
			continue
		}

		ds := IOCountersStat{
			ReadCount:  d.Operations[devstat_READ],
			WriteCount: d.Operations[devstat_WRITE],
			ReadBytes:  d.Bytes[devstat_READ],
			WriteBytes: d.Bytes[devstat_WRITE],
			ReadTime:   uint64(d.Duration[devstat_READ].Compute() * 1000),
			WriteTime:  uint64(d.Duration[devstat_WRITE].Compute() * 1000),
			IoTime:     uint64(d.Busy_time.Compute() * 1000),
			Name:       name,
		}
		ds.SerialNumber, _ = SerialNumberWithContext(ctx, name)
		ret[name] = ds
	}

	return ret, nil
}

func (b bintime) Compute() float64 {
	bintimeScale := 5.42101086242752217003726400434970855712890625e-20
	return float64(b.Sec) + float64(b.Frac)*bintimeScale
}

// BT2LD(time)     ((long double)(time).sec + (time).frac * BINTIME_SCALE)

func parsedevstat(buf []byte) (devstat, error) {
	var ds devstat
	br := bytes.NewReader(buf)
	if err := binary.Read(br, binary.LittleEndian, &ds); err != nil {
		return ds, err
	}

	return ds, nil
}

func getFsType(stat unix.Statfs_t) string {
	return common.ByteToString(stat.Fstypename[:])
}

func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
	geomOut, err := invoke.CommandWithContext(ctx, "geom", "disk", "list", name)
	if err != nil {
		return "", fmt.Errorf("exec geom: %w", err)
	}
	s := bufio.NewScanner(bytes.NewReader(geomOut))
	serial := ""
	for s.Scan() {
		flds := strings.Fields(s.Text())
		if len(flds) == 2 && flds[0] == "ident:" {
			if flds[1] != "(null)" {
				serial = flds[1]
			}
			break
		}
	}
	err = s.Err()
	if err != nil {
		return "", err
	}
	return serial, nil
}

func LabelWithContext(_ context.Context, _ string) (string, error) {
	return "", common.ErrNotImplementedError
}


================================================
FILE: disk/disk_freebsd_386.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go

package disk

const (
	sizeofPtr        = 0x4
	sizeofShort      = 0x2
	sizeofInt        = 0x4
	sizeofLong       = 0x4
	sizeofLongLong   = 0x8
	sizeofLongDouble = 0x8

	devstat_NO_DATA = 0x00
	devstat_READ    = 0x01
	devstat_WRITE   = 0x02
	devstat_FREE    = 0x03
)

const (
	sizeOfdevstat = 0xf0
)

type (
	_C_short       int16
	_C_int         int32
	_C_long        int32
	_C_long_long   int64
	_C_long_double int64
)

type devstat struct {
	Sequence0     uint32
	Allocated     int32
	Start_count   uint32
	End_count     uint32
	Busy_from     bintime
	Dev_links     _Ctype_struct___0
	Device_number uint32
	Device_name   [16]int8
	Unit_number   int32
	Bytes         [4]uint64
	Operations    [4]uint64
	Duration      [4]bintime
	Busy_time     bintime
	Creation_time bintime
	Block_size    uint32
	Tag_types     [3]uint64
	Flags         uint32
	Device_type   uint32
	Priority      uint32
	Id            [sizeofPtr]byte
	Sequence1     uint32
}

type bintime struct {
	Sec  int32
	Frac uint64
}

type _Ctype_struct___0 struct {
	Empty uint32
}


================================================
FILE: disk/disk_freebsd_amd64.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go

package disk

const (
	sizeofPtr        = 0x8
	sizeofShort      = 0x2
	sizeofInt        = 0x4
	sizeofLong       = 0x8
	sizeofLongLong   = 0x8
	sizeofLongDouble = 0x8

	devstat_NO_DATA = 0x00
	devstat_READ    = 0x01
	devstat_WRITE   = 0x02
	devstat_FREE    = 0x03
)

const (
	sizeOfdevstat = 0x120
)

type (
	_C_short       int16
	_C_int         int32
	_C_long        int64
	_C_long_long   int64
	_C_long_double int64
)

type devstat struct {
	Sequence0     uint32
	Allocated     int32
	Start_count   uint32
	End_count     uint32
	Busy_from     bintime
	Dev_links     _Ctype_struct___0
	Device_number uint32
	Device_name   [16]int8
	Unit_number   int32
	Bytes         [4]uint64
	Operations    [4]uint64
	Duration      [4]bintime
	Busy_time     bintime
	Creation_time bintime
	Block_size    uint32
	Pad_cgo_0     [4]byte
	Tag_types     [3]uint64
	Flags         uint32
	Device_type   uint32
	Priority      uint32
	Pad_cgo_1     [4]byte
	ID            [sizeofPtr]byte
	Sequence1     uint32
	Pad_cgo_2     [4]byte
}

type bintime struct {
	Sec  int64
	Frac uint64
}

type _Ctype_struct___0 struct {
	Empty uint64
}


================================================
FILE: disk/disk_freebsd_arm.go
================================================
// SPDX-License-Identifier: BSD-3-Clause
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go

package disk

const (
	sizeofPtr        = 0x4
	sizeofShort      = 0x2
	sizeofInt        = 0x4
	sizeofLong       = 0x4
	sizeofLongLong   = 0x8
	sizeofLongDouble = 0x8

	devstat_NO_DATA = 0x00
	devstat_READ    = 0x01
	devstat_WRITE   = 0x02
	devstat_FREE    = 0x03
)

const (
	sizeOfdevstat = 0xf0
)

type (
	_C_short       int16
	_C_int         int32
	_C_long        int32
	_C_long_long   int64
	_C_long_double int64
)

type devstat struct {
	Sequence0     uint32
	Allocated     int32
	Start_count   uint32
	End_count     uint32
	Busy_from     bintime
	Dev_links     _Ctype_struct___0
	Device_number uint32
	Device_name   [16]int8
	Unit_number   int32
	Bytes         [4]uint64
	Operations    [4]uint64
	Duration      [4]bintime
	Busy_time     bintime
	Creation_time bintime
	Block_size    uint32
	Tag_types     [3]uint64
	Flags         uint32
	Device_type   uint32
	Priority      uint32
	Id            [sizeofPtr]byte
	Sequence1     uint32
}

type bintime struct {
	Sec  int32
	Frac uint64
}

type _Ctype_struct___0 struct {
	Empty uint32
}


================================================
FILE: disk/disk_freebsd_arm64.go
================================================
// 
Download .txt
gitextract_q6j6w0jl/

├── .gitattributes
├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   ├── SECURITY.md
│   ├── dependabot.yml
│   ├── labeler.yml
│   ├── release.yml
│   └── workflows/
│       ├── build_test.yml
│       ├── labeler.yml
│       ├── lint.yml
│       ├── release.yml
│       ├── sbom_generator.yml
│       ├── shellcheck.yml
│       └── test.yml
├── .gitignore
├── .golangci.yml
├── LICENSE
├── Makefile
├── README.md
├── common/
│   └── env.go
├── cpu/
│   ├── cpu.go
│   ├── cpu_aix.go
│   ├── cpu_aix_cgo.go
│   ├── cpu_aix_nocgo.go
│   ├── cpu_darwin.go
│   ├── cpu_darwin_arm64.go
│   ├── cpu_darwin_fallback.go
│   ├── cpu_darwin_test.go
│   ├── cpu_dragonfly.go
│   ├── cpu_dragonfly_amd64.go
│   ├── cpu_fallback.go
│   ├── cpu_freebsd.go
│   ├── cpu_freebsd_386.go
│   ├── cpu_freebsd_amd64.go
│   ├── cpu_freebsd_arm.go
│   ├── cpu_freebsd_arm64.go
│   ├── cpu_freebsd_test.go
│   ├── cpu_linux.go
│   ├── cpu_linux_test.go
│   ├── cpu_netbsd.go
│   ├── cpu_netbsd_amd64.go
│   ├── cpu_netbsd_arm.go
│   ├── cpu_netbsd_arm64.go
│   ├── cpu_openbsd.go
│   ├── cpu_openbsd_386.go
│   ├── cpu_openbsd_amd64.go
│   ├── cpu_openbsd_arm.go
│   ├── cpu_openbsd_arm64.go
│   ├── cpu_openbsd_riscv64.go
│   ├── cpu_plan9.go
│   ├── cpu_plan9_test.go
│   ├── cpu_solaris.go
│   ├── cpu_solaris_test.go
│   ├── cpu_test.go
│   ├── cpu_windows.go
│   └── testdata/
│       ├── aix/
│       │   ├── prtconf
│       │   ├── sar-u-PALL101
│       │   └── sar-u101
│       ├── freebsd/
│       │   ├── 1cpu_2core.txt
│       │   ├── 1cpu_4core.txt
│       │   └── 2cpu_4core.txt
│       ├── linux/
│       │   ├── 1037/
│       │   │   └── proc/
│       │   │       └── cpuinfo
│       │   ├── 1958/
│       │   │   └── proc/
│       │   │       └── cpuinfo
│       │   ├── 424/
│       │   │   └── proc/
│       │   │       └── stat
│       │   └── times_empty/
│       │       └── proc/
│       │           └── stat
│       ├── plan9/
│       │   └── 2cores/
│       │       ├── dev/
│       │       │   ├── cputype
│       │       │   ├── sysstat
│       │       │   └── time
│       │       └── proc/
│       │           ├── 1/
│       │           │   └── status
│       │           ├── 331/
│       │           │   └── .gitkeep
│       │           ├── 54384/
│       │           │   └── status
│       │           ├── 54412/
│       │           │   └── status
│       │           └── 72/
│       │               └── status
│       └── solaris/
│           ├── 1cpu_1core_isainfo.txt
│           ├── 1cpu_1core_psrinfo.txt
│           ├── 2cpu_12core_isainfo.txt
│           ├── 2cpu_12core_psrinfo.txt
│           ├── 2cpu_1core_isainfo.txt
│           ├── 2cpu_1core_psrinfo.txt
│           ├── 2cpu_8core_isainfo.txt
│           └── 2cpu_8core_psrinfo.txt
├── disk/
│   ├── disk.go
│   ├── disk_aix.go
│   ├── disk_aix_cgo.go
│   ├── disk_aix_nocgo.go
│   ├── disk_darwin.go
│   ├── disk_fallback.go
│   ├── disk_freebsd.go
│   ├── disk_freebsd_386.go
│   ├── disk_freebsd_amd64.go
│   ├── disk_freebsd_arm.go
│   ├── disk_freebsd_arm64.go
│   ├── disk_linux.go
│   ├── disk_linux_test.go
│   ├── disk_netbsd.go
│   ├── disk_netbsd_amd64.go
│   ├── disk_netbsd_arm.go
│   ├── disk_netbsd_arm64.go
│   ├── disk_openbsd.go
│   ├── disk_openbsd_386.go
│   ├── disk_openbsd_amd64.go
│   ├── disk_openbsd_arm.go
│   ├── disk_openbsd_arm64.go
│   ├── disk_openbsd_riscv64.go
│   ├── disk_solaris.go
│   ├── disk_test.go
│   ├── disk_unix.go
│   ├── disk_windows.go
│   ├── disk_windows_test.go
│   ├── types_freebsd.go
│   ├── types_netbsd.go
│   └── types_openbsd.go
├── doc.go
├── docker/
│   ├── docker.go
│   ├── docker_linux.go
│   ├── docker_linux_test.go
│   ├── docker_notlinux.go
│   └── main_test.go
├── go.mod
├── go.sum
├── host/
│   ├── freebsd_headers/
│   │   └── utxdb.h
│   ├── host.go
│   ├── host_aix.go
│   ├── host_aix_cgo.go
│   ├── host_aix_nocgo.go
│   ├── host_aix_ppc64.go
│   ├── host_aix_test.go
│   ├── host_bsd.go
│   ├── host_darwin.go
│   ├── host_darwin_amd64.go
│   ├── host_darwin_arm64.go
│   ├── host_fallback.go
│   ├── host_freebsd.go
│   ├── host_freebsd_386.go
│   ├── host_freebsd_amd64.go
│   ├── host_freebsd_arm.go
│   ├── host_freebsd_arm64.go
│   ├── host_linux.go
│   ├── host_linux_386.go
│   ├── host_linux_amd64.go
│   ├── host_linux_arm.go
│   ├── host_linux_arm64.go
│   ├── host_linux_loong64.go
│   ├── host_linux_mips.go
│   ├── host_linux_mips64.go
│   ├── host_linux_mips64le.go
│   ├── host_linux_mipsle.go
│   ├── host_linux_ppc64.go
│   ├── host_linux_ppc64le.go
│   ├── host_linux_riscv64.go
│   ├── host_linux_s390x.go
│   ├── host_linux_test.go
│   ├── host_netbsd.go
│   ├── host_openbsd.go
│   ├── host_openbsd_386.go
│   ├── host_openbsd_amd64.go
│   ├── host_openbsd_arm.go
│   ├── host_openbsd_arm64.go
│   ├── host_openbsd_riscv64.go
│   ├── host_posix.go
│   ├── host_solaris.go
│   ├── host_test.go
│   ├── host_windows.go
│   ├── testdata/
│   │   └── linux/
│   │       └── lsbStruct/
│   │           ├── arch/
│   │           │   └── lsb-release
│   │           └── ubuntu_22_04/
│   │               └── lsb-release
│   ├── types_darwin.go
│   ├── types_freebsd.go
│   ├── types_linux.go
│   └── types_openbsd.go
├── internal/
│   └── common/
│       ├── common.go
│       ├── common_aix.go
│       ├── common_aix_test.go
│       ├── common_darwin.go
│       ├── common_freebsd.go
│       ├── common_linux.go
│       ├── common_netbsd.go
│       ├── common_openbsd.go
│       ├── common_test.go
│       ├── common_unix.go
│       ├── common_windows.go
│       ├── endian.go
│       ├── readlink_linux.go
│       ├── sleep.go
│       ├── sleep_test.go
│       ├── warnings.go
│       └── warnings_test.go
├── load/
│   ├── load.go
│   ├── load_aix.go
│   ├── load_aix_cgo.go
│   ├── load_aix_nocgo.go
│   ├── load_bsd.go
│   ├── load_darwin.go
│   ├── load_fallback.go
│   ├── load_freebsd.go
│   ├── load_linux.go
│   ├── load_openbsd.go
│   ├── load_solaris.go
│   ├── load_test.go
│   └── load_windows.go
├── mem/
│   ├── ex_linux.go
│   ├── ex_windows.go
│   ├── mem.go
│   ├── mem_aix.go
│   ├── mem_aix_cgo.go
│   ├── mem_aix_nocgo.go
│   ├── mem_bsd.go
│   ├── mem_bsd_test.go
│   ├── mem_darwin.go
│   ├── mem_darwin_test.go
│   ├── mem_fallback.go
│   ├── mem_freebsd.go
│   ├── mem_linux.go
│   ├── mem_linux_test.go
│   ├── mem_netbsd.go
│   ├── mem_openbsd.go
│   ├── mem_openbsd_386.go
│   ├── mem_openbsd_amd64.go
│   ├── mem_openbsd_arm.go
│   ├── mem_openbsd_arm64.go
│   ├── mem_openbsd_riscv64.go
│   ├── mem_plan9.go
│   ├── mem_plan9_test.go
│   ├── mem_solaris.go
│   ├── mem_solaris_test.go
│   ├── mem_test.go
│   ├── mem_windows.go
│   ├── testdata/
│   │   ├── linux/
│   │   │   └── virtualmemory/
│   │   │       ├── anonhugepages/
│   │   │       │   └── proc/
│   │   │       │       └── meminfo
│   │   │       ├── intelcorei5/
│   │   │       │   └── proc/
│   │   │       │       └── meminfo
│   │   │       └── issue1002/
│   │   │           └── proc/
│   │   │               └── meminfo
│   │   └── plan9/
│   │       └── virtualmemory/
│   │           └── dev/
│   │               └── swap
│   └── types_openbsd.go
├── mktypes.sh
├── net/
│   ├── net.go
│   ├── net_aix.go
│   ├── net_aix_cgo.go
│   ├── net_aix_nocgo.go
│   ├── net_darwin.go
│   ├── net_darwin_test.go
│   ├── net_fallback.go
│   ├── net_freebsd.go
│   ├── net_linux.go
│   ├── net_linux_test.go
│   ├── net_openbsd.go
│   ├── net_solaris.go
│   ├── net_test.go
│   ├── net_unix.go
│   ├── net_windows.go
│   └── types_darwin.go
├── process/
│   ├── process.go
│   ├── process_bsd.go
│   ├── process_darwin.go
│   ├── process_darwin_amd64.go
│   ├── process_darwin_arm64.go
│   ├── process_darwin_test.go
│   ├── process_fallback.go
│   ├── process_freebsd.go
│   ├── process_freebsd_386.go
│   ├── process_freebsd_amd64.go
│   ├── process_freebsd_arm.go
│   ├── process_freebsd_arm64.go
│   ├── process_linux.go
│   ├── process_linux_test.go
│   ├── process_openbsd.go
│   ├── process_openbsd_386.go
│   ├── process_openbsd_amd64.go
│   ├── process_openbsd_arm.go
│   ├── process_openbsd_arm64.go
│   ├── process_openbsd_riscv64.go
│   ├── process_plan9.go
│   ├── process_posix.go
│   ├── process_posix_test.go
│   ├── process_race_test.go
│   ├── process_solaris.go
│   ├── process_test.go
│   ├── process_windows.go
│   ├── process_windows_32bit.go
│   ├── process_windows_64bit.go
│   ├── testdata/
│   │   ├── linux/
│   │   │   ├── 1/
│   │   │   │   ├── comm
│   │   │   │   ├── smaps
│   │   │   │   └── status
│   │   │   ├── 1060/
│   │   │   │   ├── comm
│   │   │   │   └── status
│   │   │   ├── 23819/
│   │   │   │   ├── comm
│   │   │   │   └── status
│   │   │   └── 68927/
│   │   │       ├── comm
│   │   │       └── stat
│   │   └── lx_brandz/
│   │       └── 1/
│   │           └── stat
│   ├── types_darwin.go
│   ├── types_freebsd.go
│   └── types_openbsd.go
├── sensors/
│   ├── ex_linux.go
│   ├── sensors.go
│   ├── sensors_aix.go
│   ├── sensors_darwin.go
│   ├── sensors_darwin_arm64.go
│   ├── sensors_fallback.go
│   ├── sensors_freebsd.go
│   ├── sensors_linux.go
│   ├── sensors_netbsd.go
│   ├── sensors_openbsd.go
│   ├── sensors_solaris.go
│   ├── sensors_test.go
│   └── sensors_windows.go
├── windows_memo.rst
└── winservices/
    ├── manager.go
    └── winservices.go
Download .txt
Showing preview only (246K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3061 symbols across 240 files)

FILE: common/env.go
  type EnvKeyType (line 4) | type EnvKeyType
  constant HostProcEnvKey (line 15) | HostProcEnvKey    EnvKeyType = "HOST_PROC"
  constant HostSysEnvKey (line 16) | HostSysEnvKey     EnvKeyType = "HOST_SYS"
  constant HostEtcEnvKey (line 17) | HostEtcEnvKey     EnvKeyType = "HOST_ETC"
  constant HostVarEnvKey (line 18) | HostVarEnvKey     EnvKeyType = "HOST_VAR"
  constant HostRunEnvKey (line 19) | HostRunEnvKey     EnvKeyType = "HOST_RUN"
  constant HostDevEnvKey (line 20) | HostDevEnvKey     EnvKeyType = "HOST_DEV"
  constant HostRootEnvKey (line 21) | HostRootEnvKey    EnvKeyType = "HOST_ROOT"
  constant HostProcMountinfo (line 22) | HostProcMountinfo EnvKeyType = "HOST_PROC_MOUNTINFO"
  type EnvMap (line 25) | type EnvMap

FILE: cpu/cpu.go
  type TimesStat (line 21) | type TimesStat struct
    method String (line 74) | func (c TimesStat) String() string {
    method Total (line 94) | func (c TimesStat) Total() float64 {
  type InfoStat (line 35) | type InfoStat struct
    method String (line 101) | func (c InfoStat) String() string {
  type lastPercent (line 51) | type lastPercent struct
  function init (line 62) | func init() {
  function Counts (line 70) | func Counts(logical bool) (int, error) {
  function getAllBusy (line 106) | func getAllBusy(t TimesStat) (float64, float64) {
  function calculateBusy (line 118) | func calculateBusy(t1, t2 TimesStat) float64 {
  function calculateAllBusy (line 131) | func calculateAllBusy(t1, t2 []TimesStat) ([]float64, error) {
  function Percent (line 150) | func Percent(interval time.Duration, percpu bool) ([]float64, error) {
  function PercentWithContext (line 154) | func PercentWithContext(ctx context.Context, interval time.Duration, per...
  function percentUsedFromLastCall (line 178) | func percentUsedFromLastCall(percpu bool) ([]float64, error) {
  function percentUsedFromLastCallWithContext (line 182) | func percentUsedFromLastCallWithContext(ctx context.Context, percpu bool...

FILE: cpu/cpu_aix.go
  function Times (line 10) | func Times(percpu bool) ([]TimesStat, error) {
  function Info (line 14) | func Info() ([]InfoStat, error) {

FILE: cpu/cpu_aix_cgo.go
  function TimesWithContext (line 12) | func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, er...
  function InfoWithContext (line 46) | func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 65) | func CountsWithContext(ctx context.Context, logical bool) (int, error) {

FILE: cpu/cpu_aix_nocgo.go
  function TimesWithContext (line 14) | func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, er...
  function InfoWithContext (line 100) | func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 151) | func CountsWithContext(ctx context.Context, _ bool) (int, error) {

FILE: cpu/cpu_darwin.go
  constant CPUser (line 22) | CPUser    = 0
  constant cpNice (line 23) | cpNice    = 1
  constant cpSys (line 24) | cpSys     = 2
  constant cpIntr (line 25) | cpIntr    = 3
  constant cpIdle (line 26) | cpIdle    = 4
  constant cpUStates (line 27) | cpUStates = 5
  constant cpuStateUser (line 32) | cpuStateUser   = 0
  constant cpuStateSystem (line 33) | cpuStateSystem = 1
  constant cpuStateIdle (line 34) | cpuStateIdle   = 2
  constant cpuStateNice (line 35) | cpuStateNice   = 3
  constant cpuStateMax (line 36) | cpuStateMax    = 4
  constant processorCpuLoadInfo (line 41) | processorCpuLoadInfo = 2
  type hostCpuLoadInfoData (line 44) | type hostCpuLoadInfoData struct
  function init (line 51) | func init() {
  function Times (line 59) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 63) | func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, erro...
  function Info (line 78) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 82) | func InfoWithContext(_ context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 125) | func CountsWithContext(_ context.Context, logical bool) (int, error) {
  function perCPUTimes (line 141) | func perCPUTimes(sys *common.SystemLib) ([]TimesStat, error) {
  function allCPUTimes (line 175) | func allCPUTimes(sys *common.SystemLib) ([]TimesStat, error) {

FILE: cpu/cpu_darwin_arm64.go
  function getFrequency (line 15) | func getFrequency() (float64, error) {

FILE: cpu/cpu_darwin_fallback.go
  function getFrequency (line 8) | func getFrequency() (float64, error) {

FILE: cpu/cpu_darwin_test.go
  function TestInfo_AppleSilicon (line 15) | func TestInfo_AppleSilicon(t *testing.T) {

FILE: cpu/cpu_dragonfly.go
  function init (line 31) | func init() {
  function timeStat (line 39) | func timeStat(name string, t *cpuTimes) *TimesStat {
  function Times (line 50) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 54) | func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, erro...
  function Info (line 91) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 95) | func InfoWithContext(_ context.Context) ([]InfoStat, error) {
  function parseDmesgBoot (line 129) | func parseDmesgBoot(fileName string) (InfoStat, error) {
  function CountsWithContext (line 160) | func CountsWithContext(_ context.Context, _ bool) (int, error) {

FILE: cpu/cpu_dragonfly_amd64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_fallback.go
  function Times (line 13) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 17) | func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, er...
  function Info (line 21) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 25) | func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 29) | func CountsWithContext(ctx context.Context, logical bool) (int, error) {

FILE: cpu/cpu_freebsd.go
  function init (line 32) | func init() {
  function timeStat (line 40) | func timeStat(name string, t *cpuTimes) *TimesStat {
  function Times (line 51) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 55) | func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, erro...
  function Info (line 92) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 96) | func InfoWithContext(_ context.Context) ([]InfoStat, error) {
  function parseDmesgBoot (line 127) | func parseDmesgBoot(fileName string) (InfoStat, int, error) {
  function CountsWithContext (line 172) | func CountsWithContext(_ context.Context, _ bool) (int, error) {

FILE: cpu/cpu_freebsd_386.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_freebsd_amd64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_freebsd_arm.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_freebsd_arm64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_freebsd_test.go
  function TestParseDmesgBoot (line 15) | func TestParseDmesgBoot(t *testing.T) {

FILE: cpu/cpu_linux.go
  function init (line 93) | func init() {
  function Times (line 101) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 105) | func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, er...
  function sysCPUPath (line 140) | func sysCPUPath(ctx context.Context, cpu int32, relPath string) string {
  function finishCPUInfo (line 144) | func finishCPUInfo(ctx context.Context, c *InfoStat) {
  function Info (line 182) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 186) | func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
  function parseStatLine (line 351) | func parseStatLine(line string) (*TimesStat, error) {
  function CountsWithContext (line 430) | func CountsWithContext(ctx context.Context, logical bool) (int, error) {
  function riscvISAParse (line 523) | func riscvISAParse(s string) []string {

FILE: cpu/cpu_linux_test.go
  function TestTimesEmpty (line 18) | func TestTimesEmpty(t *testing.T) {
  function TestParseStatLine_424 (line 26) | func TestParseStatLine_424(t *testing.T) {
  function TestCountsAgainstLscpu (line 44) | func TestCountsAgainstLscpu(t *testing.T) {
  function TestCountsLogicalAndroid_1037 (line 95) | func TestCountsLogicalAndroid_1037(t *testing.T) { // https://github.com...
  function TestCPUInfoModelNameWithColon_1958 (line 104) | func TestCPUInfoModelNameWithColon_1958(t *testing.T) { // https://githu...

FILE: cpu/cpu_netbsd.go
  constant ctlKern (line 20) | ctlKern    = 1
  constant ctlHw (line 21) | ctlHw      = 6
  constant kernCpTime (line 22) | kernCpTime = 51
  function init (line 27) | func init() {
  function Times (line 35) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 39) | func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, erro...
  function Info (line 87) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 91) | func InfoWithContext(_ context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 119) | func CountsWithContext(_ context.Context, _ bool) (int, error) {

FILE: cpu/cpu_netbsd_amd64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_netbsd_arm.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_netbsd_arm64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_openbsd.go
  constant cpuOnline (line 20) | cpuOnline = 0x0001
  constant ctlKern (line 23) | ctlKern      = 1
  constant ctlHw (line 24) | ctlHw        = 6
  constant smt (line 25) | smt          = 24
  constant kernCpTime (line 26) | kernCpTime   = 40
  constant kernCPUStats (line 27) | kernCPUStats = 85
  type cpuStats (line 32) | type cpuStats struct
  function init (line 45) | func init() {
  function Times (line 53) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 57) | func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, erro...
  function Info (line 108) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 112) | func InfoWithContext(_ context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 137) | func CountsWithContext(_ context.Context, _ bool) (int, error) {

FILE: cpu/cpu_openbsd_386.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_openbsd_amd64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_openbsd_arm.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_openbsd_arm64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_openbsd_riscv64.go
  type cpuTimes (line 4) | type cpuTimes struct

FILE: cpu/cpu_plan9.go
  function Times (line 16) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 20) | func TimesWithContext(ctx context.Context, _ bool) ([]TimesStat, error) {
  function Info (line 41) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 45) | func InfoWithContext(_ context.Context) ([]InfoStat, error) {
  function CountsWithContext (line 49) | func CountsWithContext(_ context.Context, _ bool) (int, error) {

FILE: cpu/cpu_plan9_test.go
  function TestTimesPlan9 (line 36) | func TestTimesPlan9(t *testing.T) {

FILE: cpu/cpu_solaris.go
  function init (line 19) | func init() {
  function msum (line 28) | func msum(x map[float64]float64) float64 {
  function Times (line 36) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 42) | func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, er...
  function Info (line 117) | func Info() ([]InfoStat, error) {
  function InfoWithContext (line 121) | func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
  function parseISAInfo (line 154) | func parseISAInfo(cmdOutput string) ([]string, error) {
  constant psrNumCoresOffset (line 171) | psrNumCoresOffset   = 1
  constant psrNumCoresHTOffset (line 172) | psrNumCoresHTOffset = 3
  constant psrNumHTOffset (line 173) | psrNumHTOffset      = 4
  constant psrVendorIDOffset (line 174) | psrVendorIDOffset   = 5
  constant psrFamilyOffset (line 175) | psrFamilyOffset     = 7
  constant psrModelOffset (line 176) | psrModelOffset      = 8
  constant psrStepOffset (line 177) | psrStepOffset       = 9
  constant psrClockOffset (line 178) | psrClockOffset      = 10
  constant psrModelNameOffset (line 179) | psrModelNameOffset  = 11
  function parseProcessorInfo (line 182) | func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) {
  function CountsWithContext (line 265) | func CountsWithContext(_ context.Context, _ bool) (int, error) {

FILE: cpu/cpu_solaris_test.go
  function TestParseISAInfo (line 14) | func TestParseISAInfo(t *testing.T) {
  function TestParseProcessorInfo (line 67) | func TestParseProcessorInfo(t *testing.T) {

FILE: cpu/cpu_test.go
  function TestTimes (line 17) | func TestTimes(t *testing.T) {
  function TestCounts (line 67) | func TestCounts(t *testing.T) {
  function TestTimeStat_String (line 85) | func TestTimeStat_String(t *testing.T) {
  function TestInfo (line 96) | func TestInfo(t *testing.T) {
  function testPercent (line 115) | func testPercent(t *testing.T, percpu bool) {
  function testPercentLastUsed (line 150) | func testPercentLastUsed(t *testing.T, percpu bool) {
  function TestPercent (line 185) | func TestPercent(t *testing.T) {
  function TestPercentPerCpu (line 189) | func TestPercentPerCpu(t *testing.T) {
  function TestPercentIntervalZero (line 193) | func TestPercentIntervalZero(t *testing.T) {
  function TestPercentIntervalZeroPerCPU (line 197) | func TestPercentIntervalZeroPerCPU(t *testing.T) {

FILE: cpu/cpu_windows.go
  type win32_Processor (line 30) | type win32_Processor struct
  type win32_SystemProcessorPerformanceInformation (line 46) | type win32_SystemProcessorPerformanceInformation struct
  type processorPowerInformation (line 56) | type processorPowerInformation struct
  constant ClocksPerSec (line 66) | ClocksPerSec = 10000000.0
  constant win32_SystemProcessorPerformanceInformationClass (line 70) | win32_SystemProcessorPerformanceInformationClass = 8
  constant win32_SystemProcessorPerformanceInfoSize (line 73) | win32_SystemProcessorPerformanceInfoSize = uint32(unsafe.Sizeof(win32_Sy...
  constant firmwareTableProviderSignatureRSMB (line 75) | firmwareTableProviderSignatureRSMB = 0x52534d42
  constant smBiosHeaderSize (line 76) | smBiosHeaderSize                   = 8
  constant smbiosEndOfTable (line 77) | smbiosEndOfTable                   = 127
  constant smbiosTypeProcessor (line 78) | smbiosTypeProcessor                = 4
  constant smbiosProcessorMinLength (line 79) | smbiosProcessorMinLength           = 0x18
  constant centralProcessorRegistryKey (line 81) | centralProcessorRegistryKey = `HARDWARE\DESCRIPTION\System\CentralProces...
  type relationship (line 84) | type relationship
  constant relationProcessorCore (line 88) | relationProcessorCore    = relationship(0)
  constant relationProcessorPackage (line 89) | relationProcessorPackage = relationship(3)
  constant kAffinitySize (line 93) | kAffinitySize = unsafe.Sizeof(int(0))
  constant maxLogicalProcessorsPerGroup (line 95) | maxLogicalProcessorsPerGroup = uint32(unsafe.Sizeof(kAffinitySize * 8))
  constant processorInformation (line 97) | processorInformation = 11
  function Times (line 101) | func Times(percpu bool) ([]TimesStat, error) {
  function TimesWithContext (line 105) | func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, erro...
  function Info (line 140) | func Info() ([]InfoStat, error) {
  function forEachSetBit64 (line 150) | func forEachSetBit64(mask uint64, fn func(bit int)) {
  function getProcessorPowerInformation (line 159) | func getProcessorPowerInformation(ctx context.Context) ([]processorPower...
  function InfoWithContext (line 184) | func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
  function perCPUTimes (line 245) | func perCPUTimes() ([]TimesStat, error) {
  function perfInfo (line 265) | func perfInfo() ([]win32_SystemProcessorPerformanceInformation, error) {
  type systemInfo (line 304) | type systemInfo struct
  type groupAffinity (line 318) | type groupAffinity struct
  type processorRelationship (line 325) | type processorRelationship struct
  type systemLogicalProcessorInformationEx (line 334) | type systemLogicalProcessorInformationEx struct
  function getSMBIOSProcessorInfo (line 342) | func getSMBIOSProcessorInfo() (family uint8, processorId string, err err...
  function getSystemLogicalProcessorInformationEx (line 414) | func getSystemLogicalProcessorInformationEx(relationship relationship) (...
  function getPhysicalCoreCount (line 443) | func getPhysicalCoreCount() (int, error) {
  function getRegistryStringValueIfUnset (line 448) | func getRegistryStringValueIfUnset(key registry.Key, keyName, value stri...
  function CountsWithContext (line 459) | func CountsWithContext(_ context.Context, logical bool) (int, error) {

FILE: disk/disk.go
  type UsageStat (line 15) | type UsageStat struct
    method String (line 52) | func (d UsageStat) String() string {
  type PartitionStat (line 28) | type PartitionStat struct
    method String (line 57) | func (d PartitionStat) String() string {
  type IOCountersStat (line 35) | type IOCountersStat struct
    method String (line 62) | func (d IOCountersStat) String() string {
  function Usage (line 70) | func Usage(path string) (*UsageStat, error) {
  function Partitions (line 79) | func Partitions(all bool) ([]PartitionStat, error) {
  function IOCounters (line 83) | func IOCounters(names ...string) (map[string]IOCountersStat, error) {
  function SerialNumber (line 89) | func SerialNumber(name string) (string, error) {
  function Label (line 97) | func Label(name string) (string, error) {

FILE: disk/disk_aix.go
  function LabelWithContext (line 14) | func LabelWithContext(_ context.Context, _ string) (string, error) {
  function SerialNumberWithContext (line 21) | func SerialNumberWithContext(ctx context.Context, name string) (string, ...

FILE: disk/disk_aix_cgo.go
  function IOCountersWithContext (line 18) | func IOCountersWithContext(_ context.Context, names ...string) (map[stri...
  function init (line 57) | func init() {
  function PartitionsWithContext (line 66) | func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionSt...
  function UsageWithContext (line 89) | func UsageWithContext(ctx context.Context, path string) (*UsageStat, err...

FILE: disk/disk_aix_nocgo.go
  function IOCountersWithContext (line 29) | func IOCountersWithContext(_ context.Context, _ ...string) (map[string]I...
  function PartitionsWithContext (line 33) | func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat...
  function getFsType (line 87) | func getFsType(stat unix.Statfs_t) string {
  function UsageWithContext (line 91) | func UsageWithContext(ctx context.Context, path string) (*UsageStat, err...
  function GetMountFSTypeWithContext (line 178) | func GetMountFSTypeWithContext(ctx context.Context, mp string) (string, ...

FILE: disk/disk_darwin.go
  function PartitionsWithContext (line 21) | func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, ...
  function getFsType (line 96) | func getFsType(stat unix.Statfs_t) string {
  type spnvmeDataTypeItem (line 100) | type spnvmeDataTypeItem struct
  type spnvmeDataWrapper (line 122) | type spnvmeDataWrapper struct
  function SerialNumberWithContext (line 128) | func SerialNumberWithContext(ctx context.Context, _ string) (string, err...
  function LabelWithContext (line 156) | func LabelWithContext(_ context.Context, _ string) (string, error) {
  function IOCountersWithContext (line 160) | func IOCountersWithContext(_ context.Context, names ...string) (map[stri...
  constant kIOBSDNameKey (line 229) | kIOBSDNameKey = "BSD Name"
  constant kIOBlockStorageDriverStatisticsKey (line 233) | kIOBlockStorageDriverStatisticsKey               = "Statistics"
  constant kIOBlockStorageDriverStatisticsBytesReadKey (line 234) | kIOBlockStorageDriverStatisticsBytesReadKey      = "Bytes (Read)"
  constant kIOBlockStorageDriverStatisticsBytesWrittenKey (line 235) | kIOBlockStorageDriverStatisticsBytesWrittenKey   = "Bytes (Write)"
  constant kIOBlockStorageDriverStatisticsReadsKey (line 236) | kIOBlockStorageDriverStatisticsReadsKey          = "Operations (Read)"
  constant kIOBlockStorageDriverStatisticsWritesKey (line 237) | kIOBlockStorageDriverStatisticsWritesKey         = "Operations (Write)"
  constant kIOBlockStorageDriverStatisticsTotalReadTimeKey (line 238) | kIOBlockStorageDriverStatisticsTotalReadTimeKey  = "Total Time (Read)"
  constant kIOBlockStorageDriverStatisticsTotalWriteTimeKey (line 239) | kIOBlockStorageDriverStatisticsTotalWriteTimeKey = "Total Time (Write)"
  type ioCounters (line 242) | type ioCounters struct
    method getDriveStat (line 247) | func (i *ioCounters) getDriveStat(d uint32) (*IOCountersStat, error) {
    method fillStat (line 284) | func (i *ioCounters) fillStat(d uint32) (*IOCountersStat, error) {
    method cfStr (line 324) | func (i *ioCounters) cfStr(str string) unsafe.Pointer {

FILE: disk/disk_fallback.go
  function IOCountersWithContext (line 12) | func IOCountersWithContext(_ context.Context, _ ...string) (map[string]I...
  function PartitionsWithContext (line 16) | func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, ...
  function UsageWithContext (line 20) | func UsageWithContext(_ context.Context, _ string) (*UsageStat, error) {
  function SerialNumberWithContext (line 24) | func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
  function LabelWithContext (line 28) | func LabelWithContext(_ context.Context, _ string) (string, error) {

FILE: disk/disk_freebsd.go
  function PartitionsWithContext (line 22) | func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, ...
  function IOCountersWithContext (line 101) | func IOCountersWithContext(ctx context.Context, names ...string) (map[st...
  method Compute (line 147) | func (b bintime) Compute() float64 {
  function parsedevstat (line 154) | func parsedevstat(buf []byte) (devstat, error) {
  function getFsType (line 164) | func getFsType(stat unix.Statfs_t) string {
  function SerialNumberWithContext (line 168) | func SerialNumberWithContext(ctx context.Context, name string) (string, ...
  function LabelWithContext (line 191) | func LabelWithContext(_ context.Context, _ string) (string, error) {

FILE: disk/disk_freebsd_386.go
  constant sizeofPtr (line 8) | sizeofPtr        = 0x4
  constant sizeofShort (line 9) | sizeofShort      = 0x2
  constant sizeofInt (line 10) | sizeofInt        = 0x4
  constant sizeofLong (line 11) | sizeofLong       = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong   = 0x8
  constant sizeofLongDouble (line 13) | sizeofLongDouble = 0x8
  constant devstat_NO_DATA (line 15) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 16) | devstat_READ    = 0x01
  constant devstat_WRITE (line 17) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 18) | devstat_FREE    = 0x03
  constant sizeOfdevstat (line 22) | sizeOfdevstat = 0xf0
  type _C_short (line 26) | type _C_short
  type _C_int (line 27) | type _C_int
  type _C_long (line 28) | type _C_long
  type _C_long_long (line 29) | type _C_long_long
  type _C_long_double (line 30) | type _C_long_double
  type devstat (line 33) | type devstat struct
  type bintime (line 57) | type bintime struct
  type _Ctype_struct___0 (line 62) | type _Ctype_struct___0 struct

FILE: disk/disk_freebsd_amd64.go
  constant sizeofPtr (line 8) | sizeofPtr        = 0x8
  constant sizeofShort (line 9) | sizeofShort      = 0x2
  constant sizeofInt (line 10) | sizeofInt        = 0x4
  constant sizeofLong (line 11) | sizeofLong       = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong   = 0x8
  constant sizeofLongDouble (line 13) | sizeofLongDouble = 0x8
  constant devstat_NO_DATA (line 15) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 16) | devstat_READ    = 0x01
  constant devstat_WRITE (line 17) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 18) | devstat_FREE    = 0x03
  constant sizeOfdevstat (line 22) | sizeOfdevstat = 0x120
  type _C_short (line 26) | type _C_short
  type _C_int (line 27) | type _C_int
  type _C_long (line 28) | type _C_long
  type _C_long_long (line 29) | type _C_long_long
  type _C_long_double (line 30) | type _C_long_double
  type devstat (line 33) | type devstat struct
  type bintime (line 60) | type bintime struct
  type _Ctype_struct___0 (line 65) | type _Ctype_struct___0 struct

FILE: disk/disk_freebsd_arm.go
  constant sizeofPtr (line 8) | sizeofPtr        = 0x4
  constant sizeofShort (line 9) | sizeofShort      = 0x2
  constant sizeofInt (line 10) | sizeofInt        = 0x4
  constant sizeofLong (line 11) | sizeofLong       = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong   = 0x8
  constant sizeofLongDouble (line 13) | sizeofLongDouble = 0x8
  constant devstat_NO_DATA (line 15) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 16) | devstat_READ    = 0x01
  constant devstat_WRITE (line 17) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 18) | devstat_FREE    = 0x03
  constant sizeOfdevstat (line 22) | sizeOfdevstat = 0xf0
  type _C_short (line 26) | type _C_short
  type _C_int (line 27) | type _C_int
  type _C_long (line 28) | type _C_long
  type _C_long_long (line 29) | type _C_long_long
  type _C_long_double (line 30) | type _C_long_double
  type devstat (line 33) | type devstat struct
  type bintime (line 57) | type bintime struct
  type _Ctype_struct___0 (line 62) | type _Ctype_struct___0 struct

FILE: disk/disk_freebsd_arm64.go
  constant sizeofPtr (line 10) | sizeofPtr        = 0x8
  constant sizeofShort (line 11) | sizeofShort      = 0x2
  constant sizeofInt (line 12) | sizeofInt        = 0x4
  constant sizeofLong (line 13) | sizeofLong       = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong   = 0x8
  constant sizeofLongDouble (line 15) | sizeofLongDouble = 0x8
  constant devstat_NO_DATA (line 17) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 18) | devstat_READ    = 0x01
  constant devstat_WRITE (line 19) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 20) | devstat_FREE    = 0x03
  constant sizeOfdevstat (line 24) | sizeOfdevstat = 0x120
  type _C_short (line 28) | type _C_short
  type _C_int (line 29) | type _C_int
  type _C_long (line 30) | type _C_long
  type _C_long_long (line 31) | type _C_long_long
  type _C_long_double (line 32) | type _C_long_double
  type devstat (line 35) | type devstat struct
  type bintime (line 59) | type bintime struct
  type _Ctype_struct___0 (line 64) | type _Ctype_struct___0 struct

FILE: disk/disk_linux.go
  constant sectorSize (line 23) | sectorSize = 512
  constant ADFS_SUPER_MAGIC (line 28) | ADFS_SUPER_MAGIC      = 0xadf5
  constant AFFS_SUPER_MAGIC (line 29) | AFFS_SUPER_MAGIC      = 0xADFF
  constant BDEVFS_MAGIC (line 30) | BDEVFS_MAGIC          = 0x62646576
  constant BEFS_SUPER_MAGIC (line 31) | BEFS_SUPER_MAGIC      = 0x42465331
  constant BFS_MAGIC (line 32) | BFS_MAGIC             = 0x1BADFACE
  constant BINFMTFS_MAGIC (line 33) | BINFMTFS_MAGIC        = 0x42494e4d
  constant BTRFS_SUPER_MAGIC (line 34) | BTRFS_SUPER_MAGIC     = 0x9123683E
  constant CGROUP_SUPER_MAGIC (line 35) | CGROUP_SUPER_MAGIC    = 0x27e0eb
  constant CIFS_MAGIC_NUMBER (line 36) | CIFS_MAGIC_NUMBER     = 0xFF534D42
  constant CODA_SUPER_MAGIC (line 37) | CODA_SUPER_MAGIC      = 0x73757245
  constant COH_SUPER_MAGIC (line 38) | COH_SUPER_MAGIC       = 0x012FF7B7
  constant CRAMFS_MAGIC (line 39) | CRAMFS_MAGIC          = 0x28cd3d45
  constant DEBUGFS_MAGIC (line 40) | DEBUGFS_MAGIC         = 0x64626720
  constant DEVFS_SUPER_MAGIC (line 41) | DEVFS_SUPER_MAGIC     = 0x1373
  constant DEVPTS_SUPER_MAGIC (line 42) | DEVPTS_SUPER_MAGIC    = 0x1cd1
  constant EFIVARFS_MAGIC (line 43) | EFIVARFS_MAGIC        = 0xde5e81e4
  constant EFS_SUPER_MAGIC (line 44) | EFS_SUPER_MAGIC       = 0x00414A53
  constant EXT_SUPER_MAGIC (line 45) | EXT_SUPER_MAGIC       = 0x137D
  constant EXT2_OLD_SUPER_MAGIC (line 46) | EXT2_OLD_SUPER_MAGIC  = 0xEF51
  constant EXT2_SUPER_MAGIC (line 47) | EXT2_SUPER_MAGIC      = 0xEF53
  constant EXT3_SUPER_MAGIC (line 48) | EXT3_SUPER_MAGIC      = 0xEF53
  constant EXT4_SUPER_MAGIC (line 49) | EXT4_SUPER_MAGIC      = 0xEF53
  constant FUSE_SUPER_MAGIC (line 50) | FUSE_SUPER_MAGIC      = 0x65735546
  constant FUTEXFS_SUPER_MAGIC (line 51) | FUTEXFS_SUPER_MAGIC   = 0xBAD1DEA
  constant HFS_SUPER_MAGIC (line 52) | HFS_SUPER_MAGIC       = 0x4244
  constant HFSPLUS_SUPER_MAGIC (line 53) | HFSPLUS_SUPER_MAGIC   = 0x482b
  constant HOSTFS_SUPER_MAGIC (line 54) | HOSTFS_SUPER_MAGIC    = 0x00c0ffee
  constant HPFS_SUPER_MAGIC (line 55) | HPFS_SUPER_MAGIC      = 0xF995E849
  constant HUGETLBFS_MAGIC (line 56) | HUGETLBFS_MAGIC       = 0x958458f6
  constant ISOFS_SUPER_MAGIC (line 57) | ISOFS_SUPER_MAGIC     = 0x9660
  constant JFFS2_SUPER_MAGIC (line 58) | JFFS2_SUPER_MAGIC     = 0x72b6
  constant JFS_SUPER_MAGIC (line 59) | JFS_SUPER_MAGIC       = 0x3153464a
  constant MINIX_SUPER_MAGIC (line 60) | MINIX_SUPER_MAGIC     = 0x137F
  constant MINIX_SUPER_MAGIC2 (line 61) | MINIX_SUPER_MAGIC2    = 0x138F
  constant MINIX2_SUPER_MAGIC (line 62) | MINIX2_SUPER_MAGIC    = 0x2468
  constant MINIX2_SUPER_MAGIC2 (line 63) | MINIX2_SUPER_MAGIC2   = 0x2478
  constant MINIX3_SUPER_MAGIC (line 64) | MINIX3_SUPER_MAGIC    = 0x4d5a
  constant MQUEUE_MAGIC (line 65) | MQUEUE_MAGIC          = 0x19800202
  constant MSDOS_SUPER_MAGIC (line 66) | MSDOS_SUPER_MAGIC     = 0x4d44
  constant NCP_SUPER_MAGIC (line 67) | NCP_SUPER_MAGIC       = 0x564c
  constant NFS_SUPER_MAGIC (line 68) | NFS_SUPER_MAGIC       = 0x6969
  constant NILFS_SUPER_MAGIC (line 69) | NILFS_SUPER_MAGIC     = 0x3434
  constant NTFS_SB_MAGIC (line 70) | NTFS_SB_MAGIC         = 0x5346544e
  constant OCFS2_SUPER_MAGIC (line 71) | OCFS2_SUPER_MAGIC     = 0x7461636f
  constant OPENPROM_SUPER_MAGIC (line 72) | OPENPROM_SUPER_MAGIC  = 0x9fa1
  constant PIPEFS_MAGIC (line 73) | PIPEFS_MAGIC          = 0x50495045
  constant PROC_SUPER_MAGIC (line 74) | PROC_SUPER_MAGIC      = 0x9fa0
  constant PSTOREFS_MAGIC (line 75) | PSTOREFS_MAGIC        = 0x6165676C
  constant QNX4_SUPER_MAGIC (line 76) | QNX4_SUPER_MAGIC      = 0x002f
  constant QNX6_SUPER_MAGIC (line 77) | QNX6_SUPER_MAGIC      = 0x68191122
  constant RAMFS_MAGIC (line 78) | RAMFS_MAGIC           = 0x858458f6
  constant REISERFS_SUPER_MAGIC (line 79) | REISERFS_SUPER_MAGIC  = 0x52654973
  constant ROMFS_MAGIC (line 80) | ROMFS_MAGIC           = 0x7275
  constant SELINUX_MAGIC (line 81) | SELINUX_MAGIC         = 0xf97cff8c
  constant SMACK_MAGIC (line 82) | SMACK_MAGIC           = 0x43415d53
  constant SMB_SUPER_MAGIC (line 83) | SMB_SUPER_MAGIC       = 0x517B
  constant SOCKFS_MAGIC (line 84) | SOCKFS_MAGIC          = 0x534F434B
  constant SQUASHFS_MAGIC (line 85) | SQUASHFS_MAGIC        = 0x73717368
  constant SYSFS_MAGIC (line 86) | SYSFS_MAGIC           = 0x62656572
  constant SYSV2_SUPER_MAGIC (line 87) | SYSV2_SUPER_MAGIC     = 0x012FF7B6
  constant SYSV4_SUPER_MAGIC (line 88) | SYSV4_SUPER_MAGIC     = 0x012FF7B5
  constant TMPFS_MAGIC (line 89) | TMPFS_MAGIC           = 0x01021994
  constant UDF_SUPER_MAGIC (line 90) | UDF_SUPER_MAGIC       = 0x15013346
  constant UFS_MAGIC (line 91) | UFS_MAGIC             = 0x00011954
  constant USBDEVICE_SUPER_MAGIC (line 92) | USBDEVICE_SUPER_MAGIC = 0x9fa2
  constant V9FS_MAGIC (line 93) | V9FS_MAGIC            = 0x01021997
  constant VXFS_SUPER_MAGIC (line 94) | VXFS_SUPER_MAGIC      = 0xa501FCF5
  constant XENFS_SUPER_MAGIC (line 95) | XENFS_SUPER_MAGIC     = 0xabba1974
  constant XENIX_SUPER_MAGIC (line 96) | XENIX_SUPER_MAGIC     = 0x012FF7B4
  constant XFS_SUPER_MAGIC (line 97) | XFS_SUPER_MAGIC       = 0x58465342
  constant _XIAFS_SUPER_MAGIC (line 98) | _XIAFS_SUPER_MAGIC    = 0x012FD16D
  constant AFS_SUPER_MAGIC (line 100) | AFS_SUPER_MAGIC             = 0x5346414F
  constant AUFS_SUPER_MAGIC (line 101) | AUFS_SUPER_MAGIC            = 0x61756673
  constant ANON_INODE_FS_SUPER_MAGIC (line 102) | ANON_INODE_FS_SUPER_MAGIC   = 0x09041934
  constant BCACHEFS_SUPER_MAGIC (line 103) | BCACHEFS_SUPER_MAGIC        = 0xCA451A4E
  constant BPF_FS_MAGIC (line 104) | BPF_FS_MAGIC                = 0xCAFE4A11
  constant CEPH_SUPER_MAGIC (line 105) | CEPH_SUPER_MAGIC            = 0x00C36400
  constant CGROUP2_SUPER_MAGIC (line 106) | CGROUP2_SUPER_MAGIC         = 0x63677270
  constant CONFIGFS_MAGIC (line 107) | CONFIGFS_MAGIC              = 0x62656570
  constant ECRYPTFS_SUPER_MAGIC (line 108) | ECRYPTFS_SUPER_MAGIC        = 0xF15F
  constant F2FS_SUPER_MAGIC (line 109) | F2FS_SUPER_MAGIC            = 0xF2F52010
  constant FAT_SUPER_MAGIC (line 110) | FAT_SUPER_MAGIC             = 0x4006
  constant FHGFS_SUPER_MAGIC (line 111) | FHGFS_SUPER_MAGIC           = 0x19830326
  constant FUSEBLK_SUPER_MAGIC (line 112) | FUSEBLK_SUPER_MAGIC         = 0x65735546
  constant FUSECTL_SUPER_MAGIC (line 113) | FUSECTL_SUPER_MAGIC         = 0x65735543
  constant GFS_SUPER_MAGIC (line 114) | GFS_SUPER_MAGIC             = 0x1161970
  constant GPFS_SUPER_MAGIC (line 115) | GPFS_SUPER_MAGIC            = 0x47504653
  constant MTD_INODE_FS_SUPER_MAGIC (line 116) | MTD_INODE_FS_SUPER_MAGIC    = 0x11307854
  constant INOTIFYFS_SUPER_MAGIC (line 117) | INOTIFYFS_SUPER_MAGIC       = 0x2BAD1DEA
  constant ISOFS_R_WIN_SUPER_MAGIC (line 118) | ISOFS_R_WIN_SUPER_MAGIC     = 0x4004
  constant ISOFS_WIN_SUPER_MAGIC (line 119) | ISOFS_WIN_SUPER_MAGIC       = 0x4000
  constant JFFS_SUPER_MAGIC (line 120) | JFFS_SUPER_MAGIC            = 0x07C0
  constant KAFS_SUPER_MAGIC (line 121) | KAFS_SUPER_MAGIC            = 0x6B414653
  constant LUSTRE_SUPER_MAGIC (line 122) | LUSTRE_SUPER_MAGIC          = 0x0BD00BD0
  constant NFSD_SUPER_MAGIC (line 123) | NFSD_SUPER_MAGIC            = 0x6E667364
  constant NSFS_MAGIC (line 124) | NSFS_MAGIC                  = 0x6E736673
  constant PANFS_SUPER_MAGIC (line 125) | PANFS_SUPER_MAGIC           = 0xAAD7AAEA
  constant RPC_PIPEFS_SUPER_MAGIC (line 126) | RPC_PIPEFS_SUPER_MAGIC      = 0x67596969
  constant SECURITYFS_SUPER_MAGIC (line 127) | SECURITYFS_SUPER_MAGIC      = 0x73636673
  constant TRACEFS_MAGIC (line 128) | TRACEFS_MAGIC               = 0x74726163
  constant UFS_BYTESWAPPED_SUPER_MAGIC (line 129) | UFS_BYTESWAPPED_SUPER_MAGIC = 0x54190100
  constant VMHGFS_SUPER_MAGIC (line 130) | VMHGFS_SUPER_MAGIC          = 0xBACBACBC
  constant VZFS_SUPER_MAGIC (line 131) | VZFS_SUPER_MAGIC            = 0x565A4653
  constant ZFS_SUPER_MAGIC (line 132) | ZFS_SUPER_MAGIC             = 0x2FC12FC1
  function readMountFile (line 241) | func readMountFile(root string) (lines []string, useMounts bool, filenam...
  function PartitionsWithContext (line 261) | func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionSt...
  function parseFieldsOnMounts (line 303) | func parseFieldsOnMounts(lines []string, all bool, fs []string) []Partit...
  function parseFieldsOnMountinfo (line 326) | func parseFieldsOnMountinfo(ctx context.Context, lines []string, all boo...
  function getFileSystems (line 425) | func getFileSystems(ctx context.Context) ([]string, error) {
  function IOCountersWithContext (line 447) | func IOCountersWithContext(ctx context.Context, names ...string) (map[st...
  function udevData (line 548) | func udevData(ctx context.Context, major, minor uint32, name string) (st...
  function SerialNumberWithContext (line 566) | func SerialNumberWithContext(ctx context.Context, name string) (string, ...
  function LabelWithContext (line 590) | func LabelWithContext(ctx context.Context, name string) (string, error) {
  function getFsType (line 615) | func getFsType(stat unix.Statfs_t) string {
  function getDeviceName (line 628) | func getDeviceName(name string) string {

FILE: disk/disk_linux_test.go
  function Test_parseFieldsOnMountinfo (line 14) | func Test_parseFieldsOnMountinfo(t *testing.T) {
  function Test_parseFieldsOnMountinfo_multiMount (line 59) | func Test_parseFieldsOnMountinfo_multiMount(t *testing.T) {
  function Test_parseFieldsOnMounts (line 82) | func Test_parseFieldsOnMounts(t *testing.T) {
  function TestGetDeviceName (line 117) | func TestGetDeviceName(t *testing.T) {

FILE: disk/disk_netbsd.go
  constant MNT_RDONLY (line 17) | MNT_RDONLY      = 0x00000001
  constant MNT_SYNCHRONOUS (line 18) | MNT_SYNCHRONOUS = 0x00000002
  constant MNT_NOEXEC (line 19) | MNT_NOEXEC      = 0x00000004
  constant MNT_NOSUID (line 20) | MNT_NOSUID      = 0x00000008
  constant MNT_NODEV (line 21) | MNT_NODEV       = 0x00000010
  constant MNT_ASYNC (line 22) | MNT_ASYNC       = 0x00000040
  constant MNT_NOATIME (line 23) | MNT_NOATIME     = 0x04000000
  constant MNT_SOFTDEP (line 24) | MNT_SOFTDEP     = 0x80000000
  function PartitionsWithContext (line 27) | func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, ...
  function IOCountersWithContext (line 101) | func IOCountersWithContext(_ context.Context, _ ...string) (map[string]I...
  function UsageWithContext (line 106) | func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
  function getFsType (line 144) | func getFsType(stat Statvfs) string {
  function SerialNumberWithContext (line 148) | func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
  function LabelWithContext (line 152) | func LabelWithContext(_ context.Context, _ string) (string, error) {

FILE: disk/disk_netbsd_amd64.go
  constant sizeOfStatvfs (line 10) | sizeOfStatvfs = 0xce0
  type Statvfs (line 14) | type Statvfs struct
  type _Ctype_struct___0 (line 43) | type _Ctype_struct___0 struct

FILE: disk/disk_netbsd_arm.go
  constant sizeOfStatvfs (line 10) | sizeOfStatvfs = 0xcc8
  type Statvfs (line 14) | type Statvfs struct
  type _Ctype_struct___0 (line 44) | type _Ctype_struct___0 struct

FILE: disk/disk_netbsd_arm64.go
  constant sizeOfStatvfs (line 10) | sizeOfStatvfs = 0xce0
  type Statvfs (line 14) | type Statvfs struct
  type _Ctype_struct___0 (line 43) | type _Ctype_struct___0 struct

FILE: disk/disk_openbsd.go
  function PartitionsWithContext (line 16) | func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, ...
  function IOCountersWithContext (line 74) | func IOCountersWithContext(_ context.Context, names ...string) (map[stri...
  function parseDiskstats (line 114) | func parseDiskstats(buf []byte) (Diskstats, error) {
  function UsageWithContext (line 124) | func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
  function getFsType (line 149) | func getFsType(stat unix.Statfs_t) string {
  function SerialNumberWithContext (line 153) | func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
  function LabelWithContext (line 157) | func LabelWithContext(_ context.Context, _ string) (string, error) {

FILE: disk/disk_openbsd_386.go
  constant devstat_NO_DATA (line 10) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 11) | devstat_READ    = 0x01
  constant devstat_WRITE (line 12) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 13) | devstat_FREE    = 0x03
  constant sizeOfDiskstats (line 17) | sizeOfDiskstats = 0x60
  type Diskstats (line 20) | type Diskstats struct
  type Timeval (line 32) | type Timeval struct
  type Diskstat (line 38) | type Diskstat struct
  type bintime (line 39) | type bintime struct

FILE: disk/disk_openbsd_amd64.go
  constant devstat_NO_DATA (line 8) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 9) | devstat_READ    = 0x01
  constant devstat_WRITE (line 10) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 11) | devstat_FREE    = 0x03
  constant sizeOfDiskstats (line 15) | sizeOfDiskstats = 0x70
  type Diskstats (line 18) | type Diskstats struct
  type Timeval (line 31) | type Timeval struct
  type Diskstat (line 37) | type Diskstat struct
  type bintime (line 38) | type bintime struct

FILE: disk/disk_openbsd_arm.go
  constant devstat_NO_DATA (line 10) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 11) | devstat_READ    = 0x01
  constant devstat_WRITE (line 12) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 13) | devstat_FREE    = 0x03
  constant sizeOfDiskstats (line 17) | sizeOfDiskstats = 0x60
  type Diskstats (line 20) | type Diskstats struct
  type Timeval (line 32) | type Timeval struct
  type Diskstat (line 38) | type Diskstat struct
  type bintime (line 39) | type bintime struct

FILE: disk/disk_openbsd_arm64.go
  constant devstat_NO_DATA (line 10) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 11) | devstat_READ    = 0x01
  constant devstat_WRITE (line 12) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 13) | devstat_FREE    = 0x03
  constant sizeOfDiskstats (line 17) | sizeOfDiskstats = 0x70
  type Diskstats (line 20) | type Diskstats struct
  type Timeval (line 32) | type Timeval struct
  type Diskstat (line 38) | type Diskstat struct
  type bintime (line 39) | type bintime struct

FILE: disk/disk_openbsd_riscv64.go
  constant devstat_NO_DATA (line 10) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 11) | devstat_READ    = 0x01
  constant devstat_WRITE (line 12) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 13) | devstat_FREE    = 0x03
  constant sizeOfDiskstats (line 17) | sizeOfDiskstats = 0x70
  type Diskstats (line 21) | type Diskstats struct
  type Timeval (line 33) | type Timeval struct
  type Diskstat (line 40) | type Diskstat struct
  type bintime (line 41) | type bintime struct

FILE: disk/disk_solaris.go
  constant _DEFAULT_NUM_MOUNTS (line 28) | _DEFAULT_NUM_MOUNTS = 32
  constant _MNTTAB (line 31) | _MNTTAB = "/etc/mnttab"
  function PartitionsWithContext (line 47) | func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, ...
  function IOCountersWithContext (line 90) | func IOCountersWithContext(ctx context.Context, names ...string) (map[st...
  function UsageWithContext (line 202) | func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
  function SerialNumberWithContext (line 233) | func SerialNumberWithContext(ctx context.Context, name string) (string, ...
  function LabelWithContext (line 261) | func LabelWithContext(_ context.Context, _ string) (string, error) {

FILE: disk/disk_test.go
  function TestUsage (line 16) | func TestUsage(t *testing.T) {
  function TestPartitions (line 30) | func TestPartitions(t *testing.T) {
  function TestIOCounters (line 47) | func TestIOCounters(t *testing.T) {
  function TestIOCounters_concurrency_on_darwin_cgo (line 63) | func TestIOCounters_concurrency_on_darwin_cgo(t *testing.T) {
  function TestUsageStat_String (line 79) | func TestUsageStat_String(t *testing.T) {
  function TestPartitionStat_String (line 96) | func TestPartitionStat_String(t *testing.T) {
  function TestIOCountersStat_String (line 107) | func TestIOCountersStat_String(t *testing.T) {

FILE: disk/disk_unix.go
  function UsageWithContext (line 13) | func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
  function unescapeFstab (line 57) | func unescapeFstab(path string) string {

FILE: disk/disk_windows.go
  constant maxVolumeNameLength (line 22) | maxVolumeNameLength     = uint32(windows.MAX_PATH + 1)
  constant maxFileSystemNameLength (line 23) | maxFileSystemNameLength = uint32(windows.MAX_PATH + 1)
  constant maxWarningsInDrive (line 24) | maxWarningsInDrive      = 5
  constant rw (line 29) | rw       = "rw"
  constant ro (line 30) | ro       = "ro"
  constant compress (line 31) | compress = "compress"
  constant firstPossibleDriveLetter (line 35) | firstPossibleDriveLetter = 'A'
  constant lastPossibleDriveLetter (line 36) | lastPossibleDriveLetter  = 'Z'
  type diskPerformance (line 56) | type diskPerformance struct
  function init (line 72) | func init() {
  function UsageWithContext (line 81) | func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
  function PartitionsWithContext (line 110) | func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat...
  function processVolumesMountedAsFolders (line 128) | func processVolumesMountedAsFolders(ctx context.Context, partitionStats ...
  function processVolumeLoop (line 142) | func processVolumeLoop(ctx context.Context, nextVolHandle uintptr, volNa...
  function processMountsForVolume (line 177) | func processMountsForVolume(ctx context.Context, mounts []string, proces...
  function processLogicalDrives (line 197) | func processLogicalDrives(ctx context.Context, drives []string, processe...
  function getLogicalDrives (line 222) | func getLogicalDrives(ctx context.Context) ([]string, error) {
  function buildPartitionStat (line 245) | func buildPartitionStat(path string) (PartitionStat, error) {
  function IOCountersWithContext (line 298) | func IOCountersWithContext(_ context.Context, names ...string) (map[stri...
  function SerialNumberWithContext (line 359) | func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
  function LabelWithContext (line 363) | func LabelWithContext(_ context.Context, _ string) (string, error) {
  function getVolumePaths (line 368) | func getVolumePaths(volNameBuf []uint16) ([]string, error) {
  function split0 (line 395) | func split0(s16 []uint16, end int) []string {

FILE: disk/disk_windows_test.go
  function TestGetLogicalDrives (line 13) | func TestGetLogicalDrives(t *testing.T) {
  function TestBuildPartitionStat (line 51) | func TestBuildPartitionStat(t *testing.T) {
  function TestProcessLogicalDrives (line 61) | func TestProcessLogicalDrives(t *testing.T) {

FILE: disk/types_freebsd.go
  constant sizeofPtr (line 38) | sizeofPtr        = C.sizeofPtr
  constant sizeofShort (line 39) | sizeofShort      = C.sizeof_short
  constant sizeofInt (line 40) | sizeofInt        = C.sizeof_int
  constant sizeofLong (line 41) | sizeofLong       = C.sizeof_long
  constant sizeofLongLong (line 42) | sizeofLongLong   = C.sizeof_longlong
  constant sizeofLongDouble (line 43) | sizeofLongDouble = C.sizeof_longlong
  constant devstat_NO_DATA (line 45) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 46) | devstat_READ    = 0x01
  constant devstat_WRITE (line 47) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 48) | devstat_FREE    = 0x03
  constant sizeOfdevstat (line 52) | sizeOfdevstat = C.sizeof_struct_devstat
  type _C_short (line 58) | type _C_short
  type _C_int (line 59) | type _C_int
  type _C_long (line 60) | type _C_long
  type _C_long_long (line 61) | type _C_long_long
  type _C_long_double (line 62) | type _C_long_double
  type devstat (line 66) | type devstat
  type bintime (line 67) | type bintime

FILE: disk/types_netbsd.go
  constant sizeOfStatvfs (line 25) | sizeOfStatvfs = C.sizeof_struct_statvfs
  type Statvfs (line 29) | type Statvfs

FILE: disk/types_openbsd.go
  constant devstat_NO_DATA (line 20) | devstat_NO_DATA = 0x00
  constant devstat_READ (line 21) | devstat_READ    = 0x01
  constant devstat_WRITE (line 22) | devstat_WRITE   = 0x02
  constant devstat_FREE (line 23) | devstat_FREE    = 0x03
  constant sizeOfDiskstats (line 27) | sizeOfDiskstats = C.sizeof_struct_diskstats
  type Diskstats (line 31) | type Diskstats
  type Timeval (line 32) | type Timeval
  type Diskstat (line 36) | type Diskstat
  type bintime (line 37) | type bintime

FILE: docker/docker.go
  constant nanoseconds (line 19) | nanoseconds = 1e9
  type CgroupCPUStat (line 21) | type CgroupCPUStat struct
  type CgroupMemStat (line 26) | type CgroupMemStat struct
    method String (line 61) | func (m CgroupMemStat) String() string {
  type CgroupDockerStat (line 66) | type CgroupDockerStat struct
    method String (line 74) | func (c CgroupDockerStat) String() string {

FILE: docker/docker_linux.go
  function GetDockerStat (line 22) | func GetDockerStat() ([]CgroupDockerStat, error) {
  function GetDockerStatWithContext (line 26) | func GetDockerStatWithContext(ctx context.Context) ([]CgroupDockerStat, ...
  function GetDockerIDList (line 61) | func GetDockerIDList() ([]string, error) {
  function GetDockerIDListWithContext (line 65) | func GetDockerIDListWithContext(ctx context.Context) ([]string, error) {
  function CgroupCPU (line 90) | func CgroupCPU(containerID, base string) (*CgroupCPUStat, error) {
  function CgroupCPUUsage (line 98) | func CgroupCPUUsage(containerID, base string) (float64, error) {
  function CgroupCPUWithContext (line 102) | func CgroupCPUWithContext(ctx context.Context, containerID, base string)...
  function CgroupCPUUsageWithContext (line 138) | func CgroupCPUUsageWithContext(ctx context.Context, containerID, base st...
  function CgroupCPUDocker (line 153) | func CgroupCPUDocker(containerID string) (*CgroupCPUStat, error) {
  function CgroupCPUUsageDocker (line 157) | func CgroupCPUUsageDocker(containerID string) (float64, error) {
  function CgroupCPUDockerWithContext (line 161) | func CgroupCPUDockerWithContext(ctx context.Context, containerID string)...
  function CgroupCPUDockerUsageWithContext (line 165) | func CgroupCPUDockerUsageWithContext(ctx context.Context, containerID st...
  function CgroupMem (line 169) | func CgroupMem(containerID, base string) (*CgroupMemStat, error) {
  function CgroupMemWithContext (line 173) | func CgroupMemWithContext(ctx context.Context, containerID, base string)...
  function CgroupMemDocker (line 269) | func CgroupMemDocker(containerID string) (*CgroupMemStat, error) {
  function CgroupMemDockerWithContext (line 273) | func CgroupMemDockerWithContext(ctx context.Context, containerID string)...
  function getCgroupFilePath (line 278) | func getCgroupFilePath(ctx context.Context, containerID, base, target, f...
  function getCgroupMemFile (line 293) | func getCgroupMemFile(ctx context.Context, containerID, base, file strin...

FILE: docker/docker_linux_test.go
  function TestGetDockerIDList (line 14) | func TestGetDockerIDList(_ *testing.T) {
  function TestGetDockerStat (line 25) | func TestGetDockerStat(_ *testing.T) {
  function TestCgroupCPU (line 49) | func TestCgroupCPU(t *testing.T) {
  function TestCgroupCPUInvalidId (line 59) | func TestCgroupCPUInvalidId(t *testing.T) {
  function TestCgroupMem (line 64) | func TestCgroupMem(t *testing.T) {
  function TestCgroupMemInvalidId (line 74) | func TestCgroupMemInvalidId(t *testing.T) {

FILE: docker/docker_notlinux.go
  function GetDockerStat (line 14) | func GetDockerStat() ([]CgroupDockerStat, error) {
  function GetDockerStatWithContext (line 18) | func GetDockerStatWithContext(_ context.Context) ([]CgroupDockerStat, er...
  function GetDockerIDList (line 24) | func GetDockerIDList() ([]string, error) {
  function GetDockerIDListWithContext (line 28) | func GetDockerIDListWithContext(_ context.Context) ([]string, error) {
  function CgroupCPU (line 36) | func CgroupCPU(containerID, base string) (*CgroupCPUStat, error) {
  function CgroupCPUWithContext (line 40) | func CgroupCPUWithContext(_ context.Context, _, _ string) (*CgroupCPUSta...
  function CgroupCPUDocker (line 44) | func CgroupCPUDocker(containerID string) (*CgroupCPUStat, error) {
  function CgroupCPUDockerWithContext (line 48) | func CgroupCPUDockerWithContext(ctx context.Context, containerID string)...
  function CgroupMem (line 52) | func CgroupMem(containerID, base string) (*CgroupMemStat, error) {
  function CgroupMemWithContext (line 56) | func CgroupMemWithContext(_ context.Context, _, _ string) (*CgroupMemSta...
  function CgroupMemDocker (line 60) | func CgroupMemDocker(containerID string) (*CgroupMemStat, error) {
  function CgroupMemDockerWithContext (line 64) | func CgroupMemDockerWithContext(ctx context.Context, containerID string)...

FILE: docker/main_test.go
  function TestSysAdvancedDockerInfo (line 9) | func TestSysAdvancedDockerInfo(_ *testing.T) {

FILE: host/freebsd_headers/utxdb.h
  type utmpx (line 48) | struct utmpx
  type futx (line 50) | struct futx {
  type utmpx (line 60) | struct utmpx
  type futx (line 60) | struct futx
  type utmpx (line 61) | struct utmpx
  type futx (line 61) | struct futx

FILE: host/host.go
  type InfoStat (line 21) | type InfoStat struct
    method String (line 44) | func (h InfoStat) String() string {
  type UserStat (line 37) | type UserStat struct
    method String (line 49) | func (u UserStat) String() string {
  function EnableBootTimeCache (line 57) | func EnableBootTimeCache(enable bool) {
  function Info (line 61) | func Info() (*InfoStat, error) {
  function InfoWithContext (line 65) | func InfoWithContext(ctx context.Context) (*InfoStat, error) {
  function BootTime (line 120) | func BootTime() (uint64, error) {
  function Uptime (line 124) | func Uptime() (uint64, error) {
  function Users (line 128) | func Users() ([]UserStat, error) {
  function PlatformInformation (line 132) | func PlatformInformation() (string, string, string, error) {
  function HostID (line 137) | func HostID() (string, error) {
  function Virtualization (line 141) | func Virtualization() (string, string, error) {
  function KernelVersion (line 145) | func KernelVersion() (string, error) {

FILE: host/host_aix.go
  constant user_PROCESS (line 15) | user_PROCESS = 7
  function HostIDWithContext (line 18) | func HostIDWithContext(ctx context.Context) (string, error) {
  function BootTimeWithContext (line 28) | func BootTimeWithContext(ctx context.Context) (btime uint64, err error) {
  function UptimeWithContext (line 33) | func UptimeWithContext(ctx context.Context) (uint64, error) {
  function UsersWithContext (line 38) | func UsersWithContext(ctx context.Context) ([]UserStat, error) {
  function PlatformInformationWithContext (line 76) | func PlatformInformationWithContext(ctx context.Context) (platform, fami...
  function KernelVersionWithContext (line 97) | func KernelVersionWithContext(ctx context.Context) (version string, err ...
  function KernelArch (line 107) | func KernelArch() (arch string, err error) {
  function VirtualizationWithContext (line 117) | func VirtualizationWithContext(_ context.Context) (string, string, error) {

FILE: host/host_aix_cgo.go
  function numProcs (line 12) | func numProcs(_ context.Context) (uint64, error) {

FILE: host/host_aix_nocgo.go
  function numProcs (line 12) | func numProcs(_ context.Context) (uint64, error) {

FILE: host/host_aix_ppc64.go
  constant sizeofPtr (line 9) | sizeofPtr      = 0x8
  constant sizeofShort (line 10) | sizeofShort    = 0x2
  constant sizeofInt (line 11) | sizeofInt      = 0x4
  constant sizeofLong (line 12) | sizeofLong     = 0x8
  constant sizeofLongLong (line 13) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 14) | sizeOfUtmp     = 0x180
  type _C_short (line 18) | type _C_short
  type _C_int (line 19) | type _C_int
  type _C_long (line 20) | type _C_long
  type _C_long_long (line 21) | type _C_long_long
  type utmp (line 24) | type utmp struct
  type exit_status (line 39) | type exit_status struct
  type timeval (line 44) | type timeval struct

FILE: host/host_aix_test.go
  function TestBootTimeWithContext (line 14) | func TestBootTimeWithContext(t *testing.T) {
  function TestUptimeWithContext (line 22) | func TestUptimeWithContext(t *testing.T) {

FILE: host/host_bsd.go
  function BootTimeWithContext (line 18) | func BootTimeWithContext(_ context.Context) (uint64, error) {
  function UptimeWithContext (line 37) | func UptimeWithContext(ctx context.Context) (uint64, error) {

FILE: host/host_darwin.go
  constant user_PROCESS (line 21) | user_PROCESS = 7
  function HostIDWithContext (line 23) | func HostIDWithContext(ctx context.Context) (string, error) {
  function numProcs (line 42) | func numProcs(ctx context.Context) (uint64, error) {
  function UsersWithContext (line 50) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function PlatformInformationWithContext (line 91) | func PlatformInformationWithContext(ctx context.Context) (string, string...
  function VirtualizationWithContext (line 119) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function KernelVersionWithContext (line 123) | func KernelVersionWithContext(_ context.Context) (string, error) {

FILE: host/host_darwin_amd64.go
  type utmpx32 (line 7) | type utmpx32 struct
  type timeval32 (line 18) | type timeval32 struct

FILE: host/host_darwin_arm64.go
  type utmpx32 (line 9) | type utmpx32 struct
  type timeval32 (line 20) | type timeval32 struct

FILE: host/host_fallback.go
  function HostIDWithContext (line 12) | func HostIDWithContext(_ context.Context) (string, error) {
  function numProcs (line 16) | func numProcs(_ context.Context) (uint64, error) {
  function BootTimeWithContext (line 20) | func BootTimeWithContext(_ context.Context) (uint64, error) {
  function UptimeWithContext (line 24) | func UptimeWithContext(_ context.Context) (uint64, error) {
  function UsersWithContext (line 28) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function VirtualizationWithContext (line 32) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function KernelVersionWithContext (line 36) | func KernelVersionWithContext(_ context.Context) (string, error) {
  function PlatformInformationWithContext (line 40) | func PlatformInformationWithContext(_ context.Context) (string, string, ...
  function KernelArch (line 44) | func KernelArch() (string, error) {

FILE: host/host_freebsd.go
  constant UTNameSize (line 23) | UTNameSize = 16
  constant UTLineSize (line 24) | UTLineSize = 8
  constant UTHostSize (line 25) | UTHostSize = 16
  function HostIDWithContext (line 28) | func HostIDWithContext(_ context.Context) (string, error) {
  function numProcs (line 36) | func numProcs(ctx context.Context) (uint64, error) {
  function UsersWithContext (line 44) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function PlatformInformationWithContext (line 88) | func PlatformInformationWithContext(_ context.Context) (string, string, ...
  function VirtualizationWithContext (line 102) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function getUsersFromUtmp (line 107) | func getUsersFromUtmp(utmpfile string) ([]UserStat, error) {
  function KernelVersionWithContext (line 144) | func KernelVersionWithContext(ctx context.Context) (string, error) {

FILE: host/host_freebsd_386.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmpx (line 13) | sizeOfUtmpx    = 0xc5
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type Utmp (line 23) | type Utmp struct
  type Utmpx (line 30) | type Utmpx struct

FILE: host/host_freebsd_amd64.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x8
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmpx (line 13) | sizeOfUtmpx    = 0xc5
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type Utmp (line 23) | type Utmp struct
  type Utmpx (line 30) | type Utmpx struct

FILE: host/host_freebsd_arm.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmpx (line 13) | sizeOfUtmpx    = 0xc5
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type Utmp (line 23) | type Utmp struct
  type Utmpx (line 30) | type Utmpx struct

FILE: host/host_freebsd_arm64.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmpx (line 15) | sizeOfUtmpx    = 0xc5
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type Utmp (line 25) | type Utmp struct
  type Utmpx (line 32) | type Utmpx struct

FILE: host/host_linux.go
  type lsbStruct (line 21) | type lsbStruct struct
  constant user_PROCESS (line 30) | user_PROCESS = 7
  function HostIDWithContext (line 33) | func HostIDWithContext(ctx context.Context) (string, error) {
  function numProcs (line 65) | func numProcs(ctx context.Context) (uint64, error) {
  function BootTimeWithContext (line 69) | func BootTimeWithContext(ctx context.Context) (uint64, error) {
  function UptimeWithContext (line 73) | func UptimeWithContext(_ context.Context) (uint64, error) {
  function UsersWithContext (line 81) | func UsersWithContext(ctx context.Context) ([]UserStat, error) {
  function getlsbStruct (line 123) | func getlsbStruct(ctx context.Context) (*lsbStruct, error) {
  function PlatformInformationWithContext (line 173) | func PlatformInformationWithContext(ctx context.Context) (platform, fami...
  function KernelVersionWithContext (line 327) | func KernelVersionWithContext(_ context.Context) (version string, err er...
  function getSlackwareVersion (line 336) | func getSlackwareVersion(contents []string) string {
  function getRedhatishVersion (line 344) | func getRedhatishVersion(contents []string) string {
  function getRedhatishPlatform (line 356) | func getRedhatishPlatform(contents []string) string {
  function getSuseVersion (line 372) | func getSuseVersion(contents []string) string {
  function getSusePlatform (line 384) | func getSusePlatform(contents []string) string {
  function VirtualizationWithContext (line 392) | func VirtualizationWithContext(ctx context.Context) (string, string, err...

FILE: host/host_linux_386.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x4
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x4
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x180
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type utmp (line 25) | type utmp struct
  type exit_status (line 40) | type exit_status struct
  type UtTv (line 45) | type UtTv struct

FILE: host/host_linux_amd64.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x8
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 43) | type timeval struct
  type _Ctype_struct___0 (line 48) | type _Ctype_struct___0 struct

FILE: host/host_linux_arm.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 43) | type timeval struct

FILE: host/host_linux_arm64.go
  constant sizeofPtr (line 7) | sizeofPtr      = 0x8
  constant sizeofShort (line 8) | sizeofShort    = 0x2
  constant sizeofInt (line 9) | sizeofInt      = 0x4
  constant sizeofLong (line 10) | sizeofLong     = 0x8
  constant sizeofLongLong (line 11) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 12) | sizeOfUtmp     = 0x190
  type _C_short (line 16) | type _C_short
  type _C_int (line 17) | type _C_int
  type _C_long (line 18) | type _C_long
  type _C_long_long (line 19) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 42) | type timeval struct

FILE: host/host_linux_loong64.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x190
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type utmp (line 26) | type utmp struct
  type exit_status (line 40) | type exit_status struct
  type timeval (line 44) | type timeval struct

FILE: host/host_linux_mips.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 43) | type timeval struct

FILE: host/host_linux_mips64.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 43) | type timeval struct

FILE: host/host_linux_mips64le.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 43) | type timeval struct

FILE: host/host_linux_mipsle.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x4
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x4
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 38) | type exit_status struct
  type timeval (line 43) | type timeval struct

FILE: host/host_linux_ppc64.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x180
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type utmp (line 25) | type utmp struct
  type exit_status (line 40) | type exit_status struct
  type timeval (line 45) | type timeval struct

FILE: host/host_linux_ppc64le.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x180
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type utmp (line 25) | type utmp struct
  type exit_status (line 40) | type exit_status struct
  type timeval (line 45) | type timeval struct

FILE: host/host_linux_riscv64.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x8
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x180
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type utmp (line 23) | type utmp struct
  type exit_status (line 37) | type exit_status struct
  type timeval (line 42) | type timeval struct
  type _Ctype_struct___0 (line 47) | type _Ctype_struct___0 struct

FILE: host/host_linux_s390x.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x180
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type utmp (line 25) | type utmp struct
  type exit_status (line 40) | type exit_status struct
  type timeval (line 45) | type timeval struct

FILE: host/host_linux_test.go
  function TestGetRedhatishVersion (line 16) | func TestGetRedhatishVersion(t *testing.T) {
  function TestGetRedhatishPlatform (line 35) | func TestGetRedhatishPlatform(t *testing.T) {
  function TestGetlsbStruct (line 54) | func TestGetlsbStruct(t *testing.T) {

FILE: host/host_netbsd.go
  function HostIDWithContext (line 15) | func HostIDWithContext(_ context.Context) (string, error) {
  function numProcs (line 19) | func numProcs(_ context.Context) (uint64, error) {
  function PlatformInformationWithContext (line 23) | func PlatformInformationWithContext(_ context.Context) (string, string, ...
  function VirtualizationWithContext (line 40) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function UsersWithContext (line 44) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function KernelVersionWithContext (line 49) | func KernelVersionWithContext(ctx context.Context) (string, error) {

FILE: host/host_openbsd.go
  constant UTNameSize (line 22) | UTNameSize = 32
  constant UTLineSize (line 23) | UTLineSize = 8
  constant UTHostSize (line 24) | UTHostSize = 16
  function HostIDWithContext (line 27) | func HostIDWithContext(_ context.Context) (string, error) {
  function numProcs (line 31) | func numProcs(ctx context.Context) (uint64, error) {
  function PlatformInformationWithContext (line 39) | func PlatformInformationWithContext(_ context.Context) (string, string, ...
  function VirtualizationWithContext (line 56) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function UsersWithContext (line 60) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function KernelVersionWithContext (line 98) | func KernelVersionWithContext(ctx context.Context) (string, error) {

FILE: host/host_openbsd_386.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x4
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x4
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x130
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type Utmp (line 25) | type Utmp struct
  type Timeval (line 31) | type Timeval struct

FILE: host/host_openbsd_amd64.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x8
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 13) | sizeOfUtmp     = 0x130
  type _C_short (line 17) | type _C_short
  type _C_int (line 18) | type _C_int
  type _C_long (line 19) | type _C_long
  type _C_long_long (line 20) | type _C_long_long
  type Utmp (line 23) | type Utmp struct
  type Timeval (line 30) | type Timeval struct

FILE: host/host_openbsd_arm.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x4
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x4
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x130
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type Utmp (line 25) | type Utmp struct
  type Timeval (line 31) | type Timeval struct

FILE: host/host_openbsd_arm64.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x130
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type Utmp (line 25) | type Utmp struct
  type Timeval (line 31) | type Timeval struct

FILE: host/host_openbsd_riscv64.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  constant sizeOfUtmp (line 15) | sizeOfUtmp     = 0x130
  type _C_short (line 19) | type _C_short
  type _C_int (line 20) | type _C_int
  type _C_long (line 21) | type _C_long
  type _C_long_long (line 22) | type _C_long_long
  type Utmp (line 26) | type Utmp struct
  type Timeval (line 32) | type Timeval struct

FILE: host/host_posix.go
  function KernelArch (line 8) | func KernelArch() (string, error) {

FILE: host/host_solaris.go
  function HostIDWithContext (line 20) | func HostIDWithContext(ctx context.Context) (string, error) {
  function numProcs (line 62) | func numProcs(_ context.Context) (uint64, error) {
  function BootTimeWithContext (line 72) | func BootTimeWithContext(ctx context.Context) (uint64, error) {
  function UptimeWithContext (line 86) | func UptimeWithContext(ctx context.Context) (uint64, error) {
  function UsersWithContext (line 94) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function VirtualizationWithContext (line 98) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function parseReleaseFile (line 103) | func parseReleaseFile() (string, error) {
  function parseUnameOutput (line 134) | func parseUnameOutput(ctx context.Context) (string, string, string, erro...
  function KernelVersionWithContext (line 148) | func KernelVersionWithContext(ctx context.Context) (string, error) {
  function PlatformInformationWithContext (line 153) | func PlatformInformationWithContext(ctx context.Context) (string, string...

FILE: host/host_test.go
  function TestHostID (line 16) | func TestHostID(t *testing.T) {
  function TestInfo (line 26) | func TestInfo(t *testing.T) {
  function TestUptime (line 38) | func TestUptime(t *testing.T) {
  function TestBootTime (line 51) | func TestBootTime(t *testing.T) {
  function TestUsers (line 73) | func TestUsers(t *testing.T) {
  function TestInfoStat_String (line 89) | func TestInfoStat_String(t *testing.T) {
  function TestUserStat_String (line 104) | func TestUserStat_String(t *testing.T) {
  function TestGuid (line 115) | func TestGuid(t *testing.T) {
  function TestVirtualization (line 125) | func TestVirtualization(t *testing.T) {
  function TestKernelVersion (line 146) | func TestKernelVersion(t *testing.T) {
  function TestPlatformInformation (line 157) | func TestPlatformInformation(t *testing.T) {
  function BenchmarkBootTimeWithCache (line 168) | func BenchmarkBootTimeWithCache(b *testing.B) {
  function BenchmarkBootTimeWithoutCache (line 175) | func BenchmarkBootTimeWithoutCache(b *testing.B) {

FILE: host/host_windows.go
  type osVersionInfoExW (line 31) | type osVersionInfoExW struct
  type systemInfo (line 45) | type systemInfo struct
  function HostIDWithContext (line 59) | func HostIDWithContext(_ context.Context) (string, error) {
  function numProcs (line 89) | func numProcs(ctx context.Context) (uint64, error) {
  function UptimeWithContext (line 97) | func UptimeWithContext(_ context.Context) (uint64, error) {
  function uptimeMillis (line 105) | func uptimeMillis() (uint64, error) {
  function BootTimeWithContext (line 121) | func BootTimeWithContext(_ context.Context) (uint64, error) {
  function PlatformInformationWithContext (line 139) | func PlatformInformationWithContext(_ context.Context) (platform, family...
  function platformInformation (line 147) | func platformInformation() (platform, family, version, displayVersion st...
  function UsersWithContext (line 237) | func UsersWithContext(_ context.Context) ([]UserStat, error) {
  function VirtualizationWithContext (line 243) | func VirtualizationWithContext(_ context.Context) (string, string, error) {
  function KernelVersionWithContext (line 247) | func KernelVersionWithContext(_ context.Context) (string, error) {
  function KernelArch (line 252) | func KernelArch() (string, error) {

FILE: host/types_darwin.go
  type utmpx32 (line 31) | type utmpx32
  type timeval32 (line 32) | type timeval32

FILE: host/types_freebsd.go
  constant sizeofPtr (line 27) | sizeofPtr      = C.sizeofPtr
  constant sizeofShort (line 28) | sizeofShort    = C.sizeof_short
  constant sizeofInt (line 29) | sizeofInt      = C.sizeof_int
  constant sizeofLong (line 30) | sizeofLong     = C.sizeof_long
  constant sizeofLongLong (line 31) | sizeofLongLong = C.sizeof_longlong
  constant sizeOfUtmpx (line 32) | sizeOfUtmpx    = C.sizeof_struct_futx
  type _C_short (line 38) | type _C_short
  type _C_int (line 39) | type _C_int
  type _C_long (line 40) | type _C_long
  type _C_long_long (line 41) | type _C_long_long
  type Utmp (line 45) | type Utmp
  type Utmpx (line 46) | type Utmpx

FILE: host/types_linux.go
  constant sizeofPtr (line 24) | sizeofPtr      = C.sizeofPtr
  constant sizeofShort (line 25) | sizeofShort    = C.sizeof_short
  constant sizeofInt (line 26) | sizeofInt      = C.sizeof_int
  constant sizeofLong (line 27) | sizeofLong     = C.sizeof_long
  constant sizeofLongLong (line 28) | sizeofLongLong = C.sizeof_longlong
  constant sizeOfUtmp (line 29) | sizeOfUtmp     = C.sizeof_struct_utmp
  type _C_short (line 35) | type _C_short
  type _C_int (line 36) | type _C_int
  type _C_long (line 37) | type _C_long
  type _C_long_long (line 38) | type _C_long_long
  type utmp (line 42) | type utmp
  type exit_status (line 43) | type exit_status
  type timeval (line 44) | type timeval

FILE: host/types_openbsd.go
  constant sizeofPtr (line 26) | sizeofPtr      = C.sizeofPtr
  constant sizeofShort (line 27) | sizeofShort    = C.sizeof_short
  constant sizeofInt (line 28) | sizeofInt      = C.sizeof_int
  constant sizeofLong (line 29) | sizeofLong     = C.sizeof_long
  constant sizeofLongLong (line 30) | sizeofLongLong = C.sizeof_longlong
  constant sizeOfUtmp (line 31) | sizeOfUtmp     = C.sizeof_struct_utmp
  type _C_short (line 37) | type _C_short
  type _C_int (line 38) | type _C_int
  type _C_long (line 39) | type _C_long
  type _C_long_long (line 40) | type _C_long_long
  type Utmp (line 44) | type Utmp
  type Timeval (line 45) | type Timeval

FILE: internal/common/common.go
  type Invoker (line 41) | type Invoker interface
  type Invoke (line 46) | type Invoke struct
    method Command (line 48) | func (i Invoke) Command(name string, arg ...string) ([]byte, error) {
    method CommandWithContext (line 54) | func (Invoke) CommandWithContext(ctx context.Context, name string, arg...
  type FakeInvoke (line 72) | type FakeInvoke struct
    method Command (line 78) | func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) {
    method CommandWithContext (line 99) | func (i FakeInvoke) CommandWithContext(_ context.Context, name string,...
  function ReadFile (line 104) | func ReadFile(filename string) (string, error) {
  function ReadLines (line 115) | func ReadLines(filename string) ([]string, error) {
  function ReadLine (line 120) | func ReadLine(filename, prefix string) (string, error) {
  function ReadLinesOffsetN (line 148) | func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, er...
  function IntToString (line 175) | func IntToString(orig []int8) string {
  function UintToString (line 192) | func UintToString(orig []uint8) string {
  function ByteToString (line 209) | func ByteToString(orig []byte) string {
  function ReadInts (line 233) | func ReadInts(filename string) ([]int64, error) {
  function HexToUint32 (line 260) | func HexToUint32(hex string) uint32 {
  function mustParseInt32 (line 266) | func mustParseInt32(val string) int32 {
  function mustParseUint64 (line 272) | func mustParseUint64(val string) uint64 {
  function mustParseFloat64 (line 278) | func mustParseFloat64(val string) float64 {
  function StringsHas (line 284) | func StringsHas(target []string, src string) bool {
  function StringsContains (line 294) | func StringsContains(target []string, src string) bool {
  function IntContains (line 301) | func IntContains(target []int, src int) bool {
  function attributes (line 307) | func attributes(m any) map[string]reflect.Type {
  function PathExists (line 328) | func PathExists(filename string) bool {
  function PathExistsWithContents (line 336) | func PathExistsWithContents(filename string) bool {
  function GetEnvWithContext (line 346) | func GetEnvWithContext(ctx context.Context, key, dfault string, combineW...
  function GetEnv (line 362) | func GetEnv(key, dfault string, combineWith ...string) string {
  function combine (line 371) | func combine(value string, combineWith []string) string {
  function HostProc (line 385) | func HostProc(combineWith ...string) string {
  function HostSys (line 389) | func HostSys(combineWith ...string) string {
  function HostEtc (line 393) | func HostEtc(combineWith ...string) string {
  function HostVar (line 397) | func HostVar(combineWith ...string) string {
  function HostRun (line 401) | func HostRun(combineWith ...string) string {
  function HostDev (line 405) | func HostDev(combineWith ...string) string {
  function HostRoot (line 409) | func HostRoot(combineWith ...string) string {
  function HostProcWithContext (line 413) | func HostProcWithContext(ctx context.Context, combineWith ...string) str...
  function HostProcMountInfoWithContext (line 417) | func HostProcMountInfoWithContext(ctx context.Context, combineWith ...st...
  function HostSysWithContext (line 421) | func HostSysWithContext(ctx context.Context, combineWith ...string) stri...
  function HostEtcWithContext (line 425) | func HostEtcWithContext(ctx context.Context, combineWith ...string) stri...
  function HostVarWithContext (line 429) | func HostVarWithContext(ctx context.Context, combineWith ...string) stri...
  function HostRunWithContext (line 433) | func HostRunWithContext(ctx context.Context, combineWith ...string) stri...
  function HostDevWithContext (line 437) | func HostDevWithContext(ctx context.Context, combineWith ...string) stri...
  function HostRootWithContext (line 441) | func HostRootWithContext(ctx context.Context, combineWith ...string) str...
  function getSysctrlEnv (line 447) | func getSysctrlEnv(env []string) []string {
  function Round (line 462) | func Round(val float64, n int) float64 {
  function TimeSince (line 469) | func TimeSince(ts uint64) uint64 {
  function TimeSinceMillis (line 473) | func TimeSinceMillis(ts uint64) uint64 {

FILE: internal/common/common_aix.go
  function BootTimeWithContext (line 13) | func BootTimeWithContext(ctx context.Context, invoke Invoker) (btime uin...
  function UptimeWithContext (line 31) | func UptimeWithContext(ctx context.Context, invoke Invoker) (uint64, err...
  function ParseUptime (line 52) | func ParseUptime(etimes string) uint64 {

FILE: internal/common/common_aix_test.go
  function TestParseUptimeValidInput (line 12) | func TestParseUptimeValidInput(t *testing.T) {
  function TestParseUptimeInvalidInput (line 37) | func TestParseUptimeInvalidInput(t *testing.T) {

FILE: internal/common/common_darwin.go
  type library (line 16) | type library struct
    method Dlsym (line 40) | func (lib *library) Dlsym(symbol string) (uintptr, error) {
    method Close (line 56) | func (lib *library) Close() {
  constant IOKitLibPath (line 23) | IOKitLibPath          = "/System/Library/Frameworks/IOKit.framework/IOKit"
  constant CoreFoundationLibPath (line 24) | CoreFoundationLibPath = "/System/Library/Frameworks/CoreFoundation.frame...
  constant SystemLibPath (line 25) | SystemLibPath         = "/usr/lib/libSystem.B.dylib"
  function newLibrary (line 28) | func newLibrary(path string) (*library, error) {
  function getFunc (line 44) | func getFunc[T any](lib *library, symbol string) T {
  type dlFunc (line 60) | type dlFunc struct
  method init (line 65) | func (d *dlFunc[T]) init(handle uintptr) {
  function newDlfunc (line 69) | func newDlfunc[T any](sym string) *dlFunc[T] {
  type CoreFoundationLib (line 73) | type CoreFoundationLib struct
    method CFGetTypeID (line 85) | func (c *CoreFoundationLib) CFGetTypeID(cf uintptr) int64 {
    method CFNumberCreate (line 90) | func (c *CoreFoundationLib) CFNumberCreate(allocator uintptr, theType ...
    method CFNumberGetValue (line 95) | func (c *CoreFoundationLib) CFNumberGetValue(num uintptr, theType int6...
    method CFDictionaryCreate (line 100) | func (c *CoreFoundationLib) CFDictionaryCreate(allocator uintptr, keys...
    method CFDictionaryAddValue (line 107) | func (c *CoreFoundationLib) CFDictionaryAddValue(theDict, key, value u...
    method CFDictionaryGetValue (line 112) | func (c *CoreFoundationLib) CFDictionaryGetValue(theDict, key uintptr)...
    method CFArrayGetCount (line 117) | func (c *CoreFoundationLib) CFArrayGetCount(theArray uintptr) int64 {
    method CFArrayGetValueAtIndex (line 122) | func (c *CoreFoundationLib) CFArrayGetValueAtIndex(theArray uintptr, i...
    method CFStringCreateMutable (line 127) | func (c *CoreFoundationLib) CFStringCreateMutable(alloc uintptr, maxLe...
    method CFStringGetLength (line 132) | func (c *CoreFoundationLib) CFStringGetLength(theString uintptr) int64 {
    method CFStringGetCString (line 137) | func (c *CoreFoundationLib) CFStringGetCString(theString uintptr, buff...
    method CFStringCreateWithCString (line 142) | func (c *CoreFoundationLib) CFStringCreateWithCString(alloc uintptr, c...
    method CFDataGetLength (line 147) | func (c *CoreFoundationLib) CFDataGetLength(theData uintptr) int64 {
    method CFDataGetBytePtr (line 152) | func (c *CoreFoundationLib) CFDataGetBytePtr(theData uintptr) unsafe.P...
    method CFRelease (line 157) | func (c *CoreFoundationLib) CFRelease(cf uintptr) {
  function NewCoreFoundationLib (line 77) | func NewCoreFoundationLib() (*CoreFoundationLib, error) {
  type IOKitLib (line 162) | type IOKitLib struct
    method IOServiceGetMatchingService (line 174) | func (l *IOKitLib) IOServiceGetMatchingService(mainPort uint32, matchi...
    method IOServiceGetMatchingServices (line 179) | func (l *IOKitLib) IOServiceGetMatchingServices(mainPort uint32, match...
    method IOServiceMatching (line 184) | func (l *IOKitLib) IOServiceMatching(name string) unsafe.Pointer {
    method IOServiceOpen (line 189) | func (l *IOKitLib) IOServiceOpen(service, owningTask, connType uint32,...
    method IOServiceClose (line 194) | func (l *IOKitLib) IOServiceClose(connect uint32) int32 {
    method IOIteratorNext (line 199) | func (l *IOKitLib) IOIteratorNext(iterator uint32) uint32 {
    method IORegistryEntryGetName (line 204) | func (l *IOKitLib) IORegistryEntryGetName(entry uint32, name CStr) int...
    method IORegistryEntryGetParentEntry (line 209) | func (l *IOKitLib) IORegistryEntryGetParentEntry(entry uint32, plane s...
    method IORegistryEntryCreateCFProperty (line 214) | func (l *IOKitLib) IORegistryEntryCreateCFProperty(entry uint32, key, ...
    method IORegistryEntryCreateCFProperties (line 219) | func (l *IOKitLib) IORegistryEntryCreateCFProperties(entry uint32, pro...
    method IOObjectConformsTo (line 224) | func (l *IOKitLib) IOObjectConformsTo(object uint32, className string)...
    method IOObjectRelease (line 229) | func (l *IOKitLib) IOObjectRelease(object uint32) int32 {
    method IOConnectCallStructMethod (line 234) | func (l *IOKitLib) IOConnectCallStructMethod(connection, selector uint...
    method IOHIDEventSystemClientCreate (line 239) | func (l *IOKitLib) IOHIDEventSystemClientCreate(allocator uintptr) uns...
    method IOHIDEventSystemClientSetMatching (line 244) | func (l *IOKitLib) IOHIDEventSystemClientSetMatching(client, match uin...
    method IOHIDServiceClientCopyEvent (line 249) | func (l *IOKitLib) IOHIDServiceClientCopyEvent(service uintptr, eventT...
    method IOHIDServiceClientCopyProperty (line 254) | func (l *IOKitLib) IOHIDServiceClientCopyProperty(service, property ui...
    method IOHIDEventGetFloatValue (line 259) | func (l *IOKitLib) IOHIDEventGetFloatValue(event uintptr, field int32)...
    method IOHIDEventSystemClientCopyServices (line 264) | func (l *IOKitLib) IOHIDEventSystemClientCopyServices(client uintptr) ...
  function NewIOKitLib (line 166) | func NewIOKitLib() (*IOKitLib, error) {
  type SystemLib (line 269) | type SystemLib struct
    method HostProcessorInfo (line 281) | func (s *SystemLib) HostProcessorInfo(host uint32, flavor int32, outPr...
    method HostStatistics (line 288) | func (s *SystemLib) HostStatistics(host uint32, flavor int32, hostInfo...
    method MachHostSelf (line 293) | func (s *SystemLib) MachHostSelf() uint32 {
    method MachTaskSelf (line 298) | func (s *SystemLib) MachTaskSelf() uint32 {
    method MachTimeBaseInfo (line 303) | func (s *SystemLib) MachTimeBaseInfo(info uintptr) int32 {
    method VMDeallocate (line 308) | func (s *SystemLib) VMDeallocate(targetTask uint32, vmAddress, vmSize ...
    method ProcPidPath (line 313) | func (s *SystemLib) ProcPidPath(pid int32, buffer uintptr, bufferSize ...
    method ProcPidInfo (line 318) | func (s *SystemLib) ProcPidInfo(pid, flavor int32, arg uint64, buffer ...
  function NewSystemLib (line 273) | func NewSystemLib() (*SystemLib, error) {
  constant KERN_SUCCESS (line 325) | KERN_SUCCESS = 0
  type IOServiceGetMatchingServiceFunc (line 330) | type IOServiceGetMatchingServiceFunc
  type IOServiceGetMatchingServicesFunc (line 331) | type IOServiceGetMatchingServicesFunc
  type IOServiceMatchingFunc (line 332) | type IOServiceMatchingFunc
  type IOServiceOpenFunc (line 333) | type IOServiceOpenFunc
  type IOServiceCloseFunc (line 334) | type IOServiceCloseFunc
  type IOIteratorNextFunc (line 335) | type IOIteratorNextFunc
  type IORegistryEntryGetNameFunc (line 336) | type IORegistryEntryGetNameFunc
  type IORegistryEntryGetParentEntryFunc (line 337) | type IORegistryEntryGetParentEntryFunc
  type IORegistryEntryCreateCFPropertyFunc (line 338) | type IORegistryEntryCreateCFPropertyFunc
  type IORegistryEntryCreateCFPropertiesFunc (line 339) | type IORegistryEntryCreateCFPropertiesFunc
  type IOObjectConformsToFunc (line 340) | type IOObjectConformsToFunc
  type IOObjectReleaseFunc (line 341) | type IOObjectReleaseFunc
  type IOConnectCallStructMethodFunc (line 342) | type IOConnectCallStructMethodFunc
  type IOHIDEventSystemClientCreateFunc (line 344) | type IOHIDEventSystemClientCreateFunc
  type IOHIDEventSystemClientSetMatchingFunc (line 345) | type IOHIDEventSystemClientSetMatchingFunc
  type IOHIDServiceClientCopyEventFunc (line 346) | type IOHIDServiceClientCopyEventFunc
  type IOHIDServiceClientCopyPropertyFunc (line 348) | type IOHIDServiceClientCopyPropertyFunc
  type IOHIDEventGetFloatValueFunc (line 349) | type IOHIDEventGetFloatValueFunc
  type IOHIDEventSystemClientCopyServicesFunc (line 350) | type IOHIDEventSystemClientCopyServicesFunc
  constant KIOMainPortDefault (line 354) | KIOMainPortDefault = 0
  constant KIOHIDEventTypeTemperature (line 356) | KIOHIDEventTypeTemperature = 15
  constant KNilOptions (line 358) | KNilOptions = 0
  constant KIOMediaWholeKey (line 362) | KIOMediaWholeKey = "Media"
  constant KIOServicePlane (line 363) | KIOServicePlane  = "IOService"
  type CFGetTypeIDFunc (line 368) | type CFGetTypeIDFunc
  type CFNumberCreateFunc (line 369) | type CFNumberCreateFunc
  type CFNumberGetValueFunc (line 370) | type CFNumberGetValueFunc
  type CFDictionaryCreateFunc (line 371) | type CFDictionaryCreateFunc
  type CFDictionaryAddValueFunc (line 373) | type CFDictionaryAddValueFunc
  type CFDictionaryGetValueFunc (line 374) | type CFDictionaryGetValueFunc
  type CFArrayGetCountFunc (line 375) | type CFArrayGetCountFunc
  type CFArrayGetValueAtIndexFunc (line 376) | type CFArrayGetValueAtIndexFunc
  type CFStringCreateMutableFunc (line 377) | type CFStringCreateMutableFunc
  type CFStringGetLengthFunc (line 378) | type CFStringGetLengthFunc
  type CFStringGetCStringFunc (line 379) | type CFStringGetCStringFunc
  type CFStringCreateWithCStringFunc (line 380) | type CFStringCreateWithCStringFunc
  type CFDataGetLengthFunc (line 381) | type CFDataGetLengthFunc
  type CFDataGetBytePtrFunc (line 382) | type CFDataGetBytePtrFunc
  type CFReleaseFunc (line 383) | type CFReleaseFunc
  constant KCFStringEncodingUTF8 (line 387) | KCFStringEncodingUTF8 = 0x08000100
  constant KCFNumberSInt64Type (line 388) | KCFNumberSInt64Type   = 4
  constant KCFNumberIntType (line 389) | KCFNumberIntType      = 9
  constant KCFAllocatorDefault (line 390) | KCFAllocatorDefault   = 0
  constant KCFNotFound (line 391) | KCFNotFound           = -1
  type MachTimeBaseInfo (line 395) | type MachTimeBaseInfo struct
  type HostProcessorInfoFunc (line 401) | type HostProcessorInfoFunc
  type HostStatisticsFunc (line 403) | type HostStatisticsFunc
  type MachHostSelfFunc (line 404) | type MachHostSelfFunc
  type MachTaskSelfFunc (line 405) | type MachTaskSelfFunc
  type MachTimeBaseInfoFunc (line 406) | type MachTimeBaseInfoFunc
  type VMDeallocateFunc (line 407) | type VMDeallocateFunc
  constant HostProcessorInfoSym (line 411) | HostProcessorInfoSym = "host_processor_info"
  constant HostStatisticsSym (line 412) | HostStatisticsSym    = "host_statistics"
  constant MachHostSelfSym (line 413) | MachHostSelfSym      = "mach_host_self"
  constant MachTaskSelfSym (line 414) | MachTaskSelfSym      = "mach_task_self"
  constant MachTimeBaseInfoSym (line 415) | MachTimeBaseInfoSym  = "mach_timebase_info"
  constant VMDeallocateSym (line 416) | VMDeallocateSym      = "vm_deallocate"
  constant HOST_VM_INFO (line 420) | HOST_VM_INFO       = 2
  constant HOST_CPU_LOAD_INFO (line 421) | HOST_CPU_LOAD_INFO = 3
  constant HOST_VM_INFO_COUNT (line 423) | HOST_VM_INFO_COUNT = 0xf
  type ProcPidPathFunc (line 427) | type ProcPidPathFunc
  type ProcPidInfoFunc (line 428) | type ProcPidInfoFunc
  constant SysctlSym (line 432) | SysctlSym      = "sysctl"
  constant ProcPidPathSym (line 433) | ProcPidPathSym = "proc_pidpath"
  constant ProcPidInfoSym (line 434) | ProcPidInfoSym = "proc_pidinfo"
  constant MAXPATHLEN (line 438) | MAXPATHLEN               = 1024
  constant PROC_PIDLISTFDS (line 439) | PROC_PIDLISTFDS          = 1
  constant PROC_PIDPATHINFO_MAXSIZE (line 440) | PROC_PIDPATHINFO_MAXSIZE = 4 * MAXPATHLEN
  constant PROC_PIDTASKINFO (line 441) | PROC_PIDTASKINFO         = 4
  constant PROC_PIDVNODEPATHINFO (line 442) | PROC_PIDVNODEPATHINFO    = 9
  type SMC (line 446) | type SMC struct
    method CallStruct (line 494) | func (s *SMC) CallStruct(selector uint32, inputStruct, inputStructCnt,...
    method Close (line 498) | func (s *SMC) Close() error {
  constant ioServiceSMC (line 451) | ioServiceSMC = "AppleSMC"
  constant KSMCUserClientOpen (line 454) | KSMCUserClientOpen  = 0
  constant KSMCUserClientClose (line 455) | KSMCUserClientClose = 1
  constant KSMCHandleYPCEvent (line 456) | KSMCHandleYPCEvent  = 2
  constant KSMCReadKey (line 457) | KSMCReadKey         = 5
  constant KSMCWriteKey (line 458) | KSMCWriteKey        = 6
  constant KSMCGetKeyCount (line 459) | KSMCGetKeyCount     = 7
  constant KSMCGetKeyFromIndex (line 460) | KSMCGetKeyFromIndex = 8
  constant KSMCGetKeyInfo (line 461) | KSMCGetKeyInfo      = 9
  constant KSMCSuccess (line 465) | KSMCSuccess     = 0
  constant KSMCError (line 466) | KSMCError       = 1
  constant KSMCKeyNotFound (line 467) | KSMCKeyNotFound = 132
  function NewSMC (line 470) | func NewSMC() (*SMC, error) {
  type CStr (line 506) | type CStr
    method Length (line 512) | func (s CStr) Length() int64 {
    method Ptr (line 516) | func (s CStr) Ptr() *byte {
    method Addr (line 524) | func (s CStr) Addr() uintptr {
    method GoString (line 528) | func (s CStr) GoString() string {
  function NewCStr (line 508) | func NewCStr(length int64) CStr {
  function GoString (line 544) | func GoString(cStr *byte) string {
  function GetCFStringBufLengthForUTF8 (line 556) | func GetCFStringBufLengthForUTF8(length int64) int64 {

FILE: internal/common/common_freebsd.go
  function SysctlUint (line 13) | func SysctlUint(mib string) (uint64, error) {
  function CallSyscall (line 28) | func CallSyscall(mib []int32) ([]byte, uint64, error) {

FILE: internal/common/common_linux.go
  function NumProcs (line 22) | func NumProcs() (uint64, error) {
  function NumProcsWithContext (line 26) | func NumProcsWithContext(ctx context.Context) (uint64, error) {
  function BootTimeWithContext (line 48) | func BootTimeWithContext(ctx context.Context, enableCache bool) (uint64,...
  function handleBootTimeFileReadErr (line 106) | func handleBootTimeFileReadErr(err error) (uint64, error) {
  function readBootTimeStat (line 121) | func readBootTimeStat(ctx context.Context) (uint64, error) {
  function Virtualization (line 142) | func Virtualization() (string, string, error) {
  function VirtualizationWithContext (line 153) | func VirtualizationWithContext(ctx context.Context) (string, string, err...
  function GetOSRelease (line 305) | func GetOSRelease() (platform, version string, err error) {
  function GetOSReleaseWithContext (line 309) | func GetOSReleaseWithContext(ctx context.Context) (platform, version str...
  function trimQuotes (line 336) | func trimQuotes(s string) string {

FILE: internal/common/common_netbsd.go
  function CallSyscall (line 12) | func CallSyscall(mib []int32) ([]byte, uint64, error) {

FILE: internal/common/common_openbsd.go
  function CallSyscall (line 12) | func CallSyscall(mib []int32) ([]byte, uint64, error) {

FILE: internal/common/common_test.go
  function TestReadlines (line 18) | func TestReadlines(t *testing.T) {
  function TestReadLinesOffsetN (line 24) | func TestReadLinesOffsetN(t *testing.T) {
  function TestIntToString (line 30) | func TestIntToString(t *testing.T) {
  function TestByteToString (line 34) | func TestByteToString(t *testing.T) {
  function TestHexToUint32 (line 40) | func TestHexToUint32(t *testing.T) {
  function TestMustParseInt32 (line 44) | func TestMustParseInt32(t *testing.T) {
  function TestMustParseUint64 (line 48) | func TestMustParseUint64(t *testing.T) {
  function TestMustParseFloat64 (line 52) | func TestMustParseFloat64(t *testing.T) {
  function TestStringsContains (line 57) | func TestStringsContains(t *testing.T) {
  function TestPathExists (line 63) | func TestPathExists(t *testing.T) {
  function TestPathExistsWithContents (line 68) | func TestPathExistsWithContents(t *testing.T) {
  function TestHostEtc (line 79) | func TestHostEtc(t *testing.T) {
  function TestGetSysctrlEnv (line 87) | func TestGetSysctrlEnv(t *testing.T) {
  function TestGetEnvDefault (line 109) | func TestGetEnvDefault(t *testing.T) {
  function TestGetEnvWithNoContext (line 117) | func TestGetEnvWithNoContext(t *testing.T) {
  function TestGetEnvWithContextOverride (line 126) | func TestGetEnvWithContextOverride(t *testing.T) {

FILE: internal/common/common_unix.go
  function CallLsofWithContext (line 14) | func CallLsofWithContext(ctx context.Context, invoke Invoker, pid int32,...

FILE: internal/common/common_windows.go
  type PDH_FMT_COUNTERVALUE_DOUBLE (line 20) | type PDH_FMT_COUNTERVALUE_DOUBLE struct
  type PDH_FMT_COUNTERVALUE_LARGE (line 26) | type PDH_FMT_COUNTERVALUE_LARGE struct
  type PDH_FMT_COUNTERVALUE_LONG (line 32) | type PDH_FMT_COUNTERVALUE_LONG struct
  constant ERROR_SUCCESS (line 40) | ERROR_SUCCESS        = 0
  constant ERROR_FILE_NOT_FOUND (line 41) | ERROR_FILE_NOT_FOUND = 2
  constant DRIVE_REMOVABLE (line 42) | DRIVE_REMOVABLE      = 2
  constant DRIVE_FIXED (line 43) | DRIVE_FIXED          = 3
  constant HKEY_LOCAL_MACHINE (line 44) | HKEY_LOCAL_MACHINE   = 0x80000002
  constant RRF_RT_REG_SZ (line 45) | RRF_RT_REG_SZ        = 0x00000002
  constant RRF_RT_REG_DWORD (line 46) | RRF_RT_REG_DWORD     = 0x00000010
  constant PDH_FMT_LONG (line 47) | PDH_FMT_LONG         = 0x00000100
  constant PDH_FMT_DOUBLE (line 48) | PDH_FMT_DOUBLE       = 0x00000200
  constant PDH_FMT_LARGE (line 49) | PDH_FMT_LARGE        = 0x00000400
  constant PDH_INVALID_DATA (line 50) | PDH_INVALID_DATA     = 0xc0000bc6
  constant PDH_INVALID_HANDLE (line 51) | PDH_INVALID_HANDLE   = 0xC0000bbc
  constant PDH_NO_DATA (line 52) | PDH_NO_DATA          = 0x800007d5
  constant STATUS_BUFFER_OVERFLOW (line 54) | STATUS_BUFFER_OVERFLOW      = 0x80000005
  constant STATUS_BUFFER_TOO_SMALL (line 55) | STATUS_BUFFER_TOO_SMALL     = 0xC0000023
  constant STATUS_INFO_LENGTH_MISMATCH (line 56) | STATUS_INFO_LENGTH_MISMATCH = 0xC0000004
  constant ProcessBasicInformation (line 60) | ProcessBasicInformation = 0
  constant ProcessWow64Information (line 61) | ProcessWow64Information = 26
  constant ProcessQueryInformation (line 62) | ProcessQueryInformation = windows.PROCESS_DUP_HANDLE | windows.PROCESS_Q...
  constant SystemExtendedHandleInformationClass (line 64) | SystemExtendedHandleInformationClass = 64
  type FILETIME (line 92) | type FILETIME struct
  function BytePtrToString (line 98) | func BytePtrToString(p *uint8) string {
  type CounterInfo (line 109) | type CounterInfo struct
  function CreateQuery (line 117) | func CreateQuery() (windows.Handle, error) {
  function CreateCounter (line 127) | func CreateCounter(query windows.Handle, pname, cname string) (*CounterI...
  function GetCounterValue (line 146) | func GetCounterValue(counter windows.Handle) (float64, error) {
  type Win32PerformanceCounter (line 155) | type Win32PerformanceCounter struct
    method GetValue (line 184) | func (w *Win32PerformanceCounter) GetValue() (float64, error) {
  function NewWin32PerformanceCounter (line 162) | func NewWin32PerformanceCounter(postName, counterName string) (*Win32Per...
  function ProcessorQueueLengthCounter (line 196) | func ProcessorQueueLengthCounter() (*Win32PerformanceCounter, error) {
  function WMIQueryWithContext (line 201) | func WMIQueryWithContext(ctx context.Context, query string, dst any, con...
  function ConvertDOSPath (line 228) | func ConvertDOSPath(p string) string {
  type NtStatus (line 244) | type NtStatus
    method Error (line 246) | func (s NtStatus) Error() error {
    method IsError (line 253) | func (s NtStatus) IsError() bool {
  type SystemExtendedHandleTableEntryInformation (line 257) | type SystemExtendedHandleTableEntryInformation struct
  type SystemExtendedHandleInformation (line 268) | type SystemExtendedHandleInformation struct
  function CallWithExpandingBuffer (line 275) | func CallWithExpandingBuffer(fn func() NtStatus, buf *[]byte, resultLeng...
  function NtQuerySystemInformation (line 293) | func NtQuerySystemInformation(

FILE: internal/common/endian.go
  function IsLittleEndian (line 8) | func IsLittleEndian() bool {

FILE: internal/common/readlink_linux.go
  function ignoringEINTR2 (line 20) | func ignoringEINTR2[T any](fn func() (T, error)) (T, error) {
  function fixCount (line 31) | func fixCount(n int, err error) (int, error) {
  function Readlink (line 39) | func Readlink(name string) (string, error) {

FILE: internal/common/sleep.go
  function Sleep (line 11) | func Sleep(ctx context.Context, interval time.Duration) error {

FILE: internal/common/sleep_test.go
  function TestSleep (line 13) | func TestSleep(test *testing.T) {

FILE: internal/common/warnings.go
  constant maxWarnings (line 10) | maxWarnings             = 100
  constant tooManyErrorsMessage (line 11) | tooManyErrorsMessage    = "too many errors reported, next errors were di...
  constant numberOfWarningsMessage (line 12) | numberOfWarningsMessage = "Number of warnings:"
  type Warnings (line 15) | type Warnings struct
    method Add (line 21) | func (w *Warnings) Add(err error) {
    method Reference (line 29) | func (w *Warnings) Reference() error {
    method Error (line 36) | func (w *Warnings) Error() string {

FILE: internal/common/warnings_test.go
  function TestWarnings_AddAndReference (line 13) | func TestWarnings_AddAndReference(t *testing.T) {
  function TestWarnings_MaxLimit (line 21) | func TestWarnings_MaxLimit(t *testing.T) {
  function TestWarnings_ErrorVerbose (line 30) | func TestWarnings_ErrorVerbose(t *testing.T) {
  function TestWarnings_ErrorNonVerbose (line 41) | func TestWarnings_ErrorNonVerbose(t *testing.T) {
  function TestWarnings_ErrorTooMany (line 48) | func TestWarnings_ErrorTooMany(t *testing.T) {

FILE: load/load.go
  type AvgStat (line 12) | type AvgStat struct
    method String (line 18) | func (l AvgStat) String() string {
  type MiscStat (line 23) | type MiscStat struct
    method String (line 31) | func (m MiscStat) String() string {

FILE: load/load_aix.go
  function Avg (line 10) | func Avg() (*AvgStat, error) {
  function Misc (line 17) | func Misc() (*MiscStat, error) {

FILE: load/load_aix_cgo.go
  function AvgWithContext (line 22) | func AvgWithContext(ctx context.Context) (*AvgStat, error) {
  function MiscWithContext (line 36) | func MiscWithContext(ctx context.Context) (*MiscStat, error) {

FILE: load/load_aix_nocgo.go
  function AvgWithContext (line 18) | func AvgWithContext(ctx context.Context) (*AvgStat, error) {
  function MiscWithContext (line 47) | func MiscWithContext(ctx context.Context) (*MiscStat, error) {

FILE: load/load_bsd.go
  function Avg (line 14) | func Avg() (*AvgStat, error) {
  function AvgWithContext (line 18) | func AvgWithContext(_ context.Context) (*AvgStat, error) {
  type forkstat (line 40) | type forkstat struct
  function Misc (line 49) | func Misc() (*MiscStat, error) {
  function MiscWithContext (line 53) | func MiscWithContext(ctx context.Context) (*MiscStat, error) {

FILE: load/load_darwin.go
  function Avg (line 14) | func Avg() (*AvgStat, error) {
  function AvgWithContext (line 18) | func AvgWithContext(_ context.Context) (*AvgStat, error) {
  function Misc (line 45) | func Misc() (*MiscStat, error) {
  function MiscWithContext (line 49) | func MiscWithContext(ctx context.Context) (*MiscStat, error) {

FILE: load/load_fallback.go
  function Avg (line 12) | func Avg() (*AvgStat, error) {
  function AvgWithContext (line 16) | func AvgWithContext(_ context.Context) (*AvgStat, error) {
  function Misc (line 20) | func Misc() (*MiscStat, error) {
  function MiscWithContext (line 24) | func MiscWithContext(_ context.Context) (*MiscStat, error) {

FILE: load/load_freebsd.go
  function getForkStat (line 6) | func getForkStat() (forkstat, error) {

FILE: load/load_linux.go
  function Avg (line 16) | func Avg() (*AvgStat, error) {
  function AvgWithContext (line 20) | func AvgWithContext(ctx context.Context) (*AvgStat, error) {
  function sysinfoAvgWithContext (line 28) | func sysinfoAvgWithContext() (*AvgStat, error) {
  function fileAvgWithContext (line 43) | func fileAvgWithContext(ctx context.Context) (*AvgStat, error) {
  function Misc (line 73) | func Misc() (*MiscStat, error) {
  function MiscWithContext (line 77) | func MiscWithContext(ctx context.Context) (*MiscStat, error) {
  function readLoadAvgFromFile (line 119) | func readLoadAvgFromFile(ctx context.Context) ([]string, error) {

FILE: load/load_openbsd.go
  function getForkStat (line 12) | func getForkStat() (forkstat, error) {

FILE: load/load_solaris.go
  function Avg (line 14) | func Avg() (*AvgStat, error) {
  function AvgWithContext (line 18) | func AvgWithContext(ctx context.Context) (*AvgStat, error) {
  function Misc (line 56) | func Misc() (*MiscStat, error) {
  function MiscWithContext (line 60) | func MiscWithContext(ctx context.Context) (*MiscStat, error) {

FILE: load/load_test.go
  function TestAvg (line 14) | func TestAvg(t *testing.T) {
  function TestAvgStat_String (line 26) | func TestAvgStat_String(t *testing.T) {
  function TestMisc (line 37) | func TestMisc(t *testing.T) {
  function TestMiscStatString (line 49) | func TestMiscStatString(t *testing.T) {
  function BenchmarkLoad (line 62) | func BenchmarkLoad(b *testing.B) {

FILE: load/load_windows.go
  function loadAvgGoroutine (line 28) | func loadAvgGoroutine(ctx context.Context) {
  function Avg (line 66) | func Avg() (*AvgStat, error) {
  function AvgWithContext (line 70) | func AvgWithContext(ctx context.Context) (*AvgStat, error) {
  function Misc (line 85) | func Misc() (*MiscStat, error) {
  function MiscWithContext (line 89) | func MiscWithContext(_ context.Context) (*MiscStat, error) {

FILE: mem/ex_linux.go
  type ExVirtualMemory (line 11) | type ExVirtualMemory struct
    method String (line 21) | func (v ExVirtualMemory) String() string {
  type ExLinux (line 26) | type ExLinux struct
    method VirtualMemory (line 32) | func (ex *ExLinux) VirtualMemory() (*ExVirtualMemory, error) {
    method VirtualMemoryWithContext (line 36) | func (*ExLinux) VirtualMemoryWithContext(ctx context.Context) (*ExVirt...
  function NewExLinux (line 28) | func NewExLinux() *ExLinux {

FILE: mem/ex_windows.go
  type ExVirtualMemory (line 13) | type ExVirtualMemory struct
  type ExWindows (line 24) | type ExWindows struct
    method VirtualMemory (line 30) | func (*ExWindows) VirtualMemory() (*ExVirtualMemory, error) {
  function NewExWindows (line 26) | func NewExWindows() *ExWindows {

FILE: mem/mem.go
  type VirtualMemoryStat (line 16) | type VirtualMemoryStat struct
    method String (line 103) | func (m VirtualMemoryStat) String() string {
  type SwapMemoryStat (line 87) | type SwapMemoryStat struct
    method String (line 108) | func (m SwapMemoryStat) String() string {
  type SwapDevice (line 113) | type SwapDevice struct
    method String (line 119) | func (m SwapDevice) String() string {

FILE: mem/mem_aix.go
  function VirtualMemory (line 12) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function SwapMemory (line 16) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapDevices (line 20) | func SwapDevices() ([]*SwapDevice, error) {

FILE: mem/mem_aix_cgo.go
  function VirtualMemoryWithContext (line 12) | func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, ...
  function SwapMemoryWithContext (line 31) | func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {

FILE: mem/mem_aix_nocgo.go
  function VirtualMemoryWithContext (line 14) | func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, ...
  function SwapMemoryWithContext (line 27) | func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
  function callSVMon (line 38) | func callSVMon(ctx context.Context, virt bool) (*VirtualMemoryStat, *Swa...

FILE: mem/mem_bsd.go
  constant swapCommand (line 13) | swapCommand = "swapctl"
  constant nameCol (line 17) | nameCol     = 0
  constant totalKiBCol (line 18) | totalKiBCol = 1
  constant usedKiBCol (line 19) | usedKiBCol  = 2
  function SwapDevices (line 22) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 26) | func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) {
  function parseSwapctlOutput (line 35) | func parseSwapctlOutput(output string) ([]*SwapDevice, error) {

FILE: mem/mem_bsd_test.go
  constant validFreeBSD (line 13) | validFreeBSD = `Device:       1kB-blocks      Used:
  constant validOpenBSD (line 18) | validOpenBSD = `Device       1K-blocks      Used	Avail	Capacity	Priority
  constant invalid (line 22) | invalid = `Device:       512-blocks      Used:
  function TestParseSwapctlOutput_FreeBSD (line 27) | func TestParseSwapctlOutput_FreeBSD(t *testing.T) {
  function TestParseSwapctlOutput_OpenBSD (line 44) | func TestParseSwapctlOutput_OpenBSD(t *testing.T) {
  function TestParseSwapctlOutput_Invalid (line 55) | func TestParseSwapctlOutput_Invalid(t *testing.T) {
  function TestParseSwapctlOutput_Empty (line 60) | func TestParseSwapctlOutput_Empty(t *testing.T) {

FILE: mem/mem_darwin.go
  function getHwMemsize (line 16) | func getHwMemsize() (uint64, error) {
  type swapUsage (line 25) | type swapUsage struct
  function SwapMemory (line 34) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 38) | func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
  function SwapDevices (line 66) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 70) | func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {
  type vmStatisticsData (line 74) | type vmStatisticsData struct
  function VirtualMemory (line 83) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 87) | func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, er...

FILE: mem/mem_darwin_test.go
  function TestVirtualMemoryDarwin (line 15) | func TestVirtualMemoryDarwin(t *testing.T) {

FILE: mem/mem_fallback.go
  function VirtualMemory (line 12) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 16) | func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, er...
  function SwapMemory (line 20) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 24) | func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
  function SwapDevices (line 28) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 32) | func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {

FILE: mem/mem_freebsd.go
  function VirtualMemory (line 16) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 20) | func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, er...
  function SwapMemory (line 84) | func SwapMemory() (*SwapMemoryStat, error) {
  constant XSWDEV_VERSION11 (line 90) | XSWDEV_VERSION11 = 1
  constant XSWDEV_VERSION (line 91) | XSWDEV_VERSION   = 2
  type xswdev (line 95) | type xswdev struct
  type xswdev11 (line 105) | type xswdev11 struct
  function SwapMemoryWithContext (line 113) | func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {

FILE: mem/mem_linux.go
  constant WillBeDeletedOptOutMemAvailableCalc (line 26) | WillBeDeletedOptOutMemAvailableCalc = "optOutMemAvailableCalc"
  function VirtualMemory (line 28) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 32) | func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, ...
  function fillFromMeminfoWithContext (line 40) | func fillFromMeminfoWithContext(ctx context.Context) (*VirtualMemoryStat...
  function SwapMemory (line 344) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 348) | func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
  function calculateAvailVmem (line 420) | func calculateAvailVmem(ctx context.Context, ret *VirtualMemoryStat, ret...
  constant swapsFilename (line 459) | swapsFilename = "swaps"
  constant nameCol (line 463) | nameCol = 0
  constant totalCol (line 465) | totalCol = 2
  constant usedCol (line 466) | usedCol  = 3
  function SwapDevices (line 470) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 474) | func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) {
  function parseSwapsFile (line 485) | func parseSwapsFile(ctx context.Context, r io.Reader) ([]*SwapDevice, er...

FILE: mem/mem_linux_test.go
  function TestExVirtualMemory (line 20) | func TestExVirtualMemory(t *testing.T) {
  function TestVirtualMemoryLinux (line 154) | func TestVirtualMemoryLinux(t *testing.T) {
  function TestExVirtualMemoryLinux (line 169) | func TestExVirtualMemoryLinux(t *testing.T) {
  constant validFile (line 185) | validFile = `Filename				Type		Size		Used		Priority
  constant invalidFile (line 190) | invalidFile = `INVALID				Type		Size		Used		Priority
  function TestParseSwapsFile_ValidFile (line 195) | func TestParseSwapsFile_ValidFile(t *testing.T) {
  function TestParseSwapsFile_InvalidFile (line 212) | func TestParseSwapsFile_InvalidFile(t *testing.T) {
  function TestParseSwapsFile_EmptyFile (line 217) | func TestParseSwapsFile_EmptyFile(t *testing.T) {

FILE: mem/mem_netbsd.go
  function GetPageSize (line 14) | func GetPageSize() (uint64, error) {
  function GetPageSizeWithContext (line 18) | func GetPageSizeWithContext(_ context.Context) (uint64, error) {
  function VirtualMemory (line 26) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 30) | func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, er...
  function SwapMemory (line 60) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 64) | func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {

FILE: mem/mem_openbsd.go
  function GetPageSize (line 18) | func GetPageSize() (uint64, error) {
  function GetPageSizeWithContext (line 22) | func GetPageSizeWithContext(_ context.Context) (uint64, error) {
  function VirtualMemory (line 30) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 34) | func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, er...
  function SwapMemory (line 73) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 77) | func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {

FILE: mem/mem_openbsd_386.go
  constant CTLVfs (line 10) | CTLVfs        = 10
  constant VfsGeneric (line 11) | VfsGeneric    = 0
  constant VfsBcacheStat (line 12) | VfsBcacheStat = 3
  constant sizeOfBcachestats (line 16) | sizeOfBcachestats = 0x90
  type Bcachestats (line 19) | type Bcachestats struct

FILE: mem/mem_openbsd_amd64.go
  constant CTLVfs (line 8) | CTLVfs        = 10
  constant VfsGeneric (line 9) | VfsGeneric    = 0
  constant VfsBcacheStat (line 10) | VfsBcacheStat = 3
  constant sizeOfBcachestats (line 14) | sizeOfBcachestats = 0x78
  type Bcachestats (line 17) | type Bcachestats struct

FILE: mem/mem_openbsd_arm.go
  constant CTLVfs (line 10) | CTLVfs        = 10
  constant VfsGeneric (line 11) | VfsGeneric    = 0
  constant VfsBcacheStat (line 12) | VfsBcacheStat = 3
  constant sizeOfBcachestats (line 16) | sizeOfBcachestats = 0x90
  type Bcachestats (line 19) | type Bcachestats struct

FILE: mem/mem_openbsd_arm64.go
  constant CTLVfs (line 10) | CTLVfs        = 10
  constant VfsGeneric (line 11) | VfsGeneric    = 0
  constant VfsBcacheStat (line 12) | VfsBcacheStat = 3
  constant sizeOfBcachestats (line 16) | sizeOfBcachestats = 0x90
  type Bcachestats (line 19) | type Bcachestats struct

FILE: mem/mem_openbsd_riscv64.go
  constant CTLVfs (line 10) | CTLVfs        = 10
  constant VfsGeneric (line 11) | VfsGeneric    = 0
  constant VfsBcacheStat (line 12) | VfsBcacheStat = 3
  constant sizeOfBcachestats (line 16) | sizeOfBcachestats = 0x90
  type Bcachestats (line 19) | type Bcachestats struct

FILE: mem/mem_plan9.go
  function SwapMemory (line 15) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 19) | func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
  function VirtualMemory (line 37) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 41) | func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, ...
  function SwapDevices (line 63) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 67) | func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {

FILE: mem/mem_plan9_test.go
  function TestVirtualMemoryPlan9 (line 34) | func TestVirtualMemoryPlan9(t *testing.T) {
  function TestSwapMemoryPlan9 (line 62) | func TestSwapMemoryPlan9(t *testing.T) {

FILE: mem/mem_solaris.go
  function VirtualMemory (line 21) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 25) | func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, ...
  function SwapMemory (line 57) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 61) | func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
  function zoneName (line 65) | func zoneName(ctx context.Context) (string, error) {
  function globalZoneMemoryCapacity (line 76) | func globalZoneMemoryCapacity(ctx context.Context) (uint64, error) {
  function globalZoneFreeMemory (line 95) | func globalZoneFreeMemory(ctx context.Context) (uint64, error) {
  function nonGlobalZoneMemoryCapacity (line 116) | func nonGlobalZoneMemoryCapacity(ctx context.Context) (uint64, error) {
  constant swapCommand (line 135) | swapCommand = "swap"
  constant blockSize (line 138) | blockSize = 512
  constant nameCol (line 142) | nameCol = 0
  constant totalBlocksCol (line 145) | totalBlocksCol = 3
  constant freeBlocksCol (line 146) | freeBlocksCol  = 4
  function SwapDevices (line 149) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 153) | func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) {
  function parseSwapsCommandOutput (line 162) | func parseSwapsCommandOutput(output string) ([]*SwapDevice, error) {

FILE: mem/mem_solaris_test.go
  constant validFile (line 13) | validFile = `swapfile                  dev  swaplo blocks   free
  constant invalidFile (line 17) | invalidFile = `swapfile                  dev  swaplo INVALID   free
  function TestParseSwapsCommandOutput_Valid (line 21) | func TestParseSwapsCommandOutput_Valid(t *testing.T) {
  function TestParseSwapsCommandOutput_Invalid (line 38) | func TestParseSwapsCommandOutput_Invalid(t *testing.T) {
  function TestParseSwapsCommandOutput_Empty (line 43) | func TestParseSwapsCommandOutput_Empty(t *testing.T) {

FILE: mem/mem_test.go
  function TestVirtualMemory (line 15) | func TestVirtualMemory(t *testing.T) {
  function TestSwapMemory (line 65) | func TestSwapMemory(t *testing.T) {
  function TestVirtualMemoryStat_String (line 77) | func TestVirtualMemoryStat_String(t *testing.T) {
  function TestSwapMemoryStat_String (line 90) | func TestSwapMemoryStat_String(t *testing.T) {
  function TestSwapDevices (line 107) | func TestSwapDevices(t *testing.T) {

FILE: mem/mem_windows.go
  type memoryStatusEx (line 24) | type memoryStatusEx struct
  function VirtualMemory (line 36) | func VirtualMemory() (*VirtualMemoryStat, error) {
  function VirtualMemoryWithContext (line 40) | func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, er...
  type performanceInformation (line 61) | type performanceInformation struct
  function SwapMemory (line 78) | func SwapMemory() (*SwapMemoryStat, error) {
  function SwapMemoryWithContext (line 82) | func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
  type systemInfo (line 131) | type systemInfo struct
  type enumPageFileInformation (line 146) | type enumPageFileInformation struct
  function SwapDevices (line 154) | func SwapDevices() ([]*SwapDevice, error) {
  function SwapDevicesWithContext (line 158) | func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {
  function pEnumPageFileCallbackW (line 179) | func pEnumPageFileCallbackW(swapDevices *[]*SwapDevice, enumPageFileInfo...

FILE: mem/types_openbsd.go
  constant CTLVfs (line 20) | CTLVfs        = 10
  constant VfsGeneric (line 21) | VfsGeneric    = 0
  constant VfsBcacheStat (line 22) | VfsBcacheStat = 3
  constant sizeOfBcachestats (line 26) | sizeOfBcachestats = C.sizeof_struct_bcachestats
  type Bcachestats (line 29) | type Bcachestats

FILE: net/net.go
  type IOCountersStat (line 14) | type IOCountersStat struct
    method String (line 166) | func (n IOCountersStat) String() string {
  type Addr (line 29) | type Addr struct
    method String (line 181) | func (a Addr) String() string {
  type ConnectionStat (line 34) | type ConnectionStat struct
    method String (line 171) | func (n ConnectionStat) String() string {
  type ProtoCountersStat (line 46) | type ProtoCountersStat struct
    method String (line 176) | func (n ProtoCountersStat) String() string {
  type InterfaceAddr (line 52) | type InterfaceAddr struct
    method String (line 196) | func (n InterfaceAddr) String() string {
  type InterfaceAddrList (line 57) | type InterfaceAddrList
  type InterfaceStat (line 59) | type InterfaceStat struct
    method String (line 186) | func (n InterfaceStat) String() string {
  type InterfaceStatList (line 69) | type InterfaceStatList
    method String (line 191) | func (l InterfaceStatList) String() string {
  type FilterStat (line 71) | type FilterStat struct
  type ConntrackStat (line 77) | type ConntrackStat struct
    method String (line 201) | func (n ConntrackStat) String() string {
  function NewConntrackStat (line 97) | func NewConntrackStat(e, s, f, n, inv, ign, del, dlst, ins, insfail, dro...
  type ConntrackStatList (line 119) | type ConntrackStatList struct
    method Append (line 129) | func (l *ConntrackStatList) Append(c *ConntrackStat) {
    method Items (line 133) | func (l *ConntrackStatList) Items() []ConntrackStat {
    method Summary (line 142) | func (l *ConntrackStatList) Summary() []ConntrackStat {
  function NewConntrackStatList (line 123) | func NewConntrackStatList() *ConntrackStatList {
  function Interfaces (line 206) | func Interfaces() (InterfaceStatList, error) {
  function InterfacesWithContext (line 210) | func InterfacesWithContext(_ context.Context) (InterfaceStatList, error) {
  function getIOCountersAll (line 258) | func getIOCountersAll(n []IOCountersStat) []IOCountersStat {
  function IOCounters (line 281) | func IOCounters(pernic bool) ([]IOCountersStat, error) {
  function IOCountersByFile (line 285) | func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, e...
  function ProtoCounters (line 295) | func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
  function FilterCounters (line 302) | func FilterCounters() ([]FilterStat, error) {
  function ConntrackStats (line 307) | func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
  function Connections (line 312) | func Connections(kind string) ([]ConnectionStat, error) {
  function ConnectionsMax (line 318) | func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
  function ConnectionsWithoutUids (line 325) | func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
  function ConnectionsPid (line 330) | func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) {
  function ConnectionsPidWithoutUids (line 337) | func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat...
  function ConnectionsPidMaxWithoutUids (line 341) | func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) (...
  function ConnectionsPidMax (line 346) | func ConnectionsPidMax(kind string, pid int32, maxConn int) ([]Connectio...
  function Pids (line 354) | func Pids() ([]int32, error) {

FILE: net/net_aix.go
  function PidsWithContext (line 18) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function IOCountersByFileWithContext (line 22) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function FilterCountersWithContext (line 26) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 30) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 34) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...
  function parseNetstatNetLine (line 38) | func parseNetstatNetLine(line string) (ConnectionStat, error) {
  function parseAddr (line 84) | func parseAddr(l string, family uint32) (Addr, error) {
  function parseNetstatAddr (line 110) | func parseNetstatAddr(local, remote string, family uint32) (laddr, raddr...
  function parseNetstatUnixLine (line 122) | func parseNetstatUnixLine(f []string) (ConnectionStat, error) {
  function hasCorrectInetProto (line 160) | func hasCorrectInetProto(kind, proto string) bool {
  function parseNetstatA (line 186) | func parseNetstatA(output, kind string) ([]ConnectionStat, error) {
  function ConnectionsWithContext (line 238) | func ConnectionsWithContext(ctx context.Context, kind string) ([]Connect...
  function ConnectionsMaxWithContext (line 270) | func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn...
  function ConnectionsWithoutUidsWithContext (line 274) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 278) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithContext (line 282) | func ConnectionsPidWithContext(ctx context.Context, kind string, pid int...
  function ConnectionsPidWithoutUidsWithContext (line 286) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidMaxWithContext (line 290) | func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid ...
  function ConnectionsPidMaxWithoutUidsWithContext (line 294) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 298) | func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string...

FILE: net/net_aix_cgo.go
  function IOCountersWithContext (line 12) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...

FILE: net/net_aix_nocgo.go
  function parseNetstatI (line 15) | func parseNetstatI(output string) ([]IOCountersStat, error) {
  function IOCountersWithContext (line 81) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...

FILE: net/net_darwin.go
  constant endOfLine (line 23) | endOfLine = "\n"
  function parseNetstatLine (line 25) | func parseNetstatLine(line string) (stat *IOCountersStat, linkID *uint, ...
  type netstatInterface (line 91) | type netstatInterface struct
  function parseNetstatOutput (line 96) | func parseNetstatOutput(output string) ([]netstatInterface, error) {
  type mapInterfaceNameUsage (line 122) | type mapInterfaceNameUsage
    method isTruncated (line 140) | func (mapi mapInterfaceNameUsage) isTruncated() bool {
    method notTruncated (line 149) | func (mapi mapInterfaceNameUsage) notTruncated() []string {
  function newMapInterfaceNameUsage (line 124) | func newMapInterfaceNameUsage(ifaces []netstatInterface) mapInterfaceNam...
  function PidsWithContext (line 160) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function IOCountersWithContext (line 169) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...
  function IOCountersByFileWithContext (line 251) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function FilterCountersWithContext (line 255) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 259) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 263) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...

FILE: net/net_darwin_test.go
  constant netstatTruncated (line 11) | netstatTruncated = `Name  Mtu   Network       Address            Ipkts I...
  constant netstatNotTruncated (line 23) | netstatNotTruncated = `Name  Mtu   Network       Address            Ipkt...
  function TestParseNetstatLineHeader (line 34) | func TestParseNetstatLineHeader(t *testing.T) {
  function assertLoopbackStat (line 42) | func assertLoopbackStat(t *testing.T, err error, stat *IOCountersStat) {
  function TestParseNetstatLineNoAddressWithDrop (line 53) | func TestParseNetstatLineNoAddressWithDrop(t *testing.T) {
  function TestParseNetstatLineLink (line 62) | func TestParseNetstatLineLink(t *testing.T) {
  function TestParseNetstatLineIPv6 (line 71) | func TestParseNetstatLineIPv6(t *testing.T) {
  function TestParseNetstatLineIPv4 (line 79) | func TestParseNetstatLineIPv4(t *testing.T) {
  function TestParseNetstatOutput (line 87) | func TestParseNetstatOutput(t *testing.T) {
  function TestParseNetstatTruncated (line 118) | func TestParseNetstatTruncated(t *testing.T) {

FILE: net/net_fallback.go
  function IOCountersWithContext (line 12) | func IOCountersWithContext(_ context.Context, _ bool) ([]IOCountersStat,...
  function IOCountersByFileWithContext (line 16) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function FilterCountersWithContext (line 20) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 24) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 28) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...
  function PidsWithContext (line 33) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function ConnectionsWithContext (line 37) | func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionSt...
  function ConnectionsMaxWithContext (line 41) | func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn...
  function ConnectionsWithoutUidsWithContext (line 45) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 49) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithoutUidsWithContext (line 53) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithContext (line 57) | func ConnectionsPidWithContext(ctx context.Context, kind string, pid int...
  function ConnectionsPidMaxWithContext (line 61) | func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid ...
  function ConnectionsPidMaxWithoutUidsWithContext (line 65) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 69) | func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string...

FILE: net/net_freebsd.go
  function PidsWithContext (line 15) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function IOCountersWithContext (line 19) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...
  function IOCountersByFileWithContext (line 94) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function FilterCountersWithContext (line 98) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 102) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 106) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...

FILE: net/net_linux.go
  constant ctENTRIES (line 23) | ctENTRIES = iota
  constant ctSEARCHED (line 24) | ctSEARCHED
  constant ctFOUND (line 25) | ctFOUND
  constant ctNEW (line 26) | ctNEW
  constant ctINVALID (line 27) | ctINVALID
  constant ctIGNORE (line 28) | ctIGNORE
  constant ctDELETE (line 29) | ctDELETE
  constant ctDELETE_LIST (line 30) | ctDELETE_LIST
  constant ctINSERT (line 31) | ctINSERT
  constant ctINSERT_FAILED (line 32) | ctINSERT_FAILED
  constant ctDROP (line 33) | ctDROP
  constant ctEARLY_DROP (line 34) | ctEARLY_DROP
  constant ctICMP_ERROR (line 35) | ctICMP_ERROR
  constant CT_EXPEctNEW (line 36) | CT_EXPEctNEW
  constant ctEXPECT_CREATE (line 37) | ctEXPECT_CREATE
  constant CT_EXPEctDELETE (line 38) | CT_EXPEctDELETE
  constant ctSEARCH_RESTART (line 39) | ctSEARCH_RESTART
  function IOCountersWithContext (line 42) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...
  function IOCountersByFileWithContext (line 47) | func IOCountersByFileWithContext(_ context.Context, pernic bool, filenam...
  function ProtoCountersWithContext (line 145) | func ProtoCountersWithContext(ctx context.Context, protocols []string) (...
  function FilterCountersWithContext (line 201) | func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 226) | func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]Conn...
  function conntrackStatsFromFile (line 233) | func conntrackStatsFromFile(filename string, percpu bool) ([]ConntrackSt...
  type netConnectionKindType (line 287) | type netConnectionKindType struct
  type inodeMap (line 336) | type inodeMap struct
  type connTmp (line 341) | type connTmp struct
  function ConnectionsWithContext (line 353) | func ConnectionsWithContext(ctx context.Context, kind string) ([]Connect...
  function ConnectionsMaxWithContext (line 357) | func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn...
  function ConnectionsWithoutUidsWithContext (line 361) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 365) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithContext (line 369) | func ConnectionsPidWithContext(ctx context.Context, kind string, pid int...
  function ConnectionsPidWithoutUidsWithContext (line 373) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidMaxWithContext (line 377) | func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid ...
  function ConnectionsPidMaxWithoutUidsWithContext (line 381) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 385) | func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function statsFromInodesWithContext (line 408) | func statsFromInodesWithContext(ctx context.Context, root string, pid in...
  function getProcInodes (line 471) | func getProcInodes(root string, pid int32, maxConn int) (map[string][]in...
  function PidsWithContext (line 515) | func PidsWithContext(ctx context.Context) ([]int32, error) {
  type process (line 544) | type process struct
    method getUids (line 550) | func (p *process) getUids(ctx context.Context) ([]int32, error) {
    method fillFromStatus (line 559) | func (p *process) fillFromStatus(ctx context.Context) error {
  function getProcInodesAllWithContext (line 587) | func getProcInodesAllWithContext(ctx context.Context, root string, maxCo...
  function decodeAddress (line 616) | func decodeAddress(family uint32, src string) (Addr, error) {
  function Reverse (line 650) | func Reverse(s []byte) []byte {
  function parseIPv6HexString (line 658) | func parseIPv6HexString(src []byte) (net.IP, error) {
  function processInet (line 671) | func processInet(file string, kind netConnectionKindType, inodes map[str...
  function processUnix (line 737) | func processUnix(file string, kind netConnectionKindType, inodes map[str...
  function updateMap (line 795) | func updateMap(src, add map[string][]inodeMap) map[string][]inodeMap {

FILE: net/net_linux_test.go
  function TestIOCountersByFileParsing (line 19) | func TestIOCountersByFileParsing(t *testing.T) {
  function TestGetProcInodesAll (line 82) | func TestGetProcInodesAll(t *testing.T) {
  function TestConnectionsMax (line 113) | func TestConnectionsMax(t *testing.T) {
  type AddrTest (line 134) | type AddrTest struct
  function TestDecodeAddress (line 140) | func TestDecodeAddress(t *testing.T) {
  function TestReverse (line 192) | func TestReverse(t *testing.T) {
  function TestConntrackStatFileParsing (line 197) | func TestConntrackStatFileParsing(t *testing.T) {

FILE: net/net_openbsd.go
  function ParseNetstat (line 20) | func ParseNetstat(output string, mode string,
  function PidsWithContext (line 110) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function IOCountersWithContext (line 114) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...
  function IOCountersByFileWithContext (line 160) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function FilterCountersWithContext (line 164) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 168) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 172) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...
  function parseNetstatLine (line 176) | func parseNetstatLine(line string) (ConnectionStat, error) {
  function parseAddr (line 220) | func parseAddr(l string, family uint32) (Addr, error) {
  function parseNetstatAddr (line 244) | func parseNetstatAddr(local, remote string, family uint32) (laddr, raddr...
  function ConnectionsWithContext (line 256) | func ConnectionsWithContext(ctx context.Context, kind string) ([]Connect...
  function ConnectionsPidWithContext (line 309) | func ConnectionsPidWithContext(_ context.Context, _ string, _ int32) ([]...
  function ConnectionsMaxWithContext (line 313) | func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]Co...
  function ConnectionsPidMaxWithContext (line 317) | func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, ...
  function ConnectionsWithoutUidsWithContext (line 321) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 325) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithoutUidsWithContext (line 329) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidMaxWithoutUidsWithContext (line 333) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 337) | func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string...

FILE: net/net_solaris.go
  function IOCountersWithContext (line 20) | func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCounte...
  function IOCountersByFileWithContext (line 114) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function FilterCountersWithContext (line 118) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 122) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 126) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...
  function PidsWithContext (line 131) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function ConnectionsWithContext (line 135) | func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionSt...
  function ConnectionsMaxWithContext (line 139) | func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn...
  function ConnectionsWithoutUidsWithContext (line 143) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 147) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithoutUidsWithContext (line 151) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithContext (line 155) | func ConnectionsPidWithContext(ctx context.Context, kind string, pid int...
  function ConnectionsPidMaxWithContext (line 159) | func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid ...
  function ConnectionsPidMaxWithoutUidsWithContext (line 163) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 167) | func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string...

FILE: net/net_test.go
  function TestAddrString (line 17) | func TestAddrString(t *testing.T) {
  function TestIOCountersStatString (line 24) | func TestIOCountersStatString(t *testing.T) {
  function TestProtoCountersStatString (line 33) | func TestProtoCountersStatString(t *testing.T) {
  function TestConnectionStatString (line 46) | func TestConnectionStatString(t *testing.T) {
  function TestIOCountersAll (line 57) | func TestIOCountersAll(t *testing.T) {
  function TestIOCountersPerNic (line 91) | func TestIOCountersPerNic(t *testing.T) {
  function TestGetNetIOCountersAll (line 103) | func TestGetNetIOCountersAll(t *testing.T) {
  function TestInterfaces (line 124) | func TestInterfaces(t *testing.T) {
  function TestProtoCountersStatsAll (line 136) | func TestProtoCountersStatsAll(t *testing.T) {
  function TestProtoCountersStats (line 149) | func TestProtoCountersStats(t *testing.T) {
  function TestConnections (line 165) | func TestConnections(t *testing.T) {
  function TestFilterCounters (line 181) | func TestFilterCounters(t *testing.T) {
  function TestInterfaceStatString (line 204) | func TestInterfaceStatString(t *testing.T) {

FILE: net/net_unix.go
  function ConnectionsWithContext (line 17) | func ConnectionsWithContext(ctx context.Context, kind string) ([]Connect...
  function ConnectionsMaxWithContext (line 21) | func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]Co...
  function ConnectionsPidWithContext (line 25) | func ConnectionsPidWithContext(ctx context.Context, kind string, pid int...
  function parseNetLine (line 81) | func parseNetLine(line string) (ConnectionStat, error) {
  function parseAddr (line 134) | func parseAddr(l string) (Addr, error) {
  function parseNetAddr (line 146) | func parseNetAddr(line string) (laddr, raddr Addr, err error) {
  function ConnectionsPidMaxWithContext (line 162) | func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, ...
  function ConnectionsWithoutUidsWithContext (line 166) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 170) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithoutUidsWithContext (line 174) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidMaxWithoutUidsWithContext (line 178) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 182) | func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string...

FILE: net/net_windows.go
  constant TCPTableBasicListener (line 28) | TCPTableBasicListener = iota
  constant TCPTableBasicConnections (line 29) | TCPTableBasicConnections
  constant TCPTableBasicAll (line 30) | TCPTableBasicAll
  constant TCPTableOwnerPIDListener (line 31) | TCPTableOwnerPIDListener
  constant TCPTableOwnerPIDConnections (line 32) | TCPTableOwnerPIDConnections
  constant TCPTableOwnerPIDAll (line 33) | TCPTableOwnerPIDAll
  constant TCPTableOwnerModuleListener (line 34) | TCPTableOwnerModuleListener
  constant TCPTableOwnerModuleConnections (line 35) | TCPTableOwnerModuleConnections
  constant TCPTableOwnerModuleAll (line 36) | TCPTableOwnerModuleAll
  type netConnectionKindType (line 39) | type netConnectionKindType struct
  type guid (line 83) | type guid struct
  constant maxStringSize (line 91) | maxStringSize        = 256
  constant maxPhysAddressLength (line 92) | maxPhysAddressLength = 32
  constant pad0for64_4for32 (line 93) | pad0for64_4for32     = 0
  type mibIfRow2 (line 96) | type mibIfRow2 struct
  function IOCountersWithContext (line 141) | func IOCountersWithContext(_ context.Context, pernic bool) ([]IOCounters...
  function IOCountersByFileWithContext (line 201) | func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ str...
  function ConnectionsWithContext (line 205) | func ConnectionsWithContext(ctx context.Context, kind string) ([]Connect...
  function ConnectionsPidWithContext (line 209) | func ConnectionsPidWithContext(_ context.Context, kind string, pid int32...
  function getProcInet (line 217) | func getProcInet(kinds []netConnectionKindType, pid int32) ([]Connection...
  function getNetStatWithKind (line 241) | func getNetStatWithKind(kindType netConnectionKindType) ([]ConnectionSta...
  function PidsWithContext (line 261) | func PidsWithContext(_ context.Context) ([]int32, error) {
  function ConnectionsMaxWithContext (line 265) | func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn...
  function ConnectionsWithoutUidsWithContext (line 269) | func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string)...
  function ConnectionsMaxWithoutUidsWithContext (line 273) | func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidWithoutUidsWithContext (line 277) | func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind stri...
  function ConnectionsPidMaxWithContext (line 281) | func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid ...
  function ConnectionsPidMaxWithoutUidsWithContext (line 285) | func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind s...
  function connectionsPidMaxWithoutUidsWithContext (line 289) | func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string...
  function FilterCountersWithContext (line 293) | func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
  function ConntrackStatsWithContext (line 297) | func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackSt...
  function ProtoCountersWithContext (line 301) | func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCou...
  function getTableUintptr (line 305) | func getTableUintptr(family uint32, buf []byte) uintptr {
  function getTableInfo (line 331) | func getTableInfo(filename string, table any) (index, step, length int) {
  function getTCPConnections (line 354) | func getTCPConnections(family uint32) ([]ConnectionStat, error) {
  function getUDPConnections (line 435) | func getUDPConnections(family uint32) ([]ConnectionStat, error) {
  function getExtendedTCPTable (line 531) | func getExtendedTCPTable(pTCPTable uintptr, pdwSize *uint32, bOrder bool...
  function getExtendedUDPTable (line 539) | func getExtendedUDPTable(pUDPTable uintptr, pdwSize *uint32, bOrder bool...
  function getUintptrFromBool (line 547) | func getUintptrFromBool(b bool) uintptr {
  constant anySize (line 554) | anySize = 1
  type mibTCPState (line 557) | type mibTCPState
  type tcpTableClass (line 559) | type tcpTableClass
  constant tcpTableBasicListener (line 562) | tcpTableBasicListener tcpTableClass = iota
  constant tcpTableBasicConnections (line 563) | tcpTableBasicConnections
  constant tcpTableBasicAll (line 564) | tcpTableBasicAll
  constant tcpTableOwnerPidListener (line 565) | tcpTableOwnerPidListener
  constant tcpTableOwnerPidConnections (line 566) | tcpTableOwnerPidConnections
  constant tcpTableOwnerPidAll (line 567) | tcpTableOwnerPidAll
  constant tcpTableOwnerModuleListener (line 568) | tcpTableOwnerModuleListener
  constant tcpTableOwnerModuleConnections (line 569) | tcpTableOwnerModuleConnections
  constant tcpTableOwnerModuleAll (line 570) | tcpTableOwnerModuleAll
  type udpTableClass (line 573) | type udpTableClass
  constant udpTableBasic (line 576) | udpTableBasic udpTableClass = iota
  constant udpTableOwnerPid (line 577) | udpTableOwnerPid
  constant udpTableOwnerModule (line 578) | udpTableOwnerModule
  type mibTCPRowOwnerPid (line 583) | type mibTCPRowOwnerPid struct
    method convertToConnectionStat (line 592) | func (m *mibTCPRowOwnerPid) convertToConnectionStat() ConnectionStat {
  type mibTCPTableOwnerPid (line 611) | type mibTCPTableOwnerPid struct
  type mibTCP6RowOwnerPid (line 616) | type mibTCP6RowOwnerPid struct
    method convertToConnectionStat (line 627) | func (m *mibTCP6RowOwnerPid) convertToConnectionStat() ConnectionStat {
  type mibTCP6TableOwnerPid (line 646) | type mibTCP6TableOwnerPid struct
  type pmibTCPTableOwnerPidAll (line 652) | type pmibTCPTableOwnerPidAll
  type pmibTCP6TableOwnerPidAll (line 653) | type pmibTCP6TableOwnerPidAll
  type mibUDPRowOwnerPid (line 658) | type mibUDPRowOwnerPid struct
    method convertToConnectionStat (line 664) | func (m *mibUDPRowOwnerPid) convertToConnectionStat() ConnectionStat {
  type mibUDPTableOwnerPid (line 678) | type mibUDPTableOwnerPid struct
  type mibUDP6RowOwnerPid (line 683) | type mibUDP6RowOwnerPid struct
    method convertToConnectionStat (line 690) | func (m *mibUDP6RowOwnerPid) convertToConnectionStat() ConnectionStat {
  type mibUDP6TableOwnerPid (line 704) | type mibUDP6TableOwnerPid struct
  type pmibUDPTableOwnerPid (line 710) | type pmibUDPTableOwnerPid
  type pmibUDP6TableOwnerPid (line 711) | type pmibUDP6TableOwnerPid
  function decodePort (line 714) | func decodePort(port uint32) uint16 {
  function parseIPv4HexString (line 718) | func parseIPv4HexString(addr uint32) string {
  function parseIPv6HexString (line 722) | func parseIPv6HexString(addr [16]byte) string {

FILE: net/types_darwin.go
  constant sizeofPtr (line 29) | sizeofPtr        = C.sizeofPtr
  constant sizeofShort (line 30) | sizeofShort      = C.sizeof_short
  constant sizeofInt (line 31) | sizeofInt        = C.sizeof_int
  constant sizeofLong (line 32) | sizeofLong       = C.sizeof_long
  constant sizeofLongLong (line 33) | sizeofLongLong   = C.sizeof_longlong
  constant sizeofLongDouble (line 34) | sizeofLongDouble = C.sizeof_longlong
  type _C_short (line 40) | type _C_short
  type _C_int (line 41) | type _C_int
  type _C_long (line 42) | type _C_long
  type _C_long_long (line 43) | type _C_long_long
  type _C_long_double (line 44) | type _C_long_double
  type Xinpgen (line 48) | type Xinpgen
  type Inpcb (line 49) | type Inpcb
  type in_addr (line 50) | type in_addr
  type Inpcb_list_entry (line 51) | type Inpcb_list_entry
  type Xsocket (line 52) | type Xsocket
  type Xsockbuf (line 53) | type Xsockbuf
  type Xinpcb (line 54) | type Xinpcb

FILE: process/process.go
  type Process (line 28) | type Process struct
    method String (line 155) | func (p Process) String() string {
    method Background (line 238) | func (p *Process) Background() (bool, error) {
    method BackgroundWithContext (line 242) | func (p *Process) BackgroundWithContext(ctx context.Context) (bool, er...
    method Percent (line 252) | func (p *Process) Percent(interval time.Duration) (float64, error) {
    method PercentWithContext (line 256) | func (p *Process) PercentWithContext(ctx context.Context, interval tim...
    method IsRunning (line 290) | func (p *Process) IsRunning() (bool, error) {
    method IsRunningWithContext (line 294) | func (p *Process) IsRunningWithContext(ctx context.Context) (bool, err...
    method CreateTime (line 311) | func (p *Process) CreateTime() (int64, error) {
    method CreateTimeWithContext (line 315) | func (p *Process) CreateTimeWithContext(ctx context.Context) (int64, e...
    method MemoryPercent (line 338) | func (p *Process) MemoryPercent() (float32, error) {
    method MemoryPercentWithContext (line 342) | func (p *Process) MemoryPercentWithContext(ctx context.Context) (float...
    method CPUPercent (line 359) | func (p *Process) CPUPercent() (float64, error) {
    method CPUPercentWithContext (line 363) | func (p *Process) CPUPercentWithContext(ctx context.Context) (float64,...
    method Groups (line 384) | func (p *Process) Groups() ([]uint32, error) {
    method Ppid (line 389) | func (p *Process) Ppid() (int32, error) {
    method Name (line 394) | func (p *Process) Name() (string, error) {
    method Exe (line 399) | func (p *Process) Exe() (string, error) {
    method Cmdline (line 405) | func (p *Process) Cmdline() (string, error) {
    method CmdlineSlice (line 416) | func (p *Process) CmdlineSlice() ([]string, error) {
    method Cwd (line 421) | func (p *Process) Cwd() (string, error) {
    method Parent (line 426) | func (p *Process) Parent() (*Process, error) {
    method ParentWithContext (line 431) | func (p *Process) ParentWithContext(ctx context.Context) (*Process, er...
    method Status (line 444) | func (p *Process) Status() ([]string, error) {
    method Foreground (line 449) | func (p *Process) Foreground() (bool, error) {
    method Uids (line 454) | func (p *Process) Uids() ([]uint32, error) {
    method Gids (line 459) | func (p *Process) Gids() ([]uint32, error) {
    method Terminal (line 464) | func (p *Process) Terminal() (string, error) {
    method Nice (line 469) | func (p *Process) Nice() (int32, error) {
    method IOnice (line 474) | func (p *Process) IOnice() (int32, error) {
    method Rlimit (line 479) | func (p *Process) Rlimit() ([]RlimitStat, error) {
    method RlimitUsage (line 486) | func (p *Process) RlimitUsage(gatherUsed bool) ([]RlimitStat, error) {
    method IOCounters (line 491) | func (p *Process) IOCounters() (*IOCountersStat, error) {
    method NumCtxSwitches (line 496) | func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) {
    method NumFDs (line 501) | func (p *Process) NumFDs() (int32, error) {
    method NumThreads (line 506) | func (p *Process) NumThreads() (int32, error) {
    method Threads (line 510) | func (p *Process) Threads() (map[int32]*cpu.TimesStat, error) {
    method Times (line 515) | func (p *Process) Times() (*cpu.TimesStat, error) {
    method CPUAffinity (line 520) | func (p *Process) CPUAffinity() ([]int32, error) {
    method MemoryInfo (line 526) | func (p *Process) MemoryInfo() (*MemoryInfoStat, error) {
    method MemoryInfoEx (line 531) | func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) {
    method PageFaults (line 536) | func (p *Process) PageFaults() (*PageFaultsStat, error) {
    method Children (line 542) | func (p *Process) Children() ([]*Process, error) {
    method OpenFiles (line 548) | func (p *Process) OpenFiles() ([]OpenFilesStat, error) {
    method Connections (line 554) | func (p *Process) Connections() ([]net.ConnectionStat, error) {
    method ConnectionsMax (line 559) | func (p *Process) ConnectionsMax(maxConn int) ([]net.ConnectionStat, e...
    method MemoryMaps (line 564) | func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) {
    method Tgid (line 569) | func (p *Process) Tgid() (int32, error) {
    method SendSignal (line 574) | func (p *Process) SendSignal(sig Signal) error {
    method Suspend (line 579) | func (p *Process) Suspend() error {
    method Resume (line 584) | func (p *Process) Resume() error {
    method Terminate (line 589) | func (p *Process) Terminate() error {
    method Kill (line 594) | func (p *Process) Kill() error {
    method Username (line 599) | func (p *Process) Username() (string, error) {
    method Environ (line 604) | func (p *Process) Environ() ([]string, error) {
  constant Running (line 52) | Running = "running"
  constant Blocked (line 54) | Blocked = "blocked"
  constant Idle (line 56) | Idle = "idle"
  constant Lock (line 58) | Lock = "lock"
  constant Sleep (line 60) | Sleep = "sleep"
  constant Stop (line 62) | Stop = "stop"
  constant Wait (line 64) | Wait = "wait"
  constant Zombie (line 66) | Zombie = "zombie"
  constant Daemon (line 69) | Daemon   = "daemon"
  constant Detached (line 70) | Detached = "detached"
  constant System (line 71) | System   = "system"
  constant Orphan (line 72) | Orphan   = "orphan"
  constant UnknownState (line 74) | UnknownState = ""
  type OpenFilesStat (line 77) | type OpenFilesStat struct
    method String (line 160) | func (o OpenFilesStat) String() string {
  type MemoryInfoStat (line 82) | type MemoryInfoStat struct
    method String (line 165) | func (m MemoryInfoStat) String() string {
  type SignalInfoStat (line 92) | type SignalInfoStat struct
  type RlimitStat (line 100) | type RlimitStat struct
    method String (line 170) | func (r RlimitStat) String() string {
  type IOCountersStat (line 107) | type IOCountersStat struct
    method String (line 175) | func (i IOCountersStat) String() string {
  type NumCtxSwitchesStat (line 122) | type NumCtxSwitchesStat struct
    method String (line 180) | func (p NumCtxSwitchesStat) String() string {
  type PageFaultsStat (line 127) | type PageFaultsStat struct
  constant RLIMIT_CPU (line 137) | RLIMIT_CPU        int32 = 0
  constant RLIMIT_FSIZE (line 138) | RLIMIT_FSIZE      int32 = 1
  constant RLIMIT_DATA (line 139) | RLIMIT_DATA       int32 = 2
  constant RLIMIT_STACK (line 140) | RLIMIT_STACK      int32 = 3
  constant RLIMIT_CORE (line 141) | RLIMIT_CORE       int32 = 4
  constant RLIMIT_RSS (line 142) | RLIMIT_RSS        int32 = 5
  constant RLIMIT_NPROC (line 143) | RLIMIT_NPROC      int32 = 6
  constant RLIMIT_NOFILE (line 144) | RLIMIT_NOFILE     int32 = 7
  constant RLIMIT_MEMLOCK (line 145) | RLIMIT_MEMLOCK    int32 = 8
  constant RLIMIT_AS (line 146) | RLIMIT_AS         int32 = 9
  constant RLIMIT_LOCKS (line 147) | RLIMIT_LOCKS      int32 = 10
  constant RLIMIT_SIGPENDING (line 148) | RLIMIT_SIGPENDING int32 = 11
  constant RLIMIT_MSGQUEUE (line 149) | RLIMIT_MSGQUEUE   int32 = 12
  constant RLIMIT_NICE (line 150) | RLIMIT_NICE       int32 = 13
  constant RLIMIT_RTPRIO (line 151) | RLIMIT_RTPRIO     int32 = 14
  constant RLIMIT_RTTIME (line 152) | RLIMIT_RTTIME     int32 = 15
  function EnableBootTimeCache (line 188) | func EnableBootTimeCache(enable bool) {
  function Pids (line 193) | func Pids() ([]int32, error) {
  function PidsWithContext (line 197) | func PidsWithContext(ctx context.Context) ([]int32, error) {
  function Processes (line 205) | func Processes() ([]*Process, error) {
  function NewProcess (line 213) | func NewProcess(pid int32) (*Process, error) {
  function NewProcessWithContext (line 217) | func NewProcessWithContext(ctx context.Context, pid int32) (*Process, er...
  function PidExists (line 233) | func PidExists(pid int32) (bool, error) {
  function calculatePercent (line 324) | func calculatePercent(t1, t2 *cpu.TimesStat, delta float64, numcpu int) ...
  function convertStatusChar (line 609) | func convertStatusChar(letter string) string {

FILE: process/process_bsd.go
  type MemoryInfoExStat (line 15) | type MemoryInfoExStat struct
  type MemoryMapsStat (line 17) | type MemoryMapsStat struct
  method TgidWithContext (line 19) | func (*Process) TgidWithContext(_ context.Context) (int32, error) {
  method IOniceWithContext (line 23) | func (*Process) IOniceWithContext(_ context.Context) (int32, error) {
  method RlimitWithContext (line 27) | func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, erro...
  method RlimitUsageWithContext (line 31) | func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]Rli...
  method NumCtxSwitchesWithContext (line 35) | func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwi...
  method CPUAffinityWithContext (line 39) | func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, erro...
  method MemoryInfoExWithContext (line 43) | func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoE...
  method PageFaultsWithContext (line 47) | func (*Process) PageFaultsWithContext(_ context.Context) (*PageFaultsSta...
  method OpenFilesWithContext (line 51) | func (*Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat...
  method MemoryMapsWithContext (line 55) | func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]Mem...
  method ThreadsWithContext (line 59) | func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.Ti...
  method EnvironWithContext (line 63) | func (*Process) EnvironWithContext(_ context.Context) ([]string, error) {
  function parseKinfoProc (line 67) | func parseKinfoProc(buf []byte) (KinfoProc, error) {

FILE: process/process_darwin.go
  constant CTLKern (line 28) | CTLKern          = 1
  constant KernProc (line 29) | KernProc         = 14
  constant KernProcPID (line 30) | KernProcPID      = 1
  constant KernProcProc (line 31) | KernProcProc     = 8
  constant KernProcAll (line 32) | KernProcAll      = 0
  constant KernProcPathname (line 33) | KernProcPathname = 12
  type _Ctype_struct___0 (line 36) | type _Ctype_struct___0 struct
  function pidsWithContext (line 40) | func pidsWithContext(_ context.Context) ([]int32, error) {
  method PpidWithContext (line 56) | func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
  method NameWithContext (line 65) | func (p *Process) NameWithContext(ctx context.Context) (string, error) {
  method createTimeWithContext (line 89) | func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
  method StatusWithContext (line 98) | func (p *Process) StatusWithContext(ctx context.Context) ([]string, erro...
  method ForegroundWithContext (line 107) | func (p *Process) ForegroundWithContext(ctx context.Context) (bool, erro...
  method UidsWithContext (line 117) | func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
  method GidsWithContext (line 129) | func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
  method GroupsWithContext (line 141) | func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
  method TerminalWithContext (line 156) | func (*Process) TerminalWithContext(_ context.Context) (string, error) {
  method NiceWithContext (line 174) | func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
  method IOCountersWithContext (line 182) | func (*Process) IOCountersWithContext(_ context.Context) (*IOCountersSta...
  method ChildrenWithContext (line 186) | func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, ...
  method ConnectionsWithContext (line 205) | func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.Con...
  method ConnectionsMaxWithContext (line 209) | func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn...
  function ProcessesWithContext (line 213) | func ProcessesWithContext(ctx context.Context) ([]*Process, error) {
  method getKProc (line 234) | func (p *Process) getKProc() (*unix.KinfoProc, error) {
  function callPsWithContext (line 242) | func callPsWithContext(ctx context.Context, arg string, pid int32, threa...
  type dlFuncs (line 282) | type dlFuncs struct
    method getTimeScaleToNanoSeconds (line 294) | func (f *dlFuncs) getTimeScaleToNanoSeconds() float64 {
    method Close (line 302) | func (f *dlFuncs) Close() {
  function loadProcFuncs (line 286) | func loadProcFuncs() (*dlFuncs, error) {
  method ExeWithContext (line 306) | func (p *Process) ExeWithContext(_ context.Context) (string, error) {
  method CwdWithContext (line 328) | func (p *Process) CwdWithContext(_ context.Context) (string, error) {
  function procArgs (line 358) | func procArgs(pid int32) ([]byte, int, error) {
  method CmdlineSliceWithContext (line 369) | func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, ...
  method cmdlineSlice (line 373) | func (p *Process) cmdlineSlice() ([]string, error) {
  method cmdNameWithContext (line 404) | func (p *Process) cmdNameWithContext(_ context.Context) (string, error) {
  method CmdlineWithContext (line 417) | func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
  method NumThreadsWithContext (line 425) | func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
  method TimesWithContext (line 438) | func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, e...
  method MemoryInfoWithContext (line 457) | func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoS...
  type procFDInfo (line 475) | type procFDInfo struct
  method NumFDsWithContext (line 484) | func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) {

FILE: process/process_darwin_amd64.go
  constant sizeofPtr (line 8) | sizeofPtr      = 0x8
  constant sizeofShort (line 9) | sizeofShort    = 0x2
  constant sizeofInt (line 10) | sizeofInt      = 0x4
  constant sizeofLong (line 11) | sizeofLong     = 0x8
  constant sizeofLongLong (line 12) | sizeofLongLong = 0x8
  type _C_short (line 16) | type _C_short
  type _C_int (line 17) | type _C_int
  type _C_long (line 18) | type _C_long
  type _C_long_long (line 19) | type _C_long_long
  type Timespec (line 22) | type Timespec struct
  type Timeval (line 27) | type Timeval struct
  type Rusage (line 33) | type Rusage struct
  type Rlimit (line 52) | type Rlimit struct
  type UGid_t (line 57) | type UGid_t
  type KinfoProc (line 59) | type KinfoProc struct
  type Eproc (line 64) | type Eproc struct
  type Proc (line 91) | type Proc struct
  type Session (line 93) | type Session struct
  type ucred (line 95) | type ucred struct
  type Uucred (line 103) | type Uucred struct
  type Upcred (line 111) | type Upcred struct
  type Vmspace (line 122) | type Vmspace struct
  type Sigacts (line 131) | type Sigacts struct
  type ExternProc (line 133) | type ExternProc struct
  type Itimerval (line 184) | type Itimerval struct
  type Vnode (line 189) | type Vnode struct
  type Pgrp (line 191) | type Pgrp struct
  type UserStruct (line 193) | type UserStruct struct
  type Au_session (line 195) | type Au_session struct
  type Posix_cred (line 200) | type Posix_cred struct
  type Label (line 213) | type Label struct
  type ProcTaskInfo (line 215) | type ProcTaskInfo struct
  type vinfoStat (line 236) | type vinfoStat struct
  type fsid (line 260) | type fsid struct
  type vnodeInfo (line 264) | type vnodeInfo struct
  type vnodeInfoPath (line 271) | type vnodeInfoPath struct
  type vnodePathInfo (line 276) | type vnodePathInfo struct
  type AuditinfoAddr (line 281) | type AuditinfoAddr struct
  type AuMask (line 289) | type AuMask struct
  type AuTidAddr (line 294) | type AuTidAddr struct
  type UcredQueue (line 300) | type UcredQueue struct

FILE: process/process_darwin_arm64.go
  constant sizeofPtr (line 10) | sizeofPtr      = 0x8
  constant sizeofShort (line 11) | sizeofShort    = 0x2
  constant sizeofInt (line 12) | sizeofInt      = 0x4
  constant sizeofLong (line 13) | sizeofLong     = 0x8
  constant sizeofLongLong (line 14) | sizeofLongLong = 0x8
  type _C_short (line 18) | type _C_short
  type _C_int (line 19) | type _C_int
  type _C_long (line 20) | type _C_long
  type _C_long_long (line 21) | type _C_long_long
  type Timespec (line 24) | type Timespec struct
  type Timeval (line 29) | type Timeval struct
  type Rusage (line 35) | type Rusage struct
  type Rlimit (line 54) | type Rlimit struct
  type UGid_t (line 59) | type UGid_t
  type KinfoProc (line 61) | type KinfoProc struct
  type Eproc (line 66) | type Eproc struct
  type Proc (line 89) | type Proc struct
  type Session (line 91) | type Session struct
  type ucred (line 93) | type ucred struct
  type Uucred (line 95) | type Uucred struct
  type Upcred (line 102) | type Upcred struct
  type Vmspace (line 113) | type Vmspace struct
  type Sigacts (line 120) | type Sigacts struct
  type ExternProc (line 122) | type ExternProc struct
  type Itimerval (line 173) | type Itimerval struct
  type Vnode (line 178) | type Vnode struct
  type Pgrp (line 180) | type Pgrp struct
  type UserStruct (line 182) | type UserStruct struct
  type Au_session (line 184) | type Au_session struct
  type Posix_cred (line 189) | type Posix_cred struct
  type Label (line 191) | type Label struct
  type ProcTaskInfo (line 193) | type ProcTaskInfo struct
  type vinfoStat (line 214) | type vinfoStat struct
  type fsid (line 238) | type fsid struct
  type vnodeInfo (line 242) | type vnodeInfo struct
  type vnodeInfoPath (line 249) | type vnodeInfoPath struct
  type vnodePathInfo (line 254) | type vnodePathInfo struct
  type AuditinfoAddr (line 259) | type AuditinfoAddr struct
  type AuMask (line 266) | type AuMask struct
  type AuTidAddr (line 270) | type AuTidAddr struct
  type UcredQueue (line 276) | type UcredQueue struct

FILE: process/process_darwin_test.go
  function TestNumFDs (line 15) | func TestNumFDs(t *testing.T) {
  function TestNumFDs_NonExistent (line 40) | func TestNumFDs_NonExistent(t *testing.T) {
  function BenchmarkNumFDs (line 46) | func BenchmarkNumFDs(b *testing.B) {

FILE: process/process_fallback.go
  type MemoryMapsStat (line 17) | type MemoryMapsStat struct
  type MemoryInfoExStat (line 31) | type MemoryInfoExStat struct
  function pidsWithContext (line 33) | func pidsWithContext(_ context.Context) ([]int32, error) {
  function ProcessesWithContext (line 37) | func ProcessesWithContext(_ context.Context) ([]*Process, error) {
  function PidExistsWithContext (line 41) | func PidExistsWithContext(_ context.Context, _ int32) (bool, error) {
  method PpidWithContext (line 45) | func (*Process) PpidWithContext(_ context.Context) (int32, error) {
  method NameWithContext (line 49) | func (*Process) NameWithContext(_ context.Context) (string, error) {
  method TgidWithContext (line 53) | func (*Process) TgidWithContext(_ context.Context) (int32, error) {
  method ExeWithContext (line 57) | func (*Process) ExeWithContext(_ context.Context) (string, error) {
  method CmdlineWithContext (line 61) | func (*Process) CmdlineWithContext(_ context.Context) (string, error) {
  method CmdlineSliceWithContext (line 65) | func (*Process) CmdlineSliceWithContext(_ context.Context) ([]string, er...
  method createTimeWithContext (line 69) | func (*Process) createTimeWithContext(_ context.Context) (int64, error) {
  method CwdWithContext (line 73) | func (*Process) CwdWithContext(_ context.Context) (string, error) {
  method StatusWithContext (line 77) | func (*Process) StatusWithContext(_ context.Context) ([]string, error) {
  method ForegroundWithContext (line 81) | func (*Process) ForegroundWithContext(_ context.Context) (bool, error) {
  method UidsWithContext (line 85) | func (*Process) UidsWithContext(_ context.Context) ([]uint32, error) {
  method GidsWithContext (line 89) | func (*Process) GidsWithContext(_ context.Context) ([]uint32, error) {
  method GroupsWithContext (line 93) | func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
  method TerminalWithContext (line 97) | func (*Process) TerminalWithContext(_ context.Context) (string, error) {
  method NiceWithContext (line 101) | func (*Process) NiceWithContext(_ context.Context) (int32, error) {
  method IOniceWithContext (line 105) | func (*Process) IOniceWithContext(_ context.Context) (int32, error) {
  method RlimitWithContext (line 109) | func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, erro...
  method RlimitUsageWithContext (line 113) | func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]Rli...
  method IOCountersWithContext (line 117) | func (*Process) IOCountersWithContext(_ context.Context) (*IOCountersSta...
  method NumCtxSwitchesWithContext (line 121) | func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwi...
  method NumFDsWithContext (line 125) | func (*Process) NumFDsWithContext(_ context.Context) (int32, error) {
  method NumThreadsWithContext (line 129) | func (*Process) NumThreadsWithContext(_ context.Context) (int32, error) {
  method ThreadsWithContext (line 133) | func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.Ti...
  method TimesWithContext (line 137) | func (*Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, err...
  method CPUAffinityWithContext (line 141) | func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, erro...
  method MemoryInfoWithContext (line 145) | func (*Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoSta...
  method MemoryInfoExWithContext (line 149) | func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoE...
  method PageFaultsWithContext (line 153) | func (*Process) PageFaultsWithContext(_ context.Context) (*PageFaultsSta...
  method ChildrenWithContext (line 157) | func (*Process) ChildrenWithContext(_ context.Context) ([]*Process, erro...
  method OpenFilesWithContext (line 161) | func (*Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat...
  method ConnectionsWithContext (line 165) | func (*Process) ConnectionsWithContext(_ context.Context) ([]net.Connect...
  method ConnectionsMaxWithContext (line 169) | func (*Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]n...
  method MemoryMapsWithContext (line 173) | func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]Mem...
  method SendSignalWithContext (line 177) | func (*Process) SendSignalWithContext(_ context.Context, _ Signal) error {
  method SuspendWithContext (line 181) | func (*Process) SuspendWithContext(_ context.Context) error {
  method ResumeWithContext (line 185) | func (*Process) ResumeWithContext(_ context.Context) error {
  method TerminateWithContext (line 189) | func (*Process) TerminateWithContext(_ context.Context) error {
  method KillWithContext (line 193) | func (*Process) KillWithContext(_ context.Context) error {
  method UsernameWithContext (line 197) | func (*Process) UsernameWithContext(_ context.Context) (string, error) {
  method EnvironWithContext (line 201) | func (*Process) EnvironWithContext(_ context.Context) ([]string, error) {

FILE: process/process_freebsd.go
  function pidsWithContext (line 23) | func pidsWithContext(ctx context.Context) ([]int32, error) {
  method PpidWithContext (line 37) | func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
  method NameWithContext (line 46) | func (p *Process) NameWithContext(ctx context.Context) (string, error) {
  method CwdWithContext (line 69) | func (p *Process) CwdWithContext(_ context.Context) (string, error) {
  method ExeWithContext (line 90) | func (p *Process) ExeWithContext(_ context.Context) (string, error) {
  method CmdlineWithContext (line 100) | func (p *Process) CmdlineWithContext(_ context.Context) (string, error) {
  method CmdlineSliceWithContext (line 113) | func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, ...
  method createTimeWithContext (line 134) | func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
  method StatusWithContext (line 142) | func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
  method ForegroundWithContext (line 168) | func (p *Process) ForegroundWithContext(ctx context.Context) (bool, erro...
  method UidsWithContext (line 178) | func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
  method GidsWithContext (line 191) | func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
  method GroupsWithContext (line 203) | func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
  method TerminalWithContext (line 217) | func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
  method NiceWithContext (line 233) | func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
  method IOCountersWithContext (line 241) | func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersS...
  method NumThreadsWithContext (line 252) | func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
  method TimesWithContext (line 261) | func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, e...
  method MemoryInfoWithContext (line 273) | func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoS...
  method ChildrenWithContext (line 290) | func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, ...
  method ConnectionsWithContext (line 309) | func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.Con...
  method ConnectionsMaxWithContext (line 313) | func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn...
  function ProcessesWithContext (line 317) | func ProcessesWithContext(ctx context.Context) ([]*Process, error) {
  method NumFDsWithContext (line 347) | func (*Process) NumFDsWithContext(_ context.Context) (int32, error) {
  method getKProc (line 351) | func (p *Process) getKProc() (*KinfoProc, error) {

FILE: process/process_freebsd_386.go
  constant CTLKern (line 8) | CTLKern          = 1
  constant KernProc (line 9) | KernProc         = 14
  constant KernProcPID (line 10) | KernProcPID      = 1
  constant KernProcProc (line 11) | KernProcProc     = 8
  constant KernProcPathname (line 12) | KernProcPathname = 12
  constant KernProcArgs (line 13) | KernProcArgs     = 7
  constant KernProcCwd (line 14) | KernProcCwd      = 42
  constant sizeofPtr (line 18) | sizeofPtr      = 0x4
  constant sizeofShort (line 19) | sizeofShort    = 0x2
  constant sizeofInt (line 20) | sizeofInt      = 0x4
  constant sizeofLong (line 21) | sizeofLong     = 0x4
  constant sizeofLongLong (line 22) | sizeofLongLong = 0x8
  constant sizeOfKinfoVmentry (line 26) | sizeOfKinfoVmentry = 0x488
  constant sizeOfKinfoProc (line 27) | sizeOfKinfoProc    = 0x300
  constant sizeOfKinfoFile (line 28) | sizeOfKinfoFile    = 0x570
  constant SIDL (line 32) | SIDL   = 1
  constant SRUN (line 33) | SRUN   = 2
  constant SSLEEP (line 34) | SSLEEP = 3
  constant SSTOP (line 35) | SSTOP  = 4
  constant SZOMB (line 36) | SZOMB  = 5
  constant SWAIT (line 37) | SWAIT  = 6
  constant SLOCK (line 38) | SLOCK  = 7
  type _C_short (line 42) | type _C_short
  type _C_int (line 43) | type _C_int
  type _C_long (line 44) | type _C_long
  type _C_long_long (line 45) | type _C_long_long
  type Timespec (line 48) | type Timespec struct
  type Timeval (line 53) | type Timeval struct
  type Rusage (line 58) | type Rusage struct
  type Rlimit (line 77) | type Rlimit struct
  type KinfoProc (line 82) | type KinfoProc struct
  type Priority (line 167) | type Priority struct
  type KinfoVmentry (line 174) | type KinfoVmentry struct
  type kinfoFile (line 198) | type kinfoFile struct
  type capRights (line 216) | type capRights struct

FILE: process/process_freebsd_amd64.go
  constant CTLKern (line 8) | CTLKern          = 1
  constant KernProc (line 9) | KernProc         = 14
  constant KernProcPID (line 10) | KernProcPID      = 1
  constant KernProcProc (line 11) | KernProcProc     = 8
  constant KernProcPathname (line 12) | KernProcPathname = 12
  constant KernProcArgs (line 13) | KernProcArgs     = 7
  constant KernProcCwd (line 14) | KernProcCwd      = 42
  constant sizeofPtr (line 18) | sizeofPtr      = 0x8
  constant sizeofShort (line 19) | sizeofShort    = 0x2
  constant sizeofInt (line 20) | sizeofInt      = 0x4
  constant sizeofLong (line 21) | sizeofLong     = 0x8
  constant sizeofLongLong (line 22) | sizeofLongLong = 0x8
  constant sizeOfKinfoVmentry (line 26) | sizeOfKinfoVmentry = 0x488
  constant sizeOfKinfoProc (line 27) | sizeOfKinfoProc    = 0x440
  constant sizeOfKinfoFile (line 28) | sizeOfKinfoFile    = 0x570
  constant SIDL (line 32) | SIDL   = 1
  constant SRUN (line 33) | SRUN   = 2
  constant SSLEEP (line 34) | SSLEEP = 3
  constant SSTOP (line 35) | SSTOP  = 4
  constant SZOMB (line 36) | SZOMB  = 5
  constant SWAIT (line 37) | SWAIT  = 6
  constant SLOCK (line 38) | SLOCK  = 7
  type _C_short (line 42) | type _C_short
  type _C_int (line 43) | type _C_int
  type _C_long (line 44) | type _C_long
  type _C_long_long (line 45) | type _C_long_long
  type Timespec (line 48) | type Timespec struct
  type Timeval (line 53) | type Timeval struct
  type Rusage (line 58) | type Rusage struct
  type Rlimit (line 77) | type Rlimit struct
  type KinfoProc (line 82) | type KinfoProc struct
  type Priority (line 173) | type Priority struct
  type KinfoVmentry (line 180) | type KinfoVmentry struct
  type kinfoFile (line 205) | type kinfoFile struct
  type capRights (line 222) | type capRights struct

FILE: process/process_freebsd_arm.go
  constant CTLKern (line 8) | CTLKern          = 1
  constant KernProc (line 9) | KernProc         = 14
  constant KernProcPID (line 10) | KernProcPID      = 1
  constant KernProcProc (line 11) | KernProcProc     = 8
  constant KernProcPathname (line 12) | KernProcPathname = 12
  constant KernProcArgs (line 13) | KernProcArgs     = 7
  constant KernProcCwd (line 14) | KernProcCwd      = 42
  constant sizeofPtr (line 18) | sizeofPtr      = 0x4
  constant sizeofShort (line 19) | sizeofShort    = 0x2
  constant sizeofInt (line 20) | sizeofInt      = 0x4
  constant sizeofLong (line 21) | sizeofLong     = 0x4
  constant sizeofLongLong (line 22) | sizeofLongLong = 0x8
  constant sizeOfKinfoVmentry (line 26) | sizeOfKinfoVmentry = 0x488
  constant sizeOfKinfoProc (line 27) | sizeOfKinfoProc    = 0x440
  constant sizeOfKinfoFile (line 28) | sizeOfKinfoFile    = 0x570
  constant SIDL (line 32) | SIDL   = 1
  constant SRUN (line 33) | SRUN   = 2
  constant SSLEEP (line 34) | SSLEEP = 3
  constant SSTOP (line 35) | SSTOP  = 4
  constant SZOMB (line 36) | SZOMB  = 5
  constant SWAIT (line 37) | SWAIT  = 6
  constant SLOCK (line 38) | SLOCK  = 7
  type _C_short (line 42) | type _C_short
  type _C_int (line 43) | type _C_int
  type _C_long (line 44) | type _C_long
  type _C_long_long (line 45) | type _C_long_long
  type Timespec (line 48) | type Timespec struct
  type Timeval (line 53) | type Timeval struct
  type Rusage (line 58) | type Rusage struct
  type Rlimit (line 77) | type Rlimit struct
  type KinfoProc (line 82) | type KinfoProc struct
  type Priority (line 167) | type Priority struct
  type KinfoVmentry (line 174) | type KinfoVmentry struct
  type kinfoFile (line 198) | type kinfoFile struct
  type capRights (line 216) | type capRights struct

FILE: process/process_freebsd_arm64.go
  constant CTLKern (line 10) | CTLKern          = 1
  constant KernProc (line 11) | KernProc         = 14
  constant KernProcPID (line 12) | KernProcPID      = 1
  constant KernProcProc (line 13) | KernProcProc     = 8
  constant KernProcPathname (line 14) | KernProcPathname = 12
  constant KernProcArgs (line 15) | KernProcArgs     = 7
  constant KernProcCwd (line 16) | KernProcCwd      = 42
  constant sizeofPtr (line 20) | sizeofPtr      = 0x8
  constant sizeofShort (line 21) | sizeofShort    = 0x2
  constant sizeofInt (line 22) | sizeofInt      = 0x4
  constant sizeofLong (line 23) | sizeofLong     = 0x8
  constant sizeofLongLong (line 24) | sizeofLongLong = 0x8
  constant sizeOfKinfoVmentry (line 28) | sizeOfKinfoVmentry = 0x488
  constant sizeOfKinfoProc (line 29) | sizeOfKinfoProc    = 0x440
  constant sizeOfKinfoFile (line 30) | sizeOfKinfoFile    = 0x570
  constant SIDL (line 34) | SIDL   = 1
  constant SRUN (line 35) | SRUN   = 2
  constant SSLEEP (line 36) | SSLEEP = 3
  constant SSTOP (line 37) | SSTOP  = 4
  constant SZOMB (line 38) | SZOMB  = 5
  constant SWAIT (line 39) | SWAIT  = 6
  constant SLOCK (line 40) | SLOCK  = 7
  type _C_short (line 44) | type _C_short
  type _C_int (line 45) | type _C_int
  type _C_long (line 46) | type _C_long
  type _C_long_long (line 47) | type _C_long_long
  type Timespec (line 50) | type Timespec struct
  type Timeval (line 55) | type Timeval struct
  type Rusage (line 60) | type Rusage struct
  type Rlimit (line 79) | type Rlimit struct
  type KinfoProc (line 84) | type KinfoProc struct
  type Priority (line 175) | type Priority struct
  type KinfoVmentry (line 182) | type KinfoVmentry struct
  type kinfoFile (line 207) | type kinfoFile struct
  type capRights (line 224) | type capRights struct

FILE: process/process_linux.go
  constant prioProcess (line 29) | prioProcess = 0
  function init (line 33) | func init() {
  type MemoryInfoExStat (line 42) | type MemoryInfoExStat struct
    method String (line 52) | func (m MemoryInfoExStat) String() string {
  type MemoryMapsStat (line 57) | type MemoryMapsStat struct
    method String (line 72) | func (m MemoryMapsStat) String() string {
  method PpidWithContext (line 77) | func (p *Process) PpidWithContext(ctx context.Context) (int32, error) {
  method NameWithContext (line 85) | func (p *Process) NameWithContext(ctx context.Context) (string, error) {
  method TgidWithContext (line 94) | func (p *Process) TgidWithContext(ctx context.Context) (int32, error) {
  method ExeWithContext (line 103) | func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
  method CmdlineWithContext (line 107) | func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
  method CmdlineSliceWithContext (line 111) | func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string...
  method createTimeWithContext (line 115) | func (p *Process) createTimeWithContext(ctx context.Context) (int64, err...
  method CwdWithContext (line 123) | func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
  method StatusWithContext (line 127) | func (p *Process) StatusWithContext(ctx context.Context) ([]string, erro...
  method ForegroundWithContext (line 135) | func (p *Process) ForegroundWithContext(ctx context.Context) (bool, erro...
  method UidsWithContext (line 152) | func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) {
  method GidsWithContext (line 160) | func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) {
  method GroupsWithContext (line 168) | func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, erro...
  method TerminalWithContext (line 176) | func (p *Process) TerminalWithContext(ctx context.Context) (string, erro...
  method NiceWithContext (line 189) | func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
  method IOniceWithContext (line 197) | func (*Process) IOniceWithContext(_ context.Context) (int32, error) {
  method RlimitWithContext (line 201) | func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, ...
  method RlimitUsageWithContext (line 205) | func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed...
  method IOCountersWithContext (line 260) | func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCounter...
  method NumCtxSwitchesWithContext (line 264) | func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCt...
  method NumFDsWithContext (line 272) | func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) {
  method NumThreadsWithContext (line 277) | func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, err...
  method ThreadsWithContext (line 285) | func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cp...
  method TimesWithContext (line 305) | func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat,...
  method CPUAffinityWithContext (line 313) | func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, erro...
  method MemoryInfoWithContext (line 317) | func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInf...
  method MemoryInfoExWithContext (line 325) | func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryI...
  method PageFaultsWithContext (line 333) | func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFault...
  method ChildrenWithContext (line 341) | func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, ...
  method OpenFilesWithContext (line 373) | func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFiles...
  method ConnectionsWithContext (line 378) | func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.Con...
  method ConnectionsMaxWithContext (line 382) | func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn...
  method MemoryMapsWithContext (line 386) | func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped boo...
  method EnvironWithContext (line 491) | func (p *Process) EnvironWithContext(ctx context.Context) ([]string, err...
  function limitToUint (line 506) | func limitToUint(val string) (uint64, error) {
  method fillFromLimitsWithContext (line 518) | func (p *Process) fillFromLimitsWithContext(ctx context.Context) ([]Rlim...
  method fillFromfdListWithContext (line 611) | func (p *Process) fillFromfdListWithContext(ctx context.Context) (string...
  method fillFromfdWithContext (line 624) | func (p *Process) fillFromfdWithContext(ctx context.Context) (int32, []O...
  method fillFromCwdWithContext (line 653) | func (p *Process) fillFromCwdWithContext(ctx context.Context) (string, e...
  method fillFromExeWithContext (line 664) | func (p *Process) fillFromExeWithContext(ctx context.Context) (string, e...
  method fillFromCmdlineWithContext (line 675) | func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (strin...
  method fillSliceFromCmdlineWithContext (line 689) | func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) (...
  method fillFromIOWithContext (line 712) | func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCounter...
  method fillFromStatmWithContext (line 752) | func (p *Process) fillFromStatmWithContext(ctx context.Context) (*Memory...
  method fillNameWithContext (line 804) | func (p *Process) fillNameWithContext(ctx context.Context) error {
  method fillFromCommWithContext (line 813) | func (p *Process) fillFromCommWithContext(ctx context.Context) error {
  method fillFromStatus (line 826) | func (p *Process) fillFromStatus() error {
  method fillFromStatusWithContext (line 830) | func (p *Process) fillFromStatusWithContext(ctx context.Context) error {
  method fillFromTIDStat (line 1026) | func (p *Process) fillFromTIDStat(tid int32) (uint64, int32, *cpu.TimesS...
  method fillFromTIDStatWithContext (line 1030) | func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid in...
  method fillFromStatWithContext (line 1138) | func (p *Process) fillFromStatWithContext(ctx context.Context) (uint64, ...
  function pidsWithContext (line 1142) | func pidsWithContext(ctx context.Context) ([]int32, error) {
  function ProcessesWithContext (line 1146) | func ProcessesWithContext(ctx context.Context) ([]*Process, error) {
  function readPidsFromDir (line 1165) | func readPidsFromDir(path string) ([]int32, error) {
  function splitProcStat (line 1193) | func splitProcStat(content []byte) []string {

FILE: process/process_linux_test.go
  function TestFillFromfdWithContext (line 18) | func TestFillFromfdWithContext(t *testing.T) {
  function TestSplitProcStat (line 73) | func TestSplitProcStat(t *testing.T) {
  function TestSplitProcStat_fromFile (line 115) | func TestSplitProcStat_fromFile(t *testing.T) {
  function TestFillFromCommWithContext (line 149) | func TestFillFromCommWithContext(t *testing.T) {
  function TestFillFromStatusWithContext (line 166) | func TestFillFromStatusWithContext(t *testing.T) {
  function Benchmark_fillFromCommWithContext (line 183) | func Benchmark_fillFromCommWithContext(b *testing.B) {
  function Benchmark_fillFromStatusWithContext (line 192) | func Benchmark_fillFromStatusWithContext(b *testing.B) {
  function TestFillFromTIDStatWithContext_lx_brandz (line 201) | func TestFillFromTIDStatWithContext_lx_brandz(t *testing.T) {
  function TestProcessMemoryMaps (line 220) | func TestProcessMemoryMaps(t *testing.T) {

FILE: process/process_openbsd.go
  function pidsWithContext (line 26) | func pidsWithContext(ctx context.Context) ([]int32, error) {
  method PpidWithContext (line 40) | func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
  method NameWithContext (line 49) | func (p *Process) NameWithContext(ctx context.Context) (string, error) {
  method CwdWithContext (line 72) | func (p *Process) CwdWithContext(_ context.Context) (string, error) {
  method ExeWithContext (line 81) | func (*Process) ExeWithContext(_ context.Context) (string, error) {
  method CmdlineSliceWithContext (line 85) | func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, ...
  function readPtr (line 118) | func readPtr(r io.Reader) (uintptr, error) {
  method CmdlineWithContext (line 137) | func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
  method createTimeWithContext (line 145) | func (*Process) createTimeWithContext(_ con
Condensed preview — 307 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (984K chars).
[
  {
    "path": ".gitattributes",
    "chars": 206,
    "preview": "# ensure that line endings for Windows builds are properly formatted\n# see https://github.com/golangci/golangci-lint-act"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 62,
    "preview": "# These are supported funding model platforms\n\ngithub: shirou\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 845,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve gopsutil\n\n---\n\n**Describe the bug**\n[A clear and concise "
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 564,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for gopsutil\n\n---\n\n**Is your feature request related to a problem? Plea"
  },
  {
    "path": ".github/SECURITY.md",
    "chars": 704,
    "preview": "# Security Policy\n\n## Supported Versions\n\nSecurity updates are applied only to the latest release.\n\n## Reporting a Vulne"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 177,
    "preview": "version: 2\nupdates:\n- package-ecosystem: gomod\n  directory: /\n  schedule:\n    interval: daily\n- package-ecosystem: githu"
  },
  {
    "path": ".github/labeler.yml",
    "chars": 2478,
    "preview": "'package:cpu':\n  - changed-files:\n    - any-glob-to-any-file:\n      - 'cpu/**'\n\n'package:disk':\n  - changed-files:\n    -"
  },
  {
    "path": ".github/release.yml",
    "chars": 736,
    "preview": "changelog:\n  exclude:\n    labels:\n      - ignore-for-release\n      - dependencies\n    authors:\n      - dependabot[bot]\n "
  },
  {
    "path": ".github/workflows/build_test.yml",
    "chars": 1041,
    "preview": "name: Build Test\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}"
  },
  {
    "path": ".github/workflows/labeler.yml",
    "chars": 449,
    "preview": "name: \"Pull Request Labeler\"\n\non:\n  pull_request_target:\n\npermissions:\n  contents: read\n\njobs:\n  triage:\n    permissions"
  },
  {
    "path": ".github/workflows/lint.yml",
    "chars": 3719,
    "preview": "name: Golangci-lint\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow"
  },
  {
    "path": ".github/workflows/release.yml",
    "chars": 315,
    "preview": "name: Release\n\non:\n  schedule:\n    - cron: '0 1 1 * *'  # UTC 01:00 on the first day of the Month\n\npermissions:\n  conten"
  },
  {
    "path": ".github/workflows/sbom_generator.yml",
    "chars": 598,
    "preview": "name: SBOM Generator\n\non:\n  push:\n    branches: \n      - master\n  workflow_dispatch:\n\npermissions: read-all\n\njobs:\n  bui"
  },
  {
    "path": ".github/workflows/shellcheck.yml",
    "chars": 477,
    "preview": "name: Shellcheck\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}"
  },
  {
    "path": ".github/workflows/test.yml",
    "chars": 1271,
    "preview": "name: Test\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ g"
  },
  {
    "path": ".gitignore",
    "chars": 30,
    "preview": "*~\n#*\n_obj\n*.tmp\n.idea\nvendor\n"
  },
  {
    "path": ".golangci.yml",
    "chars": 4110,
    "preview": "version: \"2\"\nformatters:\n  enable:\n    - gci\n    - gofumpt\n  settings:\n    gci:\n      sections:\n        - standard\n     "
  },
  {
    "path": "LICENSE",
    "chars": 3147,
    "preview": "gopsutil is distributed under BSD license reproduced below.\n\nCopyright (c) 2014, WAKAYAMA Shirou\nAll rights reserved.\n\nR"
  },
  {
    "path": "Makefile",
    "chars": 3493,
    "preview": ".PHONY: help check\n.DEFAULT_GOAL := help\n\nSUBPKGS=cpu disk docker host internal load mem net process\n\nhelp:  ## Show hel"
  },
  {
    "path": "README.md",
    "chars": 15458,
    "preview": "# gopsutil: psutil for Go\n\n[![Test](https://github.com/shirou/gopsutil/actions/workflows/test.yml/badge.svg)](https://gi"
  },
  {
    "path": "common/env.go",
    "chars": 823,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\ntype EnvKeyType string\n\n// EnvKey is a context key that can be "
  },
  {
    "path": "cpu/cpu.go",
    "chars": 5452,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"ru"
  },
  {
    "path": "cpu/cpu_aix.go",
    "chars": 280,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage cpu\n\nimport (\n\t\"context\"\n)\n\nfunc Times(percpu bool) ([]"
  },
  {
    "path": "cpu/cpu_aix_cgo.go",
    "chars": 1625,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && cgo\n\npackage cpu\n\nimport (\n\t\"context\"\n\n\t\"github.com/power-dev"
  },
  {
    "path": "cpu/cpu_aix_nocgo.go",
    "chars": 3622,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && !cgo\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\t\"strings\"\n"
  },
  {
    "path": "cpu/cpu_darwin.go",
    "chars": 4676,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\""
  },
  {
    "path": "cpu/cpu_darwin_arm64.go",
    "chars": 1868,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin && arm64\n\npackage cpu\n\nimport (\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"u"
  },
  {
    "path": "cpu/cpu_darwin_fallback.go",
    "chars": 386,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin && !arm64\n\npackage cpu\n\nimport \"golang.org/x/sys/unix\"\n\nfunc "
  },
  {
    "path": "cpu/cpu_darwin_test.go",
    "chars": 709,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin\n\npackage cpu\n\nimport (\n\t\"os\"\n\t\"runtime\"\n\t\"testing\"\n\n\t\"github."
  },
  {
    "path": "cpu/cpu_dragonfly.go",
    "chars": 4147,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strco"
  },
  {
    "path": "cpu/cpu_dragonfly_amd64.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tInt"
  },
  {
    "path": "cpu/cpu_fallback.go",
    "chars": 806,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !solaris && "
  },
  {
    "path": "cpu/cpu_freebsd.go",
    "chars": 4710,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strco"
  },
  {
    "path": "cpu/cpu_freebsd_386.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint32\n\tNice uint32\n\tSys  uint32\n\tInt"
  },
  {
    "path": "cpu/cpu_freebsd_amd64.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tInt"
  },
  {
    "path": "cpu/cpu_freebsd_arm.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint32\n\tNice uint32\n\tSys  uint32\n\tInt"
  },
  {
    "path": "cpu/cpu_freebsd_arm64.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tInt"
  },
  {
    "path": "cpu/cpu_freebsd_test.go",
    "chars": 969,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"path/filepath\"\n\t\"runtime\"\n\t\"testing\"\n\n\t\"github.com/stre"
  },
  {
    "path": "cpu/cpu_linux.go",
    "chars": 13265,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"path/file"
  },
  {
    "path": "cpu/cpu_linux_test.go",
    "chars": 3339,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"os/exec\"\n\t\"strconv\"\n\t\"strings\"\n\t\"t"
  },
  {
    "path": "cpu/cpu_netbsd.go",
    "chars": 2505,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build netbsd\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"runtime\"\n\t\"unsafe\""
  },
  {
    "path": "cpu/cpu_netbsd_amd64.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tInt"
  },
  {
    "path": "cpu/cpu_netbsd_arm.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint32\n\tNice uint32\n\tSys  uint32\n\tInt"
  },
  {
    "path": "cpu/cpu_netbsd_arm64.go",
    "chars": 144,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tInt"
  },
  {
    "path": "cpu/cpu_openbsd.go",
    "chars": 2904,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"runtime\"\n\t\"unsafe"
  },
  {
    "path": "cpu/cpu_openbsd_386.go",
    "chars": 157,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint32\n\tNice uint32\n\tSys  uint32\n\tSpi"
  },
  {
    "path": "cpu/cpu_openbsd_amd64.go",
    "chars": 157,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tSpi"
  },
  {
    "path": "cpu/cpu_openbsd_arm.go",
    "chars": 157,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint32\n\tNice uint32\n\tSys  uint32\n\tSpi"
  },
  {
    "path": "cpu/cpu_openbsd_arm64.go",
    "chars": 157,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tSpi"
  },
  {
    "path": "cpu/cpu_openbsd_riscv64.go",
    "chars": 157,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\ntype cpuTimes struct {\n\tUser uint64\n\tNice uint64\n\tSys  uint64\n\tSpi"
  },
  {
    "path": "cpu/cpu_plan9.go",
    "chars": 1092,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build plan9\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"runtime\"\n\n\tstats \"gi"
  },
  {
    "path": "cpu/cpu_plan9_test.go",
    "chars": 1089,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build plan9\n\npackage cpu\n\nimport (\n\t\"errors\"\n\t\"path/filepath\"\n\t\"testing\"\n\n"
  },
  {
    "path": "cpu/cpu_solaris.go",
    "chars": 7659,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"sort\"\n"
  },
  {
    "path": "cpu/cpu_solaris_test.go",
    "chars": 10757,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"sort\"\n\t\"testing\"\n\n\t\"g"
  },
  {
    "path": "cpu/cpu_test.go",
    "chars": 5747,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage cpu\n\nimport (\n\t\"errors\"\n\t\"os\"\n\t\"runtime\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.c"
  },
  {
    "path": "cpu/cpu_windows.go",
    "chars": 17382,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build windows\n\npackage cpu\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math/bi"
  },
  {
    "path": "cpu/testdata/aix/prtconf",
    "chars": 2820,
    "preview": "System Model: IBM pSeries (emulated by qemu)\nMachine Serial Number: Not Available\nProcessor Type: PowerPC_POWER8\nProcess"
  },
  {
    "path": "cpu/testdata/aix/sar-u-PALL101",
    "chars": 465,
    "preview": "\nAIX aix72-dylan 2 7 000000000000    05/15/24\n\nSystem configuration: lcpu=4 ent=4.00 mode=Capped \n\n11:19:03 cpu    %usr "
  },
  {
    "path": "cpu/testdata/aix/sar-u101",
    "chars": 213,
    "preview": "\nAIX aix72-dylan 2 7 000000000000    05/15/24\n\nSystem configuration: lcpu=4 ent=4.00 mode=Capped \n\n11:19:44    %usr    %"
  },
  {
    "path": "cpu/testdata/freebsd/1cpu_2core.txt",
    "chars": 2174,
    "preview": "Copyright (c) 1992-2016 The FreeBSD Project.\nCopyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994\n  "
  },
  {
    "path": "cpu/testdata/freebsd/1cpu_4core.txt",
    "chars": 1895,
    "preview": "Copyright (c) 1992-2016 The FreeBSD Project.\nCopyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994\n  "
  },
  {
    "path": "cpu/testdata/freebsd/2cpu_4core.txt",
    "chars": 1909,
    "preview": "Copyright (c) 1992-2011 The FreeBSD Project.\nCopyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994\n  "
  },
  {
    "path": "cpu/testdata/linux/1037/proc/cpuinfo",
    "chars": 2685,
    "preview": "processor\t: 0\nProcessor\t: ARMv7 Processor rev 4 (v7l)\nmodel name\t: ARMv7 Processor rev 4 (v7l)\nBogoMIPS\t: 42.43\nFeatures"
  },
  {
    "path": "cpu/testdata/linux/1958/proc/cpuinfo",
    "chars": 369,
    "preview": "processor\t: 0\nvendor_id\t: HygonGenuine\ncpu family\t: 24\nmodel\t\t: 6\nmodel name\t: Hygon C86-4G (OPN:5435)\nstepping\t: 1\nmicr"
  },
  {
    "path": "cpu/testdata/linux/424/proc/stat",
    "chars": 2402,
    "preview": "cpu  23644 6695 4764 134931750 22115 0 473 5892 0 0\ncpu0 6418 888 1230 33730755 5043 0 4 1046 0 0\ncpu1 6858 4870 1632 33"
  },
  {
    "path": "cpu/testdata/linux/times_empty/proc/stat",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "cpu/testdata/plan9/2cores/dev/cputype",
    "chars": 18,
    "preview": "Core i7/Xeon 2403\n"
  },
  {
    "path": "cpu/testdata/plan9/2cores/dev/sysstat",
    "chars": 242,
    "preview": "          0    59251106    37524162     1208203       65907           0           0           7         100           0 "
  },
  {
    "path": "cpu/testdata/plan9/2cores/dev/time",
    "chars": 78,
    "preview": " 1633882064   1633882064926300833      2825920097745864            1999997644 "
  },
  {
    "path": "cpu/testdata/plan9/2cores/proc/1/status",
    "chars": 176,
    "preview": "init                        bootes                      Await                10          20  1404307210         110     "
  },
  {
    "path": "cpu/testdata/plan9/2cores/proc/331/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "cpu/testdata/plan9/2cores/proc/54384/status",
    "chars": 176,
    "preview": "rc                          lufia                       Await                 0           0      589160        8770     "
  },
  {
    "path": "cpu/testdata/plan9/2cores/proc/54412/status",
    "chars": 176,
    "preview": "git-remote-https            lufia                       Semacquire          390         310      370670           0     "
  },
  {
    "path": "cpu/testdata/plan9/2cores/proc/72/status",
    "chars": 176,
    "preview": "httpd                       none                        Open               2380       29690  1404804330           0     "
  },
  {
    "path": "cpu/testdata/solaris/1cpu_1core_isainfo.txt",
    "chars": 211,
    "preview": "64-bit amd64 applications\n        rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq\n        aes movbe ss"
  },
  {
    "path": "cpu/testdata/solaris/1cpu_1core_psrinfo.txt",
    "chars": 166,
    "preview": "The physical processor has 1 virtual processor (0)\n  x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz)\n  "
  },
  {
    "path": "cpu/testdata/solaris/2cpu_12core_isainfo.txt",
    "chars": 155,
    "preview": "64-bit amd64 applications\n\tamd_svm amd_lzcnt popcnt amd_sse4a tscp ahf cx16 sse3 sse2 sse fxsr\n\tamd_3dnowx amd_3dnow amd"
  },
  {
    "path": "cpu/testdata/solaris/2cpu_12core_psrinfo.txt",
    "chars": 345,
    "preview": "The physical processor has 12 virtual processors (0-11)\n  x86 (AuthenticAMD 100F91 family 16 model 9 step 1 clock 2300 M"
  },
  {
    "path": "cpu/testdata/solaris/2cpu_1core_isainfo.txt",
    "chars": 211,
    "preview": "64-bit amd64 applications\n        rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq\n        aes movbe ss"
  },
  {
    "path": "cpu/testdata/solaris/2cpu_1core_psrinfo.txt",
    "chars": 333,
    "preview": "The physical processor has 1 virtual processor (0)\n  x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz)\n  "
  },
  {
    "path": "cpu/testdata/solaris/2cpu_8core_isainfo.txt",
    "chars": 155,
    "preview": "64-bit amd64 applications\n        vmx avx xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp cx16\n        sse3 sse2 sse"
  },
  {
    "path": "cpu/testdata/solaris/2cpu_8core_psrinfo.txt",
    "chars": 1072,
    "preview": "The physical processor has 8 cores and 16 virtual processors (0-7 16-23)\n  The core has 2 virtual processors (0 16)\n  Th"
  },
  {
    "path": "disk/disk.go",
    "chars": 3212,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage disk\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\n\t\"github.com/shirou/gopsuti"
  },
  {
    "path": "disk/disk_aix.go",
    "chars": 1306,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage disk\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"strings\"\n\n\t\"githu"
  },
  {
    "path": "disk/disk_aix_cgo.go",
    "chars": 3062,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && cgo\n\npackage disk\n\n/*\n#include <unistd.h>\n*/\nimport \"C\"\n\nimpo"
  },
  {
    "path": "disk/disk_aix_nocgo.go",
    "chars": 4683,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && !cgo\n\npackage disk\n\nimport (\n\t\"context\"\n\t\"regexp\"\n\t\"strconv\"\n"
  },
  {
    "path": "disk/disk_darwin.go",
    "chars": 10017,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin\n\npackage disk\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\""
  },
  {
    "path": "disk/disk_fallback.go",
    "chars": 861,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !windows && "
  },
  {
    "path": "disk/disk_freebsd.go",
    "chars": 4729,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd\n\npackage disk\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"encod"
  },
  {
    "path": "disk/disk_freebsd_386.go",
    "chars": 1154,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_freebsd.go\n\npackag"
  },
  {
    "path": "disk/disk_freebsd_amd64.go",
    "chars": 1224,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_freebsd.go\n\npackag"
  },
  {
    "path": "disk/disk_freebsd_arm.go",
    "chars": 1154,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_freebsd.go\n\npackag"
  },
  {
    "path": "disk/disk_freebsd_arm64.go",
    "chars": 1222,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd && arm64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT."
  },
  {
    "path": "disk/disk_linux.go",
    "chars": 24024,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage disk\n\nimport (\n\t\"bufio\"\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t"
  },
  {
    "path": "disk/disk_linux_test.go",
    "chars": 5565,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage disk\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/st"
  },
  {
    "path": "disk/disk_netbsd.go",
    "chars": 4132,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build netbsd\n\npackage disk\n\nimport (\n\t\"context\"\n\t\"unsafe\"\n\n\t\"golang.org/x/"
  },
  {
    "path": "disk/disk_netbsd_amd64.go",
    "chars": 865,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build netbsd && amd64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n"
  },
  {
    "path": "disk/disk_netbsd_arm.go",
    "chars": 871,
    "preview": "//go:build netbsd && arm\n// +build netbsd,arm\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n// cgo -godefs disk/ty"
  },
  {
    "path": "disk/disk_netbsd_arm64.go",
    "chars": 865,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build netbsd && arm64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n"
  },
  {
    "path": "disk/disk_openbsd.go",
    "chars": 3754,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd\n\npackage disk\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/binar"
  },
  {
    "path": "disk/disk_openbsd_386.go",
    "chars": 629,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && 386\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n/"
  },
  {
    "path": "disk/disk_openbsd_amd64.go",
    "chars": 617,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n// cgo -godefs types_openbsd"
  },
  {
    "path": "disk/disk_openbsd_arm.go",
    "chars": 629,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && arm\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n/"
  },
  {
    "path": "disk/disk_openbsd_arm64.go",
    "chars": 631,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && arm64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT."
  },
  {
    "path": "disk/disk_openbsd_riscv64.go",
    "chars": 648,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && riscv64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDI"
  },
  {
    "path": "disk/disk_solaris.go",
    "chars": 7125,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build solaris\n\npackage disk\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"error"
  },
  {
    "path": "disk/disk_test.go",
    "chars": 3023,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage disk\n\nimport (\n\t\"errors\"\n\t\"runtime\"\n\t\"sync\"\n\t\"testing\"\n\n\t\"github.com/st"
  },
  {
    "path": "disk/disk_unix.go",
    "chars": 1555,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd || linux || darwin\n\npackage disk\n\nimport (\n\t\"context\"\n\t\"strc"
  },
  {
    "path": "disk/disk_windows.go",
    "chars": 14661,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build windows\n\npackage disk\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"errors\"\n\t\"fmt\""
  },
  {
    "path": "disk/disk_windows_test.go",
    "chars": 2096,
    "preview": "package disk\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"os/exec\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretc"
  },
  {
    "path": "disk/types_freebsd.go",
    "chars": 1259,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n// Hand writing:\n//   - add _Ctype_struct___0 struct\n//   - "
  },
  {
    "path": "disk/types_netbsd.go",
    "chars": 417,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n// Hand writing: _Ctype_struct___0\n\n/*\nInput to cgo -godefs."
  },
  {
    "path": "disk/types_openbsd.go",
    "chars": 520,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n// Hand writing: _Ctype_struct___0\n\n/*\nInput to cgo -godefs."
  },
  {
    "path": "doc.go",
    "chars": 58,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage gopsutil\n"
  },
  {
    "path": "docker/docker.go",
    "chars": 2594,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage docker\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\n\t\"github.com/shirou/gopsut"
  },
  {
    "path": "docker/docker_linux.go",
    "chars": 8909,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage docker\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\""
  },
  {
    "path": "docker/docker_linux_test.go",
    "chars": 1680,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage docker\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/"
  },
  {
    "path": "docker/docker_notlinux.go",
    "chars": 2239,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build !linux\n\npackage docker\n\nimport (\n\t\"context\"\n\n\t\"github.com/shirou/gop"
  },
  {
    "path": "docker/main_test.go",
    "chars": 365,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage docker\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n)\n\nfunc TestSysAdvancedDockerInfo(_ "
  },
  {
    "path": "go.mod",
    "chars": 645,
    "preview": "module github.com/shirou/gopsutil/v4\n\ngo 1.24.0\n\nrequire (\n\tgithub.com/ebitengine/purego v0.10.0\n\tgithub.com/google/go-c"
  },
  {
    "path": "go.sum",
    "chars": 2956,
    "preview": "github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=\ngithub.com/davecgh/go-spew v1.1.1/go.m"
  },
  {
    "path": "host/freebsd_headers/utxdb.h",
    "chars": 2255,
    "preview": "/*-\n * SPDX-License-Identifier: BSD-2-Clause-FreeBSD\n *\n * Copyright (c) 2010 Ed Schouten <ed@FreeBSD.org>\n * All rights"
  },
  {
    "path": "host/host.go",
    "chars": 4568,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage host\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"run"
  },
  {
    "path": "host/host_aix.go",
    "chars": 3050,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage host\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/shir"
  },
  {
    "path": "host/host_aix_cgo.go",
    "chars": 297,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && cgo\n\npackage host\n\nimport (\n\t\"context\"\n\n\t\"github.com/power-de"
  },
  {
    "path": "host/host_aix_nocgo.go",
    "chars": 246,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && !cgo\n\npackage host\n\nimport (\n\t\"context\"\n\n\t\"github.com/shirou/"
  },
  {
    "path": "host/host_aix_ppc64.go",
    "chars": 886,
    "preview": "//go:build aix && ppc64 && cgo\n\n// Guessed at from the following document:\n// https://www.ibm.com/docs/sl/ibm-mq/9.2?top"
  },
  {
    "path": "host/host_aix_test.go",
    "chars": 766,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage host\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/stre"
  },
  {
    "path": "host/host_bsd.go",
    "chars": 853,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin || freebsd || openbsd || netbsd\n\npackage host\n\nimport (\n\t\"con"
  },
  {
    "path": "host/host_darwin.go",
    "chars": 2779,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin\n\npackage host\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"io\"\n\t\"os\"\n\t\"st"
  },
  {
    "path": "host/host_darwin_amd64.go",
    "chars": 320,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_darwin.go\n\npackage"
  },
  {
    "path": "host/host_darwin_arm64.go",
    "chars": 364,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin && arm64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n"
  },
  {
    "path": "host/host_fallback.go",
    "chars": 1212,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !solaris && "
  },
  {
    "path": "host/host_freebsd.go",
    "chars": 3070,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd\n\npackage host\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/binar"
  },
  {
    "path": "host/host_freebsd_386.go",
    "chars": 571,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n// cgo -godefs types_freebsd"
  },
  {
    "path": "host/host_freebsd_amd64.go",
    "chars": 571,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n// cgo -godefs types_freebsd"
  },
  {
    "path": "host/host_freebsd_arm.go",
    "chars": 571,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n// cgo -godefs types_freebsd"
  },
  {
    "path": "host/host_freebsd_arm64.go",
    "chars": 605,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd && arm64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT."
  },
  {
    "path": "host/host_linux.go",
    "chars": 11139,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage host\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/binary\""
  },
  {
    "path": "host/host_linux_386.go",
    "chars": 1013,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// ATTENTION - FILE MANUAL FIXED AFTER CGO.\n// Fixed line: Tv\t\t_Ctype_struct_ti"
  },
  {
    "path": "host/host_linux_amd64.go",
    "chars": 895,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go\n\npackage "
  },
  {
    "path": "host/host_linux_arm.go",
    "chars": 849,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go | sed \"s/"
  },
  {
    "path": "host/host_linux_arm64.go",
    "chars": 955,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n\npackage host\n\nconst (\n\tsize"
  },
  {
    "path": "host/host_linux_loong64.go",
    "chars": 885,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n// cgo -godefs host/types_li"
  },
  {
    "path": "host/host_linux_mips.go",
    "chars": 730,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go\n\npackage "
  },
  {
    "path": "host/host_linux_mips64.go",
    "chars": 730,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go\n\npackage "
  },
  {
    "path": "host/host_linux_mips64le.go",
    "chars": 730,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go\n\npackage "
  },
  {
    "path": "host/host_linux_mipsle.go",
    "chars": 730,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go\n\npackage "
  },
  {
    "path": "host/host_linux_ppc64.go",
    "chars": 853,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux && ppc64\n\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -gode"
  },
  {
    "path": "host/host_linux_ppc64le.go",
    "chars": 855,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux && ppc64le\n\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -go"
  },
  {
    "path": "host/host_linux_riscv64.go",
    "chars": 869,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_linux.go\n\npackage "
  },
  {
    "path": "host/host_linux_s390x.go",
    "chars": 853,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux && s390x\n\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -gode"
  },
  {
    "path": "host/host_linux_test.go",
    "chars": 2506,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage host\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/st"
  },
  {
    "path": "host/host_netbsd.go",
    "chars": 1149,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build netbsd\n\npackage host\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"golang.org/x"
  },
  {
    "path": "host/host_openbsd.go",
    "chars": 2097,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd\n\npackage host\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/binar"
  },
  {
    "path": "host/host_openbsd_386.go",
    "chars": 532,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && 386\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n/"
  },
  {
    "path": "host/host_openbsd_amd64.go",
    "chars": 490,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n// Created by cgo -godefs - DO NOT EDIT\n// cgo -godefs types_openbsd.go\n\npackag"
  },
  {
    "path": "host/host_openbsd_arm.go",
    "chars": 532,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && arm\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT.\n/"
  },
  {
    "path": "host/host_openbsd_arm64.go",
    "chars": 534,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && arm64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDIT."
  },
  {
    "path": "host/host_openbsd_riscv64.go",
    "chars": 545,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd && riscv64\n\n// Code generated by cmd/cgo -godefs; DO NOT EDI"
  },
  {
    "path": "host/host_posix.go",
    "chars": 344,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux || freebsd || openbsd || netbsd || darwin || solaris\n\npackage "
  },
  {
    "path": "host/host_solaris.go",
    "chars": 4010,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build solaris\n\npackage host\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"error"
  },
  {
    "path": "host/host_test.go",
    "chars": 4655,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage host\n\nimport (\n\t\"errors\"\n\t\"os\"\n\t\"sync\"\n\t\"testing\"\n\n\t\"github.com/stretch"
  },
  {
    "path": "host/host_windows.go",
    "chars": 9716,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build windows\n\npackage host\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strin"
  },
  {
    "path": "host/testdata/linux/lsbStruct/arch/lsb-release",
    "chars": 77,
    "preview": "DISTRIB_ID=\"Arch\"\nDISTRIB_RELEASE=\"rolling\"\nDISTRIB_DESCRIPTION=\"Arch Linux\"\n"
  },
  {
    "path": "host/testdata/linux/lsbStruct/ubuntu_22_04/lsb-release",
    "chars": 103,
    "preview": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=22.04\nDISTRIB_CODENAME=jammy\nDISTRIB_DESCRIPTION=\"Ubuntu 22.04.2 LTS\""
  },
  {
    "path": "host/types_darwin.go",
    "chars": 623,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n// plus hand editing about timeval\n\n/*\nInput to cgo -godefs."
  },
  {
    "path": "host/types_freebsd.go",
    "chars": 732,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n/*\nInput to cgo -godefs.\n*/\n\npackage host\n\n/*\n#define KERNEL"
  },
  {
    "path": "host/types_linux.go",
    "chars": 681,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n/*\nInput to cgo -godefs.\n*/\n\npackage host\n\n/*\n#include <sys/"
  },
  {
    "path": "host/types_openbsd.go",
    "chars": 670,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build ignore\n\n/*\nInput to cgo -godefs.\n*/\n\npackage host\n\n/*\n#define KERNEL"
  },
  {
    "path": "internal/common/common.go",
    "chars": 10976,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\n//\n// gopsutil is a port of psutil(http://pythonhosted.org/psut"
  },
  {
    "path": "internal/common/common_aix.go",
    "chars": 3097,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage common\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"strconv\"\n\t\"stri"
  },
  {
    "path": "internal/common/common_aix_test.go",
    "chars": 1502,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage common\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/test"
  },
  {
    "path": "internal/common/common_darwin.go",
    "chars": 17768,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin\n\npackage common\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"unsafe\"\n"
  },
  {
    "path": "internal/common/common_freebsd.go",
    "chars": 1228,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd || openbsd\n\npackage common\n\nimport (\n\t\"fmt\"\n\t\"unsafe\"\n\n\t\"gol"
  },
  {
    "path": "internal/common/common_linux.go",
    "chars": 7761,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage common\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"os\"\n\t\"path/fi"
  },
  {
    "path": "internal/common/common_netbsd.go",
    "chars": 845,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build netbsd\n\npackage common\n\nimport (\n\t\"unsafe\"\n\n\t\"golang.org/x/sys/unix\""
  },
  {
    "path": "internal/common/common_openbsd.go",
    "chars": 846,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd\n\npackage common\n\nimport (\n\t\"unsafe\"\n\n\t\"golang.org/x/sys/unix"
  },
  {
    "path": "internal/common/common_test.go",
    "chars": 4295,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"reflect\"\n\t\"runtime\"\n\t\"strings\"\n\t\"te"
  },
  {
    "path": "internal/common/common_unix.go",
    "chars": 935,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux || freebsd || darwin || openbsd\n\npackage common\n\nimport (\n\t\"co"
  },
  {
    "path": "internal/common/common_windows.go",
    "chars": 8356,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build windows\n\npackage common\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"path/filepath\""
  },
  {
    "path": "internal/common/endian.go",
    "chars": 342,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\nimport \"unsafe\"\n\n// IsLittleEndian checks if the current platfo"
  },
  {
    "path": "internal/common/readlink_linux.go",
    "chars": 1109,
    "preview": "package common\n\nimport (\n\t\"errors\"\n\t\"os\"\n\t\"sync\"\n\t\"syscall\"\n)\n\nvar bufferPool = sync.Pool{\n\tNew: func() any {\n\t\tb := mak"
  },
  {
    "path": "internal/common/sleep.go",
    "chars": 394,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\nimport (\n\t\"context\"\n\t\"time\"\n)\n\n// Sleep awaits for provided int"
  },
  {
    "path": "internal/common/sleep_test.go",
    "chars": 643,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common_test\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github"
  },
  {
    "path": "internal/common/warnings.go",
    "chars": 1162,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\nconst (\n\tmaxWarnings             "
  },
  {
    "path": "internal/common/warnings_test.go",
    "chars": 2015,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage common\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/stretchr/tes"
  },
  {
    "path": "load/load.go",
    "chars": 676,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage load\n\nimport (\n\t\"encoding/json\"\n\n\t\"github.com/shirou/gopsutil/v4/intern"
  },
  {
    "path": "load/load_aix.go",
    "chars": 434,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix\n\npackage load\n\nimport (\n\t\"context\"\n)\n\nfunc Avg() (*AvgStat, erro"
  },
  {
    "path": "load/load_aix_cgo.go",
    "chars": 1950,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && cgo\n\npackage load\n\n/*\n#cgo LDFLAGS: -L/usr/lib -lperfstat\n\n#i"
  },
  {
    "path": "load/load_aix_nocgo.go",
    "chars": 1342,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build aix && !cgo\n\npackage load\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"regexp\"\n\t\""
  },
  {
    "path": "load/load_bsd.go",
    "chars": 1644,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd || openbsd\n\npackage load\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"u"
  },
  {
    "path": "load/load_darwin.go",
    "chars": 1568,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build darwin\n\npackage load\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"unsafe\"\n\n\t\"go"
  },
  {
    "path": "load/load_fallback.go",
    "chars": 586,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build !darwin && !linux && !freebsd && !openbsd && !windows && !solaris &&"
  },
  {
    "path": "load/load_freebsd.go",
    "chars": 140,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build freebsd\n\npackage load\n\nfunc getForkStat() (forkstat, error) {\n\tretur"
  },
  {
    "path": "load/load_linux.go",
    "chars": 2607,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build linux\n\npackage load\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\""
  },
  {
    "path": "load/load_openbsd.go",
    "chars": 303,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build openbsd\n\npackage load\n\nimport (\n\t\"unsafe\"\n\n\t\"golang.org/x/sys/unix\"\n"
  },
  {
    "path": "load/load_solaris.go",
    "chars": 1456,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build solaris\n\npackage load\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"strco"
  },
  {
    "path": "load/load_test.go",
    "chars": 1742,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\npackage load\n\nimport (\n\t\"errors\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/asse"
  },
  {
    "path": "load/load_windows.go",
    "chars": 2343,
    "preview": "// SPDX-License-Identifier: BSD-3-Clause\n//go:build windows\n\npackage load\n\nimport (\n\t\"context\"\n\t\"math\"\n\t\"sync\"\n\t\"time\"\n\n"
  }
]

// ... and 107 more files (download for full content)

About this extraction

This page contains the full source code of the shirou/gopsutil GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 307 files (868.0 KB), approximately 277.2k tokens, and a symbol index with 3061 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!