perf_tests: Manually serialize JSON and remove dependency on jsoncpp
jsoncpp causes some flaky failures because of inconsistencies in nested DEPS. We barely use it for JSON serialization so the simplest solution is to just manually write the serialization for perf test tracing data. Bug: dawn:208 Change-Id: Ie5e4b5436e2c9e32e6817d64c6e95c774cb8751f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14720 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:
parent
e9b15ab829
commit
2cb76ab598
1
BUILD.gn
1
BUILD.gn
|
@ -1020,7 +1020,6 @@ test("dawn_perf_tests") {
|
||||||
":dawn_utils",
|
":dawn_utils",
|
||||||
":libdawn_native",
|
":libdawn_native",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
"${dawn_jsoncpp_dir}:jsoncpp",
|
|
||||||
"${dawn_root}/src/common",
|
"${dawn_root}/src/common",
|
||||||
"${dawn_root}/src/dawn:dawncpp",
|
"${dawn_root}/src/dawn:dawncpp",
|
||||||
"${dawn_root}/src/dawn:libdawn_proc",
|
"${dawn_root}/src/dawn:libdawn_proc",
|
||||||
|
|
11
DEPS
11
DEPS
|
@ -73,17 +73,6 @@ deps = {
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
# jsoncpp for perf tests trace events
|
|
||||||
'third_party/jsoncpp': {
|
|
||||||
'url': '{chromium_git}/chromium/src/third_party/jsoncpp@571788934b5ee8643d53e5d054534abbe6006168',
|
|
||||||
'condition': 'dawn_standalone',
|
|
||||||
},
|
|
||||||
|
|
||||||
'third_party/jsoncpp/source': {
|
|
||||||
'url' : '{chromium_git}/external/github.com/open-source-parsers/jsoncpp@645250b6690785be60ab6780ce4b58698d884d11',
|
|
||||||
'condition': 'dawn_standalone',
|
|
||||||
},
|
|
||||||
|
|
||||||
# GLFW for tests and samples
|
# GLFW for tests and samples
|
||||||
'third_party/glfw': {
|
'third_party/glfw': {
|
||||||
'url': '{chromium_git}/external/github.com/glfw/glfw@2de2589f910b1a85905f425be4d32f33cec092df',
|
'url': '{chromium_git}/external/github.com/glfw/glfw@2de2589f910b1a85905f425be4d32f33cec092df',
|
||||||
|
|
|
@ -27,7 +27,6 @@ dawn_standalone = true
|
||||||
dawn_jinja2_dir = "//third_party/jinja2"
|
dawn_jinja2_dir = "//third_party/jinja2"
|
||||||
dawn_glfw_dir = "//third_party/glfw"
|
dawn_glfw_dir = "//third_party/glfw"
|
||||||
dawn_googletest_dir = "//third_party/googletest"
|
dawn_googletest_dir = "//third_party/googletest"
|
||||||
dawn_jsoncpp_dir = "//third_party/jsoncpp"
|
|
||||||
dawn_shaderc_dir = "//third_party/shaderc"
|
dawn_shaderc_dir = "//third_party/shaderc"
|
||||||
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
|
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
|
||||||
dawn_spirv_cross_dir = "//third_party/spirv-cross"
|
dawn_spirv_cross_dir = "//third_party/spirv-cross"
|
||||||
|
|
|
@ -41,10 +41,6 @@ if (!defined(dawn_googletest_dir)) {
|
||||||
dawn_googletest_dir = "//third_party/googletest"
|
dawn_googletest_dir = "//third_party/googletest"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined(dawn_jsoncpp_dir)) {
|
|
||||||
dawn_jsoncpp_dir = "//third_party/jsoncpp"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defined(dawn_shaderc_dir)) {
|
if (!defined(dawn_shaderc_dir)) {
|
||||||
dawn_shaderc_dir = "//third_party/shaderc"
|
dawn_shaderc_dir = "//third_party/shaderc"
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
#include "tests/perf_tests/DawnPerfTestPlatform.h"
|
#include "tests/perf_tests/DawnPerfTestPlatform.h"
|
||||||
#include "utils/Timer.h"
|
#include "utils/Timer.h"
|
||||||
|
|
||||||
#include <json/value.h>
|
|
||||||
#include <json/writer.h>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -36,45 +33,37 @@ namespace {
|
||||||
std::ofstream outFile;
|
std::ofstream outFile;
|
||||||
outFile.open(traceFile, std::ios_base::app);
|
outFile.open(traceFile, std::ios_base::app);
|
||||||
|
|
||||||
Json::StreamWriterBuilder builder;
|
|
||||||
std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
|
|
||||||
|
|
||||||
for (const DawnPerfTestPlatform::TraceEvent& traceEvent : traceEventBuffer) {
|
for (const DawnPerfTestPlatform::TraceEvent& traceEvent : traceEventBuffer) {
|
||||||
Json::Value value(Json::objectValue);
|
const char* category = nullptr;
|
||||||
|
|
||||||
const Json::LargestInt microseconds =
|
|
||||||
static_cast<Json::LargestInt>(traceEvent.timestamp * 1000.0 * 1000.0);
|
|
||||||
|
|
||||||
char phase[2] = {traceEvent.phase, '\0'};
|
|
||||||
|
|
||||||
value["name"] = traceEvent.name;
|
|
||||||
switch (traceEvent.category) {
|
switch (traceEvent.category) {
|
||||||
case dawn_platform::TraceCategory::General:
|
case dawn_platform::TraceCategory::General:
|
||||||
value["cat"] = "general";
|
category = "general";
|
||||||
break;
|
break;
|
||||||
case dawn_platform::TraceCategory::Validation:
|
case dawn_platform::TraceCategory::Validation:
|
||||||
value["cat"] = "validation";
|
category = "validation";
|
||||||
break;
|
break;
|
||||||
case dawn_platform::TraceCategory::Recording:
|
case dawn_platform::TraceCategory::Recording:
|
||||||
value["cat"] = "recording";
|
category = "recording";
|
||||||
break;
|
break;
|
||||||
case dawn_platform::TraceCategory::GPUWork:
|
case dawn_platform::TraceCategory::GPUWork:
|
||||||
value["cat"] = "gpu";
|
category = "gpu";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
value["ph"] = &phase[0];
|
|
||||||
value["id"] = traceEvent.id;
|
|
||||||
value["tid"] = traceEvent.threadId;
|
|
||||||
value["ts"] = microseconds;
|
|
||||||
value["pid"] = "Dawn";
|
|
||||||
|
|
||||||
outFile << ", ";
|
uint64_t microseconds = static_cast<uint64_t>(traceEvent.timestamp * 1000.0 * 1000.0);
|
||||||
writer->write(value, &outFile);
|
|
||||||
outFile.flush();
|
outFile << ", { "
|
||||||
|
<< "\"name\": \"" << traceEvent.name << "\", "
|
||||||
|
<< "\"cat\": \"" << category << "\", "
|
||||||
|
<< "\"ph\": \"" << traceEvent.phase << "\", "
|
||||||
|
<< "\"id\": " << traceEvent.id << ", "
|
||||||
|
<< "\"tid\": " << traceEvent.threadId << ", "
|
||||||
|
<< "\"ts\": " << microseconds << ", "
|
||||||
|
<< "\"pid\": \"Dawn\""
|
||||||
|
<< " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
outFile.close();
|
outFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +104,7 @@ DawnPerfTestEnvironment::DawnPerfTestEnvironment(int argc, char** argv)
|
||||||
if (strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
|
if (strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
|
||||||
dawn::InfoLog()
|
dawn::InfoLog()
|
||||||
<< "Additional flags:"
|
<< "Additional flags:"
|
||||||
<< " [--calibration] [--override-steps=x] [--enable-tracing] [--trace-file=file]\n"
|
<< " [--calibration] [--override-steps=x] [--trace-file=file]\n"
|
||||||
<< " --calibration: Only run calibration. Calibration allows the perf test"
|
<< " --calibration: Only run calibration. Calibration allows the perf test"
|
||||||
" runner script to save some time.\n"
|
" runner script to save some time.\n"
|
||||||
<< " --override-steps: Set a fixed number of steps to run for each test\n"
|
<< " --override-steps: Set a fixed number of steps to run for each test\n"
|
||||||
|
|
Loading…
Reference in New Issue