Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: dfly_bench - print ongoing error counts #3382

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/server/dfly_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ void Driver::ParseRESP(facade::RedisParser* parser, io::IoBuf* io_buf) {
do {
result = parser->Parse(io_buf->InputBuffer(), &consumed, &parse_args);
if (result == RedisParser::OK && !parse_args.empty()) {
if (reqs_.front().might_hit && parse_args[0].type != facade::RespExpr::NIL) {
if (parse_args[0].type == facade::RespExpr::ERROR) {
++stats_.num_errors;
} else if (reqs_.front().might_hit && parse_args[0].type != facade::RespExpr::NIL) {
++stats_.hit_count;
}
parse_args.clear();
Expand Down Expand Up @@ -473,11 +475,13 @@ void WatchFiber(absl::Time start_time, atomic_bool* finish_signal, ProactorPool*
absl::Time now = absl::Now();
if (now - last_print > absl::Seconds(5)) {
uint64_t num_resp = 0;
uint64_t num_errors = 0;

pp->AwaitFiberOnAll([&](auto* p) {
unique_lock lk(mutex);

num_resp += client->stats.num_responses;
num_errors += client->stats.num_errors;
lk.unlock();
});

Expand All @@ -488,7 +492,8 @@ void WatchFiber(absl::Time start_time, atomic_bool* finish_signal, ProactorPool*

CONSOLE_INFO << total_ms / 1000 << "s: " << absl::StrFormat("%.1f", done_perc)
<< "% done, effective RPS(now/accumulated): "
<< period_resp_cnt * 1000 / period_ms << "/" << num_resp * 1000 / total_ms;
<< period_resp_cnt * 1000 / period_ms << "/" << num_resp * 1000 / total_ms
<< ", errors: " << num_errors;

last_print = now;
num_last_resp_cnt = num_resp;
Expand Down
Loading