MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / PrintResultTable

Function PrintResultTable

examples/VulkanBenchmark.cpp:2188–2237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2186}
2187
2188static void PrintResultTable(const std::vector<BenchmarkResult>& results) {
2189 struct Column { std::string title; size_t width; };
2190 const std::vector<Column> columns = {
2191 {"Path", 16}, {"Decode", 18}, {"Composite", 15}, {"HW", 4},
2192 {"Readback", 8}, {"Upload", 6}, {"Frames", 6},
2193 {"DecAvg", 8}, {"UpAvg", 8}, {"CompAvg", 8}, {"FPS", 8}
2194 };
2195
2196 auto print_separator = [&]() {
2197 std::cout << "+";
2198 for (const auto& column : columns) {
2199 std::cout << std::string(column.width + 2, '-') << "+";
2200 }
2201 std::cout << "\n";
2202 };
2203
2204 print_separator();
2205 std::cout << "|";
2206 for (const auto& column : columns) {
2207 std::cout << " " << PadCell(column.title, column.width) << " |";
2208 }
2209 std::cout << "\n";
2210 print_separator();
2211
2212 for (const auto& result : results) {
2213 std::vector<std::string> cells = {
2214 result.name,
2215 result.decode_backend,
2216 result.composite_backend,
2217 FormatBool(result.hw_decode_used),
2218 FormatBool(result.readback_to_cpu),
2219 FormatBool(result.upload_to_vulkan),
2220 std::to_string(result.stats.frames),
2221 FormatDouble(result.stats.frames ? result.stats.decode_ms / result.stats.frames : 0.0),
2222 FormatDouble(result.stats.frames ? result.stats.upload_ms / result.stats.frames : 0.0),
2223 FormatDouble(result.stats.frames ? result.stats.composite_ms / result.stats.frames : 0.0),
2224 FormatDouble(result.stats.total_ms > 0.0 ? (result.stats.frames * 1000.0) / result.stats.total_ms : 0.0)
2225 };
2226
2227 std::cout << "|";
2228 for (size_t i = 0; i < columns.size(); ++i) {
2229 std::cout << " " << PadCell(cells[i], columns[i].width) << " |";
2230 }
2231 std::cout << "\n";
2232 if (!result.note.empty()) {
2233 std::cout << "| " << PadCell("note: " + result.note, 121) << " |\n";
2234 }
2235 print_separator();
2236 }
2237}
2238
2239static BenchmarkOptions ParseOptions(int argc, char* argv[]) {
2240 BenchmarkOptions options;

Callers 1

mainFunction · 0.85

Calls 3

PadCellFunction · 0.85
FormatBoolFunction · 0.85
FormatDoubleFunction · 0.85

Tested by

no test coverage detected