diff mbox series

tst_timer: fix verification of execution time

Message ID 1563992624-4968-3-git-send-email-piotr.krzysztof.gawel@gmail.com
State Rejected
Headers show
Series tst_timer: fix verification of execution time | expand

Commit Message

piotr.krzysztof.gawel July 24, 2019, 6:23 p.m. UTC
Each sample needs to be in range:
    t < s[i] < t + threshold
Thus for i from the interval [d...n]:
    (n-d)*t < sum(s[d...n]) < (n-d)*(t + threshold)
This patch fixes that check.

Signed-off-by: Piotr Gawel <piotr.krzysztof.gawel@gmail.com>
---
 lib/tst_timer_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis July 25, 2019, 2:45 p.m. UTC | #1
Hi!
> Each sample needs to be in range:
>     t < s[i] < t + threshold
> Thus for i from the interval [d...n]:
>     (n-d)*t < sum(s[d...n]) < (n-d)*(t + threshold)
> This patch fixes that check.

As far as I can tell the function compute_treshold() multiplies the
threshold per call by keep_samples already, so it's a threashold per run
not a treshold per call, or do I miss something?

> Signed-off-by: Piotr Gawel <piotr.krzysztof.gawel@gmail.com>
> ---
>  lib/tst_timer_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
> index f6459e5..4508e29 100644
> --- a/lib/tst_timer_test.c
> +++ b/lib/tst_timer_test.c
> @@ -306,7 +306,7 @@ void do_timer_test(long long usec, unsigned int nsamples)
>  		samples[nsamples-1], samples[0], median,
>  		1.00 * trunc_mean / keep_samples, discard);
>  
> -	if (trunc_mean > (nsamples - discard) * usec + threshold) {
> +	if (trunc_mean > keep_samples * (usec + threshold)) {
>  		tst_res(TFAIL, "%s slept for too long", scall);
>  		if (!print_frequency_plot)
> -- 
> 2.7.4
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
piotr.krzysztof.gawel July 25, 2019, 6:04 p.m. UTC | #2
Hi,Oops. I missed that. Please reject this patch.BR, PiotrWysłano z mojego smartfona Samsung Galaxy.
-------- Oryginalna wiadomość --------Od: Cyril Hrubis <chrubis@suse.cz> Data: 25.07.2019  16:45  (GMT+01:00) Do: Piotr Gawel <piotr.krzysztof.gawel@gmail.com> DW: ltp@lists.linux.it Temat: Re: [LTP] [PATCH] tst_timer: fix verification of execution time Hi!> Each sample needs to be in range:>     t < s[i] < t + threshold> Thus for i from the interval [d...n]:>     (n-d)*t < sum(s[d...n]) < (n-d)*(t + threshold)> This patch fixes that check.As far as I can tell the function compute_treshold() multiplies thethreshold per call by keep_samples already, so it's a threashold per runnot a treshold per call, or do I miss something?> Signed-off-by: Piotr Gawel <piotr.krzysztof.gawel@gmail.com>> --->  lib/tst_timer_test.c | 2 +->  1 file changed, 1 insertion(+), 1 deletion(-)> > diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c> index f6459e5..4508e29 100644> --- a/lib/tst_timer_test.c> +++ b/lib/tst_timer_test.c> @@ -306,7 +306,7 @@ void do_timer_test(long long usec, unsigned int nsamples)>  		samples[nsamples-1], samples[0], median,>  		1.00 * trunc_mean / keep_samples, discard);>  > -	if (trunc_mean > (nsamples - discard) * usec + threshold) {> +	if (trunc_mean > keep_samples * (usec + threshold)) {>  		tst_res(TFAIL, "%s slept for too long", scall);>  		if (!print_frequency_plot)> -- > 2.7.4> > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp-- Cyril Hrubischrubis@suse.cz
diff mbox series

Patch

diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
index f6459e5..4508e29 100644
--- a/lib/tst_timer_test.c
+++ b/lib/tst_timer_test.c
@@ -306,7 +306,7 @@  void do_timer_test(long long usec, unsigned int nsamples)
 		samples[nsamples-1], samples[0], median,
 		1.00 * trunc_mean / keep_samples, discard);
 
-	if (trunc_mean > (nsamples - discard) * usec + threshold) {
+	if (trunc_mean > keep_samples * (usec + threshold)) {
 		tst_res(TFAIL, "%s slept for too long", scall);
 
 		if (!print_frequency_plot)