dovecot-2.2: lib: Added timing_get_sum()
dovecot at dovecot.org
dovecot at dovecot.org
Tue Sep 22 13:11:14 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/a1c9e2cc574b
changeset: 19183:a1c9e2cc574b
user: Timo Sirainen <tss at iki.fi>
date: Tue Sep 22 16:09:41 2015 +0300
description:
lib: Added timing_get_sum()
diffstat:
src/lib/test-timing.c | 1 +
src/lib/timing.c | 5 +++++
src/lib/timing.h | 2 ++
3 files changed, 8 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r 13252c581016 -r a1c9e2cc574b src/lib/test-timing.c
--- a/src/lib/test-timing.c Tue Sep 22 14:33:33 2015 +0300
+++ b/src/lib/test-timing.c Tue Sep 22 16:09:41 2015 +0300
@@ -29,6 +29,7 @@
i_qsort(copy, input_size, sizeof(*copy), uint64_cmp);
test_assert_idx(timing_get_count(t) == input_size, input_size);
+ test_assert_idx(timing_get_sum(t) == sum, input_size);
test_assert_idx(timing_get_min(t) == min, input_size);
test_assert_idx(timing_get_max(t) == max, input_size);
test_assert_idx(timing_get_avg(t) == (sum + input_size/2)/input_size, input_size);
diff -r 13252c581016 -r a1c9e2cc574b src/lib/timing.c
--- a/src/lib/timing.c Tue Sep 22 14:33:33 2015 +0300
+++ b/src/lib/timing.c Tue Sep 22 16:09:41 2015 +0300
@@ -59,6 +59,11 @@
return timing->count;
}
+uint64_t timing_get_sum(const struct timing *timing)
+{
+ return timing->sum;
+}
+
uint64_t timing_get_min(const struct timing *timing)
{
return timing->min;
diff -r 13252c581016 -r a1c9e2cc574b src/lib/timing.h
--- a/src/lib/timing.h Tue Sep 22 14:33:33 2015 +0300
+++ b/src/lib/timing.h Tue Sep 22 16:09:41 2015 +0300
@@ -9,6 +9,8 @@
/* Returns number of events added. */
unsigned int timing_get_count(const struct timing *timing);
+/* Returns the sum of all usecs added. */
+uint64_t timing_get_sum(const struct timing *timing);
/* Returns events' minimum. */
uint64_t timing_get_min(const struct timing *timing);
More information about the dovecot-cvs
mailing list