diff options
author | Russ Cox <rsc@golang.org> | 2023-08-17 15:44:20 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2024-03-28 14:40:31 +0000 |
commit | ed9aed1c9d7dd340006f22b96e1ee4476582b874 (patch) | |
tree | 29148dcab5efe70227bc02d6f35efba4c9222ddc /src/internal/sysinfo/cpuinfo_bsd.go | |
parent | 2e1003e2f7e42efc5771812b9ee6ed264803796c (diff) | |
download | go-ed9aed1c9d7dd340006f22b96e1ee4476582b874.tar.gz go-ed9aed1c9d7dd340006f22b96e1ee4476582b874.zip |
internal/sysinfo: implement CPUName on bsd systems
sysctl machdep.cpu.brand_string seems to be standard
across the BSDs. There does not seem to be a standard
way to get the CPU frequency.
Change-Id: Ic986d6c81dd54e1b84544317f2a53ce16801319b
Reviewed-on: https://go-review.googlesource.com/c/go/+/520636
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/internal/sysinfo/cpuinfo_bsd.go')
-rw-r--r-- | src/internal/sysinfo/cpuinfo_bsd.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/internal/sysinfo/cpuinfo_bsd.go b/src/internal/sysinfo/cpuinfo_bsd.go new file mode 100644 index 0000000000..2c04c8f7d6 --- /dev/null +++ b/src/internal/sysinfo/cpuinfo_bsd.go @@ -0,0 +1,14 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || freebsd || netbsd || openbsd + +package sysinfo + +import "syscall" + +func osCpuInfoName() string { + cpu, _ := syscall.Sysctl("machdep.cpu.brand_string") + return cpu +} |