qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH] tests: fix output message formatting for crypto benchmarks
Date: Wed, 9 Sep 2020 14:54:12 +0200	[thread overview]
Message-ID: <fcbe2c05-b38c-4b12-32f1-c7ce9e7a29dd@amsat.org> (raw)
In-Reply-To: <20200909121027.1040647-1-berrange@redhat.com>

On 9/9/20 2:10 PM, Daniel P. Berrangé wrote:
> The output was changed from g_print to g_test_message in
> 
>   commit 24441f912e67233d9c52ce6b459ed75de2484525
>   Author: Marc-André Lureau <marcandre.lureau@redhat.com>
>   Date:   Fri Aug 28 15:07:30 2020 +0400
> 
>     tests: do not print benchmark output to stdout
> 
>     As this makes the TAP output invalid. Use g_test_message().
> 
> The functions do not result in equivalent output. The g_print
> statements were putting all the information on a single line
> for ease of interpretation. The change to g_test_message split
> the output across many lines making it painful to read.
> 
> The opportunity is used to tweak the information printed to
> be more consistent across tests.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  tests/benchmark-crypto-cipher.c | 12 ++++++++----
>  tests/benchmark-crypto-hash.c   |  4 +++-
>  tests/benchmark-crypto-hmac.c   |  7 +++----
>  3 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-cipher.c
> index 1936aa4ae0..c04f0a0fba 100644
> --- a/tests/benchmark-crypto-cipher.c
> +++ b/tests/benchmark-crypto-cipher.c
> @@ -70,8 +70,10 @@ static void test_cipher_speed(size_t chunk_size,
>      }
>      g_test_timer_elapsed();
>  
> -    g_test_message("Enc chunk %zu bytes ", chunk_size);
> -    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("enc(%s-%s) chunk %zu bytes %.2f MB/sec ",
> +                   QCryptoCipherAlgorithm_str(alg),
> +                   QCryptoCipherMode_str(mode),
> +                   chunk_size, (double)total / MiB / g_test_timer_last());
>  
>      g_test_timer_start();
>      remain = total;
> @@ -85,8 +87,10 @@ static void test_cipher_speed(size_t chunk_size,
>      }
>      g_test_timer_elapsed();
>  
> -    g_test_message("Dec chunk %zu bytes ", chunk_size);
> -    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("dec(%s-%s) chunk %zu bytes %.2f MB/sec ",
> +                   QCryptoCipherAlgorithm_str(alg),
> +                   QCryptoCipherMode_str(mode),
> +                   chunk_size, (double)total / MiB / g_test_timer_last());
>  
>      qcrypto_cipher_free(cipher);
>      g_free(plaintext);
> diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
> index 598111e75a..927b00bb4d 100644
> --- a/tests/benchmark-crypto-hash.c
> +++ b/tests/benchmark-crypto-hash.c
> @@ -48,7 +48,9 @@ static void test_hash_speed(const void *opaque)
>      }
>      g_test_timer_elapsed();
>  
> -    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("hash(%s): chunk %zu bytes %.2f MB/sec",
> +                   QCryptoHashAlgorithm_str(opts->alg),
> +                   opts->chunk_size, total / g_test_timer_last());
>  
>      g_free(out);
>      g_free(in);
> diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
> index f9fa22df95..5cca636789 100644
> --- a/tests/benchmark-crypto-hmac.c
> +++ b/tests/benchmark-crypto-hmac.c
> @@ -55,10 +55,9 @@ static void test_hmac_speed(const void *opaque)
>      } while (g_test_timer_elapsed() < 5.0);
>  
>      total /= MiB;
> -    g_test_message("hmac(sha256): ");
> -    g_test_message("Testing chunk_size %zu bytes ", chunk_size);
> -    g_test_message("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
> -    g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
> +    g_test_message("hmac(%s): chunk %zu bytes %.2f MB/sec",
> +                   QCryptoHashAlgorithm_str(QCRYPTO_HASH_ALG_SHA256),
> +                   chunk_size, total / g_test_timer_last());
>  
>      g_free(out);
>      g_free(in);
> 


      reply	other threads:[~2020-09-09 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 12:10 [PATCH] tests: fix output message formatting for crypto benchmarks Daniel P. Berrangé
2020-09-09 12:54 ` Philippe Mathieu-Daudé [this message]

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=fcbe2c05-b38c-4b12-32f1-c7ce9e7a29dd@amsat.org \
    --to=f4bug@amsat.org \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).