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

View File

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