Skip to content

Commit

Permalink
chore: dfly_bench - print ongoing error counts (#3382)
Browse files Browse the repository at this point in the history
  • Loading branch information
romange authored Jul 24, 2024
1 parent 52b29b3 commit 02b72c9
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 02b72c9

Please sign in to comment.