Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cpu_openbsd.go once and for all #1244

Merged
merged 6 commits into from Feb 25, 2022
Merged

fix cpu_openbsd.go once and for all #1244

merged 6 commits into from Feb 25, 2022

Commits on Feb 6, 2022

  1. drop compatibilty with OpenBSD < 6.4

    6.3 was EOL'd more than three years ago!
    omar-polo committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    9203029 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    73db061 View commit details
    Browse the repository at this point in the history
  3. improve sysctl parsing: use native byte order

    We can't use unix.Sysctl* for some sysctls, so we're on our own with
    converting data from C arrays.
    
    Don't assume that the byte order is little endian but do the right
    thing.  Moreover, there's a little distinction in the sizes reported
    by KERN_CPTIME (long[cpustates]) and KERN_CPTIME2
    (u_int64_t[cpustates]) so account for that too.
    omar-polo committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    16cc7d7 View commit details
    Browse the repository at this point in the history
  4. refactor TimesWithContext

    don't make assumptions on which CPUs are online and wich aren't based
    on hw.smt and hw.ncpuonline.  Rather, use KERN_CPUSTATS to get the CPU
    statistics, which includes a flag field that can tell us if that CPU
    is online or not.
    omar-polo committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    57d5711 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2022

  1. avoid copying kernCPUStats

    omar-polo committed Feb 8, 2022
    Configuration menu
    Copy the full SHA
    3c3c017 View commit details
    Browse the repository at this point in the history

Commits on Feb 24, 2022

  1. avoid cgo for cpu_openbsd

    Even thought OpenBSD often breaks the ABI compatibility and doesn't make
    *any* promise of "stability", this project aims to be "pure go" so avoid
    doing inter-op at the cost of artificially reducing the number of
    supported architectures down to amd64 and i386.
    
    To add support for another architecture (e.g. arm), add another file
    cpu_openbsd_${arch}.go like done for 386 and amd64.  The fields are
    declared as `long' in C, so pick the appropriate size when declaring the
    struct.
    omar-polo committed Feb 24, 2022
    Configuration menu
    Copy the full SHA
    73f9c8d View commit details
    Browse the repository at this point in the history