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 <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng 2019-10-28 11:35:20 +00:00 committed by Commit Bot service account
parent 04863c42be
commit f6281a5530
3 changed files with 13 additions and 3 deletions

View File

@ -125,6 +125,7 @@ void DawnPerfTestEnvironment::DumpTraceEventsToJSONFile() const {
value["name"] = traceEvent.name; value["name"] = traceEvent.name;
value["cat"] = traceEvent.categoryName; value["cat"] = traceEvent.categoryName;
value["ph"] = &phase[0]; value["ph"] = &phase[0];
value["id"] = traceEvent.id;
value["ts"] = microseconds; value["ts"] = microseconds;
value["pid"] = "Dawn"; value["pid"] = "Dawn";

View File

@ -80,7 +80,7 @@ uint64_t DawnPerfTestPlatform::AddTraceEvent(char phase,
"|enabled| must be the first field of the TraceCategory class."); "|enabled| must be the first field of the TraceCategory class.");
const TraceCategory* category = reinterpret_cast<const TraceCategory*>(categoryGroupEnabled); const TraceCategory* category = reinterpret_cast<const TraceCategory*>(categoryGroupEnabled);
mTraceEventBuffer.emplace_back(phase, category->name, name, timestamp); mTraceEventBuffer.emplace_back(phase, category->name, name, id, timestamp);
return static_cast<uint64_t>(mTraceEventBuffer.size()); return static_cast<uint64_t>(mTraceEventBuffer.size());
} }

View File

@ -32,13 +32,22 @@ class DawnPerfTestPlatform : public dawn_platform::Platform {
struct TraceEvent final { struct TraceEvent final {
TraceEvent() { TraceEvent() {
} }
TraceEvent(char phaseIn, const char* categoryNameIn, const char* nameIn, double timestampIn) TraceEvent(char phaseIn,
: phase(phaseIn), categoryName(categoryNameIn), name(nameIn), timestamp(timestampIn) { const char* categoryNameIn,
const char* nameIn,
uint64_t idIn,
double timestampIn)
: phase(phaseIn),
categoryName(categoryNameIn),
name(nameIn),
id(idIn),
timestamp(timestampIn) {
} }
char phase = 0; char phase = 0;
const char* categoryName = nullptr; const char* categoryName = nullptr;
const char* name = nullptr; const char* name = nullptr;
uint64_t id = 0;
double timestamp = 0; double timestamp = 0;
}; };