Merge pull request #860 from per-mathisen-arm/benchmark1frame
Add option to only render a given number of frames.
This commit is contained in:
commit
ab2d4060d2
2 changed files with 6 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ namespace vks
|
||||||
public:
|
public:
|
||||||
bool active = false;
|
bool active = false;
|
||||||
bool outputFrameTimes = false;
|
bool outputFrameTimes = false;
|
||||||
|
int outputFrames = -1; // -1 means no frames limit
|
||||||
uint32_t warmup = 1;
|
uint32_t warmup = 1;
|
||||||
uint32_t duration = 10;
|
uint32_t duration = 10;
|
||||||
std::vector<double> frameTimes;
|
std::vector<double> frameTimes;
|
||||||
|
|
@ -61,6 +62,7 @@ namespace vks
|
||||||
runtime += tDiff;
|
runtime += tDiff;
|
||||||
frameTimes.push_back(tDiff);
|
frameTimes.push_back(tDiff);
|
||||||
frameCount++;
|
frameCount++;
|
||||||
|
if (outputFrames != -1 && outputFrames == frameCount) break;
|
||||||
};
|
};
|
||||||
std::cout << "Benchmark finished" << "\n";
|
std::cout << "Benchmark finished" << "\n";
|
||||||
std::cout << "device : " << deviceProps.deviceName << " (driver version: " << deviceProps.driverVersion << ")" << "\n";
|
std::cout << "device : " << deviceProps.deviceName << " (driver version: " << deviceProps.driverVersion << ")" << "\n";
|
||||||
|
|
|
||||||
|
|
@ -788,6 +788,9 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation)
|
||||||
if (commandLineParser.isSet("benchmarkresultframes")) {
|
if (commandLineParser.isSet("benchmarkresultframes")) {
|
||||||
benchmark.outputFrameTimes = true;
|
benchmark.outputFrameTimes = true;
|
||||||
}
|
}
|
||||||
|
if (commandLineParser.isSet("benchmarkframes")) {
|
||||||
|
benchmark.outputFrames = commandLineParser.getValueAsInt("benchmarkframes", benchmark.outputFrames);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
// Vulkan library is loaded dynamically on Android
|
// Vulkan library is loaded dynamically on Android
|
||||||
|
|
@ -2772,6 +2775,7 @@ CommandLineParser::CommandLineParser()
|
||||||
add("benchmarkruntime", { "-br", "--benchruntime" }, 1, "Set duration time for benchmark mode in seconds");
|
add("benchmarkruntime", { "-br", "--benchruntime" }, 1, "Set duration time for benchmark mode in seconds");
|
||||||
add("benchmarkresultfile", { "-bf", "--benchfilename" }, 1, "Set file name for benchmark results");
|
add("benchmarkresultfile", { "-bf", "--benchfilename" }, 1, "Set file name for benchmark results");
|
||||||
add("benchmarkresultframes", { "-bt", "--benchframetimes" }, 0, "Save frame times to benchmark results file");
|
add("benchmarkresultframes", { "-bt", "--benchframetimes" }, 0, "Save frame times to benchmark results file");
|
||||||
|
add("benchmarkframes", { "-bfs", "--benchmarkframes" }, 1, "Only render the given number of frames");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandLineParser::add(std::string name, std::vector<std::string> commands, bool hasValue, std::string help)
|
void CommandLineParser::add(std::string name, std::vector<std::string> commands, bool hasValue, std::string help)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue