From 12515715c12a7d7ca41a5cad9154525a7098a7f7 Mon Sep 17 00:00:00 2001 From: Adam Michalski Date: Mon, 31 Jan 2022 17:06:57 +0100 Subject: [PATCH] libdbus: fix real tries counting bug Fixes a bug causing warm-up tries to be treated as real tries in latency calculations. Change-Id: I1548a162fffa6830cf589ebc46bcc571dcfc399b --- benchmark/libdbus.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/benchmark/libdbus.c b/benchmark/libdbus.c index 06d5343..ec34c93 100644 --- a/benchmark/libdbus.c +++ b/benchmark/libdbus.c @@ -38,6 +38,7 @@ static DBusHandlerResult message_func (DBusConnection *connection, unsigned long long end; unsigned long long temp; struct timespec clock; + double lt = 0; State *state = (State *)user_data; //if (dbus_message_is_method_call (message, "org.libdbus.server", "Perf")) @@ -50,20 +51,7 @@ static DBusHandlerResult message_func (DBusConnection *connection, dbus_message_get_args (message, NULL, DBUS_TYPE_UINT64, &start, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &state->buf, &msize, DBUS_TYPE_INVALID); - double lt = (double)(end - start) / 1000; - - if (raw_data_on) - fprintf(raw_data_fd, "%0.4f\n", lt); - - if(lt) { - lt_cnt++; - total += lt; - if(lt > max) - max = lt; - - if(lt < min) - min = lt; - } + lt = (double)(end - start) / 1000; } else { bw_cnt++; @@ -89,6 +77,21 @@ static DBusHandlerResult message_func (DBusConnection *connection, if(state->buf[0] != 'r') return DBUS_HANDLER_RESULT_HANDLED; + + if (state->is_lt) { + if (raw_data_on) + fprintf(raw_data_fd, "%0.4f\n", lt); + + if(lt > 0) { + lt_cnt++; + total += lt; + if(lt > max) + max = lt; + + if(lt < min) + min = lt; + } + } } return DBUS_HANDLER_RESULT_HANDLED; } -- 2.34.1