Add cpu_time metric to dawn_perf_tests

The cpu_time metric measures the amount of CPU time spent on a step.
It excludes time spent waiting for the GPU or time between frames.

Bug: dawn:208
Change-Id: I5624d45557716c02bb7da632d2347eca0b81ad41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13640
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-11-15 15:43:26 +00:00 committed by Commit Bot service account
parent b639e68495
commit a930e599e1
2 changed files with 6 additions and 0 deletions

View File

@ -237,6 +237,7 @@ void DawnPerfTestBase::DoRunLoop(double maxRunTime) {
dawn_platform::Platform* platform = gTestEnv->GetInstance()->GetPlatform(); dawn_platform::Platform* platform = gTestEnv->GetInstance()->GetPlatform();
mNumStepsPerformed = 0; mNumStepsPerformed = 0;
cpuTime = 0;
mRunning = true; mRunning = true;
wgpu::FenceDescriptor desc = {}; wgpu::FenceDescriptor desc = {};
@ -252,7 +253,10 @@ void DawnPerfTestBase::DoRunLoop(double maxRunTime) {
mTest->WaitABit(); mTest->WaitABit();
} }
TRACE_EVENT0(platform, General, "Step"); TRACE_EVENT0(platform, General, "Step");
double stepStart = mTimer->GetElapsedTime();
Step(); Step();
cpuTime += mTimer->GetElapsedTime() - stepStart;
mTest->queue.Signal(fence, ++signaledFenceValue); mTest->queue.Signal(fence, ++signaledFenceValue);
if (mRunning) { if (mRunning) {
@ -339,6 +343,7 @@ void DawnPerfTestBase::OutputResults() {
} }
PrintPerIterationResultFromSeconds("wall_time", mTimer->GetElapsedTime(), true); PrintPerIterationResultFromSeconds("wall_time", mTimer->GetElapsedTime(), true);
PrintPerIterationResultFromSeconds("cpu_time", cpuTime, true);
PrintPerIterationResultFromSeconds("validation_time", totalValidationTime, true); PrintPerIterationResultFromSeconds("validation_time", totalValidationTime, true);
PrintPerIterationResultFromSeconds("recording_time", totalRecordingTime, true); PrintPerIterationResultFromSeconds("recording_time", totalRecordingTime, true);

View File

@ -97,6 +97,7 @@ class DawnPerfTestBase {
const unsigned int mMaxStepsInFlight; const unsigned int mMaxStepsInFlight;
unsigned int mStepsToRun = 0; unsigned int mStepsToRun = 0;
unsigned int mNumStepsPerformed = 0; unsigned int mNumStepsPerformed = 0;
double cpuTime;
std::unique_ptr<utils::Timer> mTimer; std::unique_ptr<utils::Timer> mTimer;
}; };