[PATCH] torture3: Add a little gencache_parse load test
Michael Adam
obnox at samba.org
Sat May 24 05:39:17 MDT 2014
pushed
On 2014-05-22 at 16:27 -0700, Christof Schmitt wrote:
> >From faa49e4ba0e95b60cca2fd3a26523e0ab44ac8aa Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Mon, 10 Mar 2014 15:43:19 +0100
> Subject: [PATCH] torture3: Add a little gencache_parse load test
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> Reviewed-by: Christof Schmitt <cs at samba.org>
> ---
> source3/torture/torture.c | 24 ++++++++++++++++++++++++
> 1 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/source3/torture/torture.c b/source3/torture/torture.c
> index 95d8b33..cea9089 100644
> --- a/source3/torture/torture.c
> +++ b/source3/torture/torture.c
> @@ -8119,12 +8119,26 @@ static bool run_local_base64(int dummy)
> return ret;
> }
>
> +static void parse_fn(time_t timeout, DATA_BLOB blob, void *private_data)
> +{
> + return;
> +}
> +
> static bool run_local_gencache(int dummy)
> {
> char *val;
> time_t tm;
> DATA_BLOB blob;
> char v;
> + struct memcache *mem;
> + int i;
> +
> + mem = memcache_init(NULL, 0);
> + if (mem == NULL) {
> + d_printf("%s: memcache_init failed\n", __location__);
> + return false;
> + }
> + memcache_set_global(mem);
>
> if (!gencache_set("foo", "bar", time(NULL) + 1000)) {
> d_printf("%s: gencache_set() failed\n", __location__);
> @@ -8136,6 +8150,16 @@ static bool run_local_gencache(int dummy)
> return False;
> }
>
> + for (i=0; i<1000000; i++) {
> + gencache_parse("foo", parse_fn, NULL);
> + }
> +
> + if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
> + d_printf("%s: gencache_get() failed\n", __location__);
> + return False;
> + }
> + TALLOC_FREE(val);
> +
> if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
> d_printf("%s: gencache_get() failed\n", __location__);
> return False;
> --
> 1.7.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140524/34de05bb/attachment.pgp>
More information about the samba-technical
mailing list