Milestone 5
This commit is contained in:
parent
420da2d468
commit
4e21039222
9 changed files with 877 additions and 22 deletions
|
|
@ -41,7 +41,7 @@ bool ParseUInt(const char* value, uint32_t* out) {
|
|||
|
||||
void PrintUsage() {
|
||||
std::cout << "warppipe_perf usage:\n"
|
||||
<< " --mode create-destroy|registry|links|policy\n"
|
||||
<< " --mode create-destroy|registry|links|policy|e2e\n"
|
||||
<< " --type sink|source|both\n"
|
||||
<< " --count N (default 200, per-type when --type both)\n"
|
||||
<< " --events N (registry mode, default 100)\n"
|
||||
|
|
@ -95,7 +95,8 @@ bool ParseArgs(int argc, char* argv[], Options* options) {
|
|||
return false;
|
||||
}
|
||||
if (options->mode != "create-destroy" && options->mode != "registry" &&
|
||||
options->mode != "links" && options->mode != "policy") {
|
||||
options->mode != "links" && options->mode != "policy" &&
|
||||
options->mode != "e2e") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -402,6 +403,77 @@ int main(int argc, char* argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (options.mode == "e2e") {
|
||||
std::vector<double> latencies;
|
||||
latencies.reserve(options.count);
|
||||
|
||||
for (uint32_t i = 0; i < options.count; ++i) {
|
||||
auto iter_start = std::chrono::steady_clock::now();
|
||||
|
||||
std::string sink_name = prefix + "-e2e-sink-" + std::to_string(i);
|
||||
auto sink = client.value->CreateVirtualSink(sink_name, node_options);
|
||||
if (!sink.ok()) {
|
||||
std::cerr << "e2e: create sink failed at " << i << ": "
|
||||
<< sink.status.message << "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
warppipe::RouteRule rule;
|
||||
rule.match.application_name = "warppipe-perf";
|
||||
rule.target_node = sink_name;
|
||||
auto rule_result = client.value->AddRouteRule(rule);
|
||||
if (!rule_result.ok()) {
|
||||
client.value->RemoveNode(sink.value.node);
|
||||
std::cerr << "e2e: add rule failed at " << i << ": "
|
||||
<< rule_result.status.message << "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
std::string source_name = prefix + "-e2e-src-" + std::to_string(i);
|
||||
auto source = client.value->CreateVirtualSource(source_name, node_options);
|
||||
if (!source.ok()) {
|
||||
client.value->RemoveRouteRule(rule_result.value);
|
||||
client.value->RemoveNode(sink.value.node);
|
||||
std::cerr << "e2e: create source failed at " << i << ": "
|
||||
<< source.status.message << "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
client.value->RemoveNode(source.value.node);
|
||||
client.value->RemoveRouteRule(rule_result.value);
|
||||
client.value->RemoveNode(sink.value.node);
|
||||
|
||||
auto iter_end = std::chrono::steady_clock::now();
|
||||
latencies.push_back(ToMillis(iter_end - iter_start));
|
||||
}
|
||||
|
||||
if (latencies.empty()) {
|
||||
std::cerr << "e2e: no iterations completed\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::sort(latencies.begin(), latencies.end());
|
||||
size_t n = latencies.size();
|
||||
size_t p50 = n / 2;
|
||||
size_t p95 = static_cast<size_t>(static_cast<double>(n) * 0.95);
|
||||
if (p95 >= n) {
|
||||
p95 = n - 1;
|
||||
}
|
||||
|
||||
double total = 0.0;
|
||||
for (double v : latencies) {
|
||||
total += v;
|
||||
}
|
||||
|
||||
std::cout << "e2e_iterations=" << n << "\n"
|
||||
<< "e2e_total_ms=" << std::fixed << std::setprecision(2) << total << "\n"
|
||||
<< "e2e_median_ms=" << latencies[p50] << "\n"
|
||||
<< "e2e_p95_ms=" << latencies[p95] << "\n"
|
||||
<< "e2e_min_ms=" << latencies[0] << "\n"
|
||||
<< "e2e_max_ms=" << latencies[n - 1] << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
PrintUsage();
|
||||
return 2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue