From f6281a5530c0f04529b8e330b1020f8c722485d8 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 28 Oct 2019 11:35:20 +0000 Subject: [PATCH] perf_tests: Add missing trace event "id" This missing identifier is used to match async trace events. Its absence broke async trace events since their Begin/End could not be matched correctly. Bug: dawn:208 Change-Id: I0671af8c3cbb8ff6220adcb8ed5621b831e383c7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12760 Reviewed-by: Corentin Wallez Reviewed-by: Kai Ninomiya Commit-Queue: Corentin Wallez --- src/tests/perf_tests/DawnPerfTest.cpp | 1 + src/tests/perf_tests/DawnPerfTestPlatform.cpp | 2 +- src/tests/perf_tests/DawnPerfTestPlatform.h | 13 +++++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/tests/perf_tests/DawnPerfTest.cpp b/src/tests/perf_tests/DawnPerfTest.cpp index 1bcac7387f..12e5f56e4d 100644 --- a/src/tests/perf_tests/DawnPerfTest.cpp +++ b/src/tests/perf_tests/DawnPerfTest.cpp @@ -125,6 +125,7 @@ void DawnPerfTestEnvironment::DumpTraceEventsToJSONFile() const { value["name"] = traceEvent.name; value["cat"] = traceEvent.categoryName; value["ph"] = &phase[0]; + value["id"] = traceEvent.id; value["ts"] = microseconds; value["pid"] = "Dawn"; diff --git a/src/tests/perf_tests/DawnPerfTestPlatform.cpp b/src/tests/perf_tests/DawnPerfTestPlatform.cpp index 4f3d3bb5b5..c9f74a5834 100644 --- a/src/tests/perf_tests/DawnPerfTestPlatform.cpp +++ b/src/tests/perf_tests/DawnPerfTestPlatform.cpp @@ -80,7 +80,7 @@ uint64_t DawnPerfTestPlatform::AddTraceEvent(char phase, "|enabled| must be the first field of the TraceCategory class."); const TraceCategory* category = reinterpret_cast(categoryGroupEnabled); - mTraceEventBuffer.emplace_back(phase, category->name, name, timestamp); + mTraceEventBuffer.emplace_back(phase, category->name, name, id, timestamp); return static_cast(mTraceEventBuffer.size()); } diff --git a/src/tests/perf_tests/DawnPerfTestPlatform.h b/src/tests/perf_tests/DawnPerfTestPlatform.h index 663c5e6b45..042ea6bd5f 100644 --- a/src/tests/perf_tests/DawnPerfTestPlatform.h +++ b/src/tests/perf_tests/DawnPerfTestPlatform.h @@ -32,13 +32,22 @@ class DawnPerfTestPlatform : public dawn_platform::Platform { struct TraceEvent final { TraceEvent() { } - TraceEvent(char phaseIn, const char* categoryNameIn, const char* nameIn, double timestampIn) - : phase(phaseIn), categoryName(categoryNameIn), name(nameIn), timestamp(timestampIn) { + TraceEvent(char phaseIn, + const char* categoryNameIn, + const char* nameIn, + uint64_t idIn, + double timestampIn) + : phase(phaseIn), + categoryName(categoryNameIn), + name(nameIn), + id(idIn), + timestamp(timestampIn) { } char phase = 0; const char* categoryName = nullptr; const char* name = nullptr; + uint64_t id = 0; double timestamp = 0; };