Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from intel/250
Browse files Browse the repository at this point in the history
don't try to calculate L3 per Core on virtualized host (#147)
  • Loading branch information
NadyaTen authored Jun 2, 2023
2 parents caa337b + a164706 commit b017a20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/reporter/report_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ func newCPUTable(sources []*Source, cpusInfo *cpu.CPU, category TableCategory) (
if err != nil {
channels = "Unknown"
}
virtualization := source.valFromRegexSubmatch("lscpu", `^Virtualization.*:\s*(.+?)$`)
var hostValues = HostValues{
Name: source.getHostname(),
ValueNames: []string{
Expand Down Expand Up @@ -757,11 +758,11 @@ func newCPUTable(sources []*Source, cpusInfo *cpu.CPU, category TableCategory) (
source.valFromRegexSubmatch("lscpu", `^L1i cache.*:\s*(.+?)$`),
source.valFromRegexSubmatch("lscpu", `^L2 cache.*:\s*(.+?)$`),
source.getL3(microarchitecture),
source.getL3PerCore(microarchitecture, coresPerSocket, sockets),
source.getL3PerCore(microarchitecture, coresPerSocket, sockets, virtualization),
channels,
source.getPrefetchers(),
source.getTurboEnabled(family),
source.valFromRegexSubmatch("lscpu", `^Virtualization.*:\s*(.+?)$`),
virtualization,
source.getPPINs(),
},
},
Expand Down
8 changes: 6 additions & 2 deletions src/reporter/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (s *Source) getCacheWays(uArch string) (cacheWays []int64) {
wayCount = 12
} else if uArch == "SPR_MCC" || uArch == "SPR_XCC" {
wayCount = 15
} else if uArch == "EMR" {
} else if uArch == "EMR_MCC" || uArch == "EMR_XCC" {
wayCount = 20
} else {
return
Expand Down Expand Up @@ -564,7 +564,11 @@ func (s *Source) getL3(uArch string) (val string) {
return
}

func (s *Source) getL3PerCore(uArch string, coresPerSocketStr string, socketsStr string) (val string) {
func (s *Source) getL3PerCore(uArch string, coresPerSocketStr string, socketsStr string, virtualization string) (val string) {
if virtualization == "full" {
log.Printf("Can't calculate L3 per Core on virtualized host.")
return
}
l3, err := strconv.ParseFloat(strings.Split(s.getL3(uArch), " ")[0], 64)
if err != nil {
return
Expand Down

0 comments on commit b017a20

Please sign in to comment.