diff --git a/internal/report/html.go b/internal/report/html.go index 0d5f0d12..3290b705 100644 --- a/internal/report/html.go +++ b/internal/report/html.go @@ -200,7 +200,11 @@ func createHtmlReport(allTableValues []TableValues, targetName string) (out []by sb.WriteString(fmt.Sprintf("

%[1]s

\n", html.EscapeString(tableValues.Name))) // if there's no data in the table, print a message and continue if len(tableValues.Fields) == 0 || len(tableValues.Fields[0].Values) == 0 { - sb.WriteString("

" + noDataFound + "

\n") + msg := noDataFound + if tableValues.NoDataFound != "" { + msg = tableValues.NoDataFound + } + sb.WriteString("

" + msg + "

\n") continue } // render the tables diff --git a/internal/report/html_flamegraph.go b/internal/report/html_flamegraph.go index 02fb140d..ec553a60 100644 --- a/internal/report/html_flamegraph.go +++ b/internal/report/html_flamegraph.go @@ -160,7 +160,11 @@ func renderFlameGraph(header string, tableValues TableValues, field string) (out folded := tableValues.Fields[fieldIdx].Values[0] if folded == "" { out += `

` + header + `

` - out += noDataFound + msg := noDataFound + if tableValues.NoDataFound != "" { + msg = tableValues.NoDataFound + } + out += msg return } jsonStacks, err := convertFoldedToJSON(folded) diff --git a/internal/report/report.go b/internal/report/report.go index 7ad5c56b..4d8b15d9 100644 --- a/internal/report/report.go +++ b/internal/report/report.go @@ -104,7 +104,11 @@ func createTextReport(allTableValues []TableValues) (out []byte, err error) { } sb.WriteString("\n") if len(tableValues.Fields) == 0 || len(tableValues.Fields[0].Values) == 0 { - sb.WriteString(noDataFound + "\n\n") + msg := noDataFound + if tableValues.NoDataFound != "" { + msg = tableValues.NoDataFound + } + sb.WriteString(msg + "\n\n") continue } // custom renderer defined? @@ -238,7 +242,11 @@ func renderXlsxTable(tableValues TableValues, f *excelize.File, sheetName string _ = f.SetCellStyle(sheetName, cellName(col, *row), cellName(col, *row), tableNameStyle) *row++ if len(tableValues.Fields) == 0 || len(tableValues.Fields[0].Values) == 0 { - _ = f.SetCellValue(sheetName, cellName(col, *row), noDataFound) + msg := noDataFound + if tableValues.NoDataFound != "" { + msg = tableValues.NoDataFound + } + _ = f.SetCellValue(sheetName, cellName(col, *row), msg) *row += 2 return } @@ -308,7 +316,11 @@ func renderXlsxTableMultiTarget(tableIdx int, allTargetsTableValues [][]TableVal // if no data found, print a message and skip to the next target if len(allTargetsTableValues[targetIdx][tableIdx].Fields) == 0 || len(allTargetsTableValues[targetIdx][tableIdx].Fields[0].Values) == 0 { - _ = f.SetCellValue(sheetName, cellName(col, *row), noDataFound) + msg := noDataFound + if allTargetsTableValues[targetIdx][tableIdx].NoDataFound != "" { + msg = allTargetsTableValues[targetIdx][tableIdx].NoDataFound + } + _ = f.SetCellValue(sheetName, cellName(col, *row), msg) *row += 2 continue } diff --git a/internal/report/table_defs.go b/internal/report/table_defs.go index 3f010355..86cd6bf0 100644 --- a/internal/report/table_defs.go +++ b/internal/report/table_defs.go @@ -35,9 +35,10 @@ type TableDefinition struct { Name string ScriptNames []string // Fields function is called to retrieve field values from the script outputs - FieldsFunc FieldsRetriever - MenuLabel string // add to tables that will be displayed in the menu - HasRows bool // table is meant to be displayed in row form, i.e., a field may have multiple values + FieldsFunc FieldsRetriever + MenuLabel string // add to tables that will be displayed in the menu + HasRows bool // table is meant to be displayed in row form, i.e., a field may have multiple values + NoDataFound string // message to display when no data is found // render functions are used to override the default rendering behavior HTMLTableRendererFunc HTMLTableRenderer HTMLMultiTargetTableRendererFunc HTMLMultiTargetTableRenderer @@ -523,6 +524,7 @@ var tableDefinitions = map[string]TableDefinition{ ScriptNames: []string{ script.MemoryBandwidthAndLatencyScriptName, }, + NoDataFound: "No memory latency data found. Please see the GitHub repository README for instructions on how to install Intel Memory Latency Checker (mlc).", FieldsFunc: memoryLatencyTableValues, HTMLTableRendererFunc: memoryLatencyTableHtmlRenderer, HTMLMultiTargetTableRendererFunc: memoryLatencyTableMultiTargetHtmlRenderer}, @@ -533,7 +535,8 @@ var tableDefinitions = map[string]TableDefinition{ ScriptNames: []string{ script.NumaBandwidthScriptName, }, - FieldsFunc: numaBandwidthTableValues}, + NoDataFound: "No NUMA bandwidth data found. Please see the GitHub repository README for instructions on how to install Intel Memory Latency Checker (mlc).", + FieldsFunc: numaBandwidthTableValues}, // // telemetry tables //