Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qualification UI change floating precision [skip ci] #6189

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions tools/src/main/resources/ui/js/uiutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ class AppsToStagesMap {

let appStagesMap = new AppsToStagesMap();

const twoDecimalFormatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
});

function padZeroes(num) {
return ("0" + num).slice(-2);
}
Expand Down Expand Up @@ -101,19 +96,23 @@ function formatDuration(milliseconds) {
}
let seconds = milliseconds * 1.0 / 1000;
if (seconds < 1) {
return seconds.toFixed(1) + " s";
return seconds.toFixed(2) + " s";
}
if (seconds < 60) {
return seconds.toFixed(0) + " s";
return seconds.toFixed(1) + " s";
}
let minutes = seconds / 60;
if (minutes < 10) {
return minutes.toFixed(1) + " min";
return minutes.toFixed(2) + " min";
} else if (minutes < 60) {
return minutes.toFixed(0) + " min";
return minutes.toFixed(1) + " min";
}
let hours = minutes / 60;
return hours.toFixed(1) + " h";
return hours.toFixed(2) + " h";
}

function formatFloatingPoints(numArg) {
return Math.floor(parseFloat(numArg) * 100) / 100;
}

function getColumnIndex(columns, columnName) {
Expand Down Expand Up @@ -319,10 +318,8 @@ function processRawData(rawRecords) {
}

// Set numeric fields for display
appRecord["totalSpeedup_display"] =
Math.floor(parseFloat(appRecord["totalSpeedup"]) * 10) / 10;
appRecord["taskSpeedupFactor_display"] =
Math.floor(parseFloat(appRecord["taskSpeedupFactor"]) * 10) / 10;
appRecord["totalSpeedup_display"] = formatFloatingPoints(appRecord["totalSpeedup"]);
appRecord["taskSpeedupFactor_display"] = formatFloatingPoints(appRecord["taskSpeedupFactor"]);

setAppInfoRecord(appRecord);
maxOpportunity =
Expand Down Expand Up @@ -413,20 +410,20 @@ function setGlobalReportSummary(processedApps) {
formatDuration(totalGPUOpportunityDurations);
qualReportSummary.speedups.totalSqlDataframeTaskDuration =
formatDuration(totalSqlDataframeDuration);
qualReportSummary.speedups.statsPercentage = twoDecimalFormatter.format(speedUpPercent)
qualReportSummary.speedups.statsPercentage = formatFloatingPoints(speedUpPercent)
+ qualReportSummary.speedups.statsPercentage;

// candidates
qualReportSummary.candidates.numeric = recommendedCnt;
qualReportSummary.tlc.numeric = tlcCount;
qualReportSummary.totalApps.statsPercentage =
twoDecimalFormatter.format(estimatedPercentage)
formatFloatingPoints(estimatedPercentage)
+ qualReportSummary.totalApps.statsPercentage;
qualReportSummary.candidates.statsPercentage =
twoDecimalFormatter.format(gpuPercent)
formatFloatingPoints(gpuPercent)
+ qualReportSummary.candidates.statsPercentage;
qualReportSummary.tlc.statsPercentage =
twoDecimalFormatter.format(tlcPercent)
formatFloatingPoints(tlcPercent)
+ qualReportSummary.tlc.statsPercentage;
}

Expand Down Expand Up @@ -964,7 +961,7 @@ function createAppDetailsExecsTableConf(
data: "speedupFactor",
render: function (data, type, row) {
if (data && type === 'display') {
return twoDecimalFormatter.format(data);
return formatFloatingPoints(data);
}
return data;
},
Expand Down Expand Up @@ -1131,7 +1128,7 @@ function createAppDetailsStagesTableConf(
data: "averageSpeedup",
render: function (data, type, row) {
if (data && type === 'display') {
return twoDecimalFormatter.format(data);
return formatFloatingPoints(data);
}
return data;
},
Expand Down Expand Up @@ -1288,7 +1285,7 @@ function createAppDetailsSQLsTableConf(
data: 'info.estimatedGpuSpeedup',
render: function (data, type, row) {
if (data && type === 'display') {
return twoDecimalFormatter.format(data);
return formatFloatingPoints(data);
}
return data;
},
Expand Down