Fix result units in perf tests

Timing results extracted from trace events are reported in seconds,
not milliseconds.

Bug: dawn:208
Change-Id: I004d1ee5bbd0aaba8cf5b201f95903e76af0c530
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13000
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-11-01 15:07:01 +00:00 committed by Commit Bot service account
parent fb03935bed
commit c5e06a5d9f
2 changed files with 17 additions and 17 deletions

View File

@ -331,9 +331,9 @@ void DawnPerfTestBase::OutputResults() {
}
}
PrintPerIterationResultFromMilliseconds("wall_time", mTimer->GetElapsedTime() * 1e3, true);
PrintPerIterationResultFromMilliseconds("validation_time", totalValidationTime, true);
PrintPerIterationResultFromMilliseconds("recording_time", totalRecordingTime, true);
PrintPerIterationResultFromSeconds("wall_time", mTimer->GetElapsedTime(), true);
PrintPerIterationResultFromSeconds("validation_time", totalValidationTime, true);
PrintPerIterationResultFromSeconds("recording_time", totalRecordingTime, true);
const char* traceFile = gTestEnv->GetTraceFile();
if (traceFile != nullptr) {
@ -341,23 +341,23 @@ void DawnPerfTestBase::OutputResults() {
}
}
void DawnPerfTestBase::PrintPerIterationResultFromMilliseconds(const std::string& trace,
double valueInMilliseconds,
void DawnPerfTestBase::PrintPerIterationResultFromSeconds(const std::string& trace,
double valueInSeconds,
bool important) const {
if (valueInMilliseconds == 0) {
if (valueInSeconds == 0) {
return;
}
double millisecondsPerIteration =
valueInMilliseconds / static_cast<double>(mNumStepsPerformed * mIterationsPerStep);
double secondsPerIteration =
valueInSeconds / static_cast<double>(mNumStepsPerformed * mIterationsPerStep);
// Give the result a different name to ensure separate graphs if we transition.
if (millisecondsPerIteration > 1e3) {
PrintResult(trace, millisecondsPerIteration, "ms", important);
} else if (millisecondsPerIteration > 1) {
PrintResult(trace, millisecondsPerIteration * 1e3, "us", important);
if (secondsPerIteration > 1) {
PrintResult(trace, secondsPerIteration * 1e3, "ms", important);
} else if (secondsPerIteration > 1e-3) {
PrintResult(trace, secondsPerIteration * 1e6, "us", important);
} else {
PrintResult(trace, millisecondsPerIteration * 1e6, "ns", important);
PrintResult(trace, secondsPerIteration * 1e9, "ns", important);
}
}

View File

@ -73,8 +73,8 @@ class DawnPerfTestBase {
void AbortTest();
void RunTest();
void PrintPerIterationResultFromMilliseconds(const std::string& trace,
double valueInMilliseconds,
void PrintPerIterationResultFromSeconds(const std::string& trace,
double valueInSeconds,
bool important) const;
void PrintResult(const std::string& trace,
double value,