mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-06-27 13:11:30 +02:00
KASM-6984 Refactor SelfBench XML generation and enhance benchmarking. Simplified XML structure by removing unnecessary elements and attributes. Added new fields to aggregate test case count, total time, and class name in the generated "SelfBench.xml" file. Ensures clearer benchmarking output and streamlined code.
KASM-6984 Refactor SelfBench XML generation and enhance benchmarking. Simplified XML structure by removing unnecessary elements and attributes. Added new fields to aggregate test case count, total time, and class name in the generated
This commit is contained in:
parent
75b1712f31
commit
b5f3f44c57
@ -44,14 +44,10 @@ static constexpr uint32_t HEIGHT = 1200;
|
||||
void SelfBench() {
|
||||
tinyxml2::XMLDocument doc;
|
||||
|
||||
auto *root = doc.NewElement("testsuites");
|
||||
root->SetAttribute("name", "Benchmarking");
|
||||
|
||||
auto *test_suits = doc.InsertFirstChild(root);
|
||||
|
||||
auto *test_suit = doc.NewElement("testsuit");
|
||||
auto *test_suit = doc.NewElement("testsuite");
|
||||
test_suit->SetAttribute("name", "SelfBench");
|
||||
test_suits->InsertEndChild(test_suit);
|
||||
|
||||
doc.InsertFirstChild(test_suit);
|
||||
|
||||
ManagedPixelBuffer f1(pfRGBX, WIDTH, HEIGHT);
|
||||
ManagedPixelBuffer f2(pfRGBX, WIDTH, HEIGHT);
|
||||
@ -85,18 +81,26 @@ void SelfBench() {
|
||||
|
||||
TightJPEGEncoder jpeg(nullptr);
|
||||
|
||||
auto benchmark = [&doc, &test_suit](const char *name, uint32_t runs, auto func) {
|
||||
uint32_t test_cases {};
|
||||
uint64_t total_time {};
|
||||
|
||||
auto benchmark = [&doc, &test_suit, &test_cases, &total_time](const char *name, uint32_t runs, auto func) {
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
for (uint32_t i = 0; i < runs; i++) {
|
||||
func(i);
|
||||
}
|
||||
|
||||
++test_cases;
|
||||
auto value = elapsedMs(now);
|
||||
double junit_value = value / 1000.;
|
||||
total_time += value;
|
||||
|
||||
vlog.info("%s took %lu ms (%u runs)", name, value, runs);
|
||||
auto *test_case = doc.NewElement("testcase");
|
||||
test_case->SetAttribute("name", name);
|
||||
test_case->SetAttribute("time", value);
|
||||
test_case->SetAttribute("time", junit_value);
|
||||
test_case->SetAttribute("runs", runs);
|
||||
test_case->SetAttribute("classname", "KasmVNC");
|
||||
test_suit->InsertEndChild(test_case);
|
||||
};
|
||||
|
||||
@ -180,6 +184,10 @@ void SelfBench() {
|
||||
comparer->compare(false, cursorReg);
|
||||
});
|
||||
|
||||
test_suit->SetAttribute("tests", test_cases);
|
||||
test_suit->SetAttribute("failures", 0);
|
||||
test_suit->SetAttribute("time", total_time);
|
||||
|
||||
doc.SaveFile("SelfBench.xml");
|
||||
|
||||
exit(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user