Separated benchmark argument line options

Refs #269
This commit is contained in:
saschawillems 2018-01-13 10:39:03 +01:00
parent 39122785a8
commit cb32e2e89f
2 changed files with 24 additions and 14 deletions

View file

@ -21,7 +21,7 @@ namespace vks
FILE *stream;
public:
bool active = false;
bool outputFrameTimes = true;
bool outputFrameTimes = false;
uint32_t warmup = 1;
uint32_t duration = 10;
std::vector<double> frameTimes;
@ -72,8 +72,8 @@ namespace vks
if (result.is_open()) {
result << std::fixed << std::setprecision(4);
result << "duration (ms),frames" << std::endl;
result << runtime << "," << frameCount << std::endl;
result << "duration (ms),frames,fps" << std::endl;
result << runtime << "," << frameCount << "," << frameCount / (runtime / 1000.0) << std::endl;
if (outputFrameTimes) {
result << std::endl << "frame,ms" << std::endl;

View file

@ -690,10 +690,12 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation)
uint32_t h = strtol(args[i + 1], &numConvPtr, 10);
if (numConvPtr != args[i + 1]) { height = h; };
}
if ((args[i] == std::string("-b")) || (args[i] == std::string("-benchmark"))) {
// TODO: option toggle for detailed frame rate output
// Benchmark
if ((args[i] == std::string("-b")) || (args[i] == std::string("--benchmark"))) {
benchmark.active = true;
// Warmup time in seconds
}
// Warmup time (in seconds)
if ((args[i] == std::string("-bw")) || (args[i] == std::string("--benchwarmup"))) {
if (args.size() > i + 1) {
uint32_t num = strtol(args[i + 1], &numConvPtr, 10);
if (numConvPtr != args[i + 1]) {
@ -702,25 +704,33 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation)
std::cerr << "Warmup time for benchmark mode must be specified as a number!" << std::endl;
}
}
// Benchmark runtime in seconds
if (args.size() > i + 2) {
uint32_t num = strtol(args[i + 2], &numConvPtr, 10);
if (numConvPtr != args[i + 2]) {
}
// Benchmark runtime (in seconds)
if ((args[i] == std::string("-br")) || (args[i] == std::string("--benchruntime"))) {
if (args.size() > i + 1) {
uint32_t num = strtol(args[i + 1], &numConvPtr, 10);
if (numConvPtr != args[i + 1]) {
benchmark.duration = num;
}
else {
std::cerr << "Benchmark run duration must be specified as a number!" << std::endl;
}
}
// Default file name can be overriden
if (args.size() > i + 3) {
if (args[i + 3][0] == '-') {
}
// Bench result save filename (overrides default)
if ((args[i] == std::string("-bf")) || (args[i] == std::string("--benchfilename"))) {
if (args.size() > i + 1) {
if (args[i + 1][0] == '-') {
std::cerr << "Filename for benchmark results must not start with a hyphen!" << std::endl;
} else {
benchmark.filename = args[i + 3];
benchmark.filename = args[i + 1];
}
}
}
// Output frame times to benchmark result file
if ((args[i] == std::string("-bt")) || (args[i] == std::string("--benchframetimes"))) {
benchmark.outputFrameTimes = true;
}
}
#if defined(VK_USE_PLATFORM_ANDROID_KHR)