Skip to content

Commit

Permalink
use pmu name to get arm cpu id since archspec does not help here
Browse files Browse the repository at this point in the history
Signed-off-by: Huamin Chen <[email protected]>
  • Loading branch information
rootfs committed May 30, 2024
1 parent f92532a commit c678217
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pkg/collector/stats/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ func getX86Architecture() (string, error) {
return uarch, err
}

// TODO: getCPUArchitecture() code logic changes, need check if anything should change here.
func getArm64Architecture() (string, error) {
output, err := exec.Command("archspec", "cpu").Output()
if err != nil {
return "", err
}
return strings.TrimSuffix(string(output), "\n"), nil
}

func getS390xArchitecture() (string, error) {
// use lscpu to get CPUArchitecture
grep := exec.Command("grep", "Machine type:")
Expand Down Expand Up @@ -315,7 +306,7 @@ func getCPUArchitecture() (string, error) {
} else if runtime.GOARCH == "s390x" {
return getS390xArchitecture()
} else {
myCPUArch, err = getArm64Architecture()
myCPUArch, err = getCPUPmuName()
}

if err == nil {
Expand Down

0 comments on commit c678217

Please sign in to comment.