Skip to content

Commit ee7e527

Browse files
tehnerdmeta-codesync[bot]
authored andcommitted
fixing perf testing for packets w/ packet builder (#252)
Summary: With some packets in textures moved to packet builder it broke perf testing. So fixing it. Also removing outdated comment about inline decap since you folks decided to run tons of syscalls instead Pull Request resolved: #252 Reviewed By: pdubovitsky Differential Revision: D84077259 Pulled By: frankfeir fbshipit-source-id: 76a8392bbec4170d2f2125a21488eb9130a84db0
1 parent 00f7005 commit ee7e527

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

katran/lib/testing/framework/BpfTester.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,15 @@ std::vector<TestResult> BpfTester::testPerfFromFixture(
431431

432432
// Run all tests and collect results
433433
for (int i = first_index; i < last_index; i++) {
434-
auto single_results = runXdpProgPerf(
435-
config_.testData[i].inputPacket,
436-
config_.testData[i].description,
437-
repeat);
434+
std::string input_packet;
435+
if (config_.testData[i].inputPacketBuilder.has_value()) {
436+
auto inputResult = config_.testData[i].inputPacketBuilder->build();
437+
input_packet = inputResult.base64Packet;
438+
} else {
439+
input_packet = config_.testData[i].inputPacket;
440+
}
441+
auto single_results =
442+
runXdpProgPerf(input_packet, config_.testData[i].description, repeat);
438443
results.insert(results.end(), single_results.begin(), single_results.end());
439444
}
440445
return results;
@@ -480,7 +485,7 @@ std::vector<TestResult> BpfTester::runXdpProgPerf(
480485
duration = 1;
481486
}
482487
}
483-
if (repeat > 0) {
488+
if (repeat > 0 && total_duration > 0) {
484489
auto avgDuration = total_duration / repeat;
485490
auto pps = kNanosecInSec / avgDuration;
486491
auto pps_millions = static_cast<double>(pps) / 1000000.0;

katran/lib/testing/framework/katran_tester.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ int main(int argc, char** argv) {
398398
tester.testPcktsFromPcap();
399399
return 0;
400400
} else if (FLAGS_perf_testing) {
401-
// for perf tests to work katran must be compiled w -DINLINE_DECAP
402401
preparePerfTestingLbData(*lb);
403402
auto results = tester.testPerfFromFixture(FLAGS_repeat, FLAGS_position);
404403
printPerfResults(results);

0 commit comments

Comments
 (0)