From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
qemu-block@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v2 12/17] throttle: Check that burst_level leaks correctly
Date: Thu, 18 Feb 2016 12:27:05 +0200 [thread overview]
Message-ID: <21aaaac86a43a982067babb090a5e5f67dbfb37f.1455788710.git.berto@igalia.com> (raw)
In-Reply-To: <cover.1455788710.git.berto@igalia.com>
In-Reply-To: <cover.1455788710.git.berto@igalia.com>
This patch expands test_leak_bucket() to check that burst_level leaks
correctly.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/test-throttle.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 34f1f9e..145ba08 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -60,6 +60,22 @@ static void test_leak_bucket(void)
g_assert(bkt.avg == 150);
g_assert(bkt.max == 15);
g_assert(double_cmp(bkt.level, 0));
+
+ /* check that burst_level leaks correctly */
+ bkt.burst_level = 6;
+ bkt.max = 250;
+ bkt.burst_length = 2; /* otherwise burst_level will not leak */
+ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 100);
+ g_assert(double_cmp(bkt.burst_level, 3.5));
+
+ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 100);
+ g_assert(double_cmp(bkt.burst_level, 1));
+
+ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 100);
+ g_assert(double_cmp(bkt.burst_level, 0));
+
+ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 100);
+ g_assert(double_cmp(bkt.burst_level, 0));
}
static void test_compute_wait(void)
--
2.7.0
next prev parent reply other threads:[~2016-02-18 10:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 10:26 [Qemu-devel] [PATCH v2 00/17] throttle: Allow I/O bursts for a user-defined period of time Alberto Garcia
2016-02-18 10:26 ` [Qemu-devel] [PATCH v2 01/17] throttle: Make throttle_compute_timer() static Alberto Garcia
2016-02-18 10:26 ` [Qemu-devel] [PATCH v2 02/17] throttle: Make throttle_conflicting() set errp Alberto Garcia
2016-02-18 10:26 ` [Qemu-devel] [PATCH v2 03/17] throttle: Make throttle_max_is_missing_limit() " Alberto Garcia
2016-02-18 10:26 ` [Qemu-devel] [PATCH v2 04/17] throttle: Make throttle_is_valid() " Alberto Garcia
2016-02-18 10:26 ` [Qemu-devel] [PATCH v2 05/17] throttle: Set always an average value when setting a maximum value Alberto Garcia
2016-02-18 10:26 ` [Qemu-devel] [PATCH v2 06/17] throttle: Merge all functions that check the configuration into one Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 07/17] throttle: Use throttle_config_init() to initialize ThrottleConfig Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 08/17] throttle: Add support for burst periods Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 09/17] throttle: Add command-line settings to define the " Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 10/17] qapi: Add burst length parameters to block_set_io_throttle Alberto Garcia
2016-02-22 16:41 ` Eric Blake
2016-02-23 8:26 ` Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 11/17] qapi: Add burst length fields to BlockDeviceInfo Alberto Garcia
2016-02-18 10:27 ` Alberto Garcia [this message]
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 13/17] throttle: Test throttle_compute_wait() during bursts Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 14/17] qemu-iotests: Extend iotest 093 to test bursts Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 15/17] qapi: Correct the name of the iops_rd parameter Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 16/17] docs: Document the throttling infrastructure Alberto Garcia
2016-02-18 10:27 ` [Qemu-devel] [PATCH v2 17/17] MAINTAINERS: Add myself as maintainer of the throttling code Alberto Garcia
2016-02-22 13:47 ` [Qemu-devel] [PATCH v2 00/17] throttle: Allow I/O bursts for a user-defined period of time Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21aaaac86a43a982067babb090a5e5f67dbfb37f.1455788710.git.berto@igalia.com \
--to=berto@igalia.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).