parent
4a237889ca
commit
94b63d83ba
2 changed files with 17 additions and 9 deletions
|
|
@ -281,7 +281,7 @@ void VulkanExampleBase::benchmarkLoop()
|
||||||
}
|
}
|
||||||
vkDeviceWaitIdle(device);
|
vkDeviceWaitIdle(device);
|
||||||
// Save results as comma separated file
|
// Save results as comma separated file
|
||||||
std::ofstream result("benchresults.csv", std::ios::out);
|
std::ofstream result(benchmark.resultFile + ".csv", std::ios::out);
|
||||||
if (result.is_open()) {
|
if (result.is_open()) {
|
||||||
|
|
||||||
double tMin = *std::min_element(benchmark.iterationTime.begin(), benchmark.iterationTime.end());
|
double tMin = *std::min_element(benchmark.iterationTime.begin(), benchmark.iterationTime.end());
|
||||||
|
|
@ -698,16 +698,17 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation)
|
||||||
}
|
}
|
||||||
if ((args[i] == std::string("-b")) || (args[i] == std::string("-benchmark"))) {
|
if ((args[i] == std::string("-b")) || (args[i] == std::string("-benchmark"))) {
|
||||||
benchmark.active = true;
|
benchmark.active = true;
|
||||||
// Number of iterations as optional parameter
|
// Result file name can be overriden
|
||||||
if (args.size() > i + 1) {
|
if (args.size() > i + 1) {
|
||||||
char* endptr;
|
benchmark.resultFile = args[i + 1];
|
||||||
uint32_t iterations = strtol(args[i + 1], &endptr, 10);
|
|
||||||
if (endptr != args[i + 1]) { benchmark.iterations = iterations; };
|
|
||||||
}
|
}
|
||||||
benchmark.iterationTime.resize(benchmark.iterations);
|
// Number of iterations as optional parameter
|
||||||
benchmark.frameTimes.min = std::numeric_limits<double>::max();
|
if (args.size() > i + 2) {
|
||||||
benchmark.frameTimes.max = std::numeric_limits<double>::min();
|
char* endptr;
|
||||||
benchmark.frameTimes.avg = 0.0;
|
uint32_t iterations = strtol(args[i + 2], &endptr, 10);
|
||||||
|
if (endptr != args[i + 2]) { benchmark.iterations = iterations; };
|
||||||
|
}
|
||||||
|
benchmark.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,10 +156,17 @@ public:
|
||||||
bool active = false;
|
bool active = false;
|
||||||
uint32_t iterations = 10;
|
uint32_t iterations = 10;
|
||||||
uint32_t currIteration = 0;
|
uint32_t currIteration = 0;
|
||||||
|
std::string resultFile = "benchmarkresults";
|
||||||
std::vector<double> iterationTime;
|
std::vector<double> iterationTime;
|
||||||
struct FrameTimes {
|
struct FrameTimes {
|
||||||
double min, max, avg;
|
double min, max, avg;
|
||||||
} frameTimes;
|
} frameTimes;
|
||||||
|
void init() {
|
||||||
|
iterationTime.resize(iterations);
|
||||||
|
frameTimes.min = std::numeric_limits<double>::max();
|
||||||
|
frameTimes.max = std::numeric_limits<double>::min();
|
||||||
|
frameTimes.avg = 0.0;
|
||||||
|
}
|
||||||
} benchmark;
|
} benchmark;
|
||||||
|
|
||||||
float zoom = 0;
|
float zoom = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue