Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
HJ-Fan committed Jan 19, 2024
1 parent 0551f9c commit 817f737
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions cmd/cxl-util/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ func main() {

}

if dev.Cdat != nil {
devPerf := dev.Cdat.Get_CDAT_DSLBIS_performance()
fmt.Print("\nCDAT DSLBIS reported performance:")
fmt.Println("\nCDAT DSLBIS reported performance:", devPerf)
}
devBW, err := dev.MeasureBandwidth()
if err == nil {
fmt.Printf("\nMeasured Bandwidth: %.2f GiB/s\n", devBW)
}
devLat, err := dev.MeasureLatency()
if err == nil {
fmt.Printf("\nMeasured Latency: %d ns\n", devLat)
}
} else {
fmt.Printf("No CXL dev on BDF %s \n", settings.PCIE)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cxl/cxl-util.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func (c *CxlDev) MeasureLatency() (uint64, error) {
lat := uint64(diff.Nanoseconds() / int64(testSize>>3))

klog.V(DBG_LVL_BASIC).Infof("cxlDev.MeasureBandwidth: totalSize %d MiB, time %d ns", testSize>>20, diff.Nanoseconds())
fmt.Printf("Average memory latency: %d ns\n", lat)
klog.V(DBG_LVL_BASIC).Infof("Average memory latency: %d ns\n", lat)

return lat, nil
}
Expand Down Expand Up @@ -645,7 +645,7 @@ func (c *CxlDev) MeasureBandwidth() (float64, error) {
bw := 1e9 * float64(totalSize>>30) / float64(diff.Nanoseconds())

klog.V(DBG_LVL_BASIC).Infof("cxlDev.MeasureBandwidth: totalSize %d GiB, time %d ns at %d threads", totalSize>>30, diff.Nanoseconds(), numCPU)
fmt.Printf("Average memory bandwidth: %.2f GiB/s\n", bw)
klog.V(DBG_LVL_BASIC).Infof("Average memory bandwidth: %.2f GiB/s\n", bw)

return bw, nil
}
Expand Down

0 comments on commit 817f737

Please sign in to comment.