unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Liebler <stli@linux.ibm.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: [PATCH] Speedup various nptl/tst-cancel20 and nptl/tst-cancel21 tests.
Date: Thu, 12 Sep 2019 14:15:48 +0200	[thread overview]
Message-ID: <c2818c4a-3afe-e691-6589-1c24651b43a5@linux.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

Hi,

each of thease tests - tst-cancel20, tst-cancelx20, tst-cancel21,
tst-cancelx21 and tst-cancel21-static - runs for 8s.

do_one_test is called 4 times. Either in do_one_test (tst-cancel20.c)
or in tf (tst-cancel21.c) "sleep (1)" is called 2 times.

This patch reduces the sleep time. Using usleep (5ms) leads to a
runtime of one tst-cancel... invocation of roughly 40ms instead of 8s.
As the nptl tests run in sequence, this patch saves roughly 39s of
runtime for "make check".

Bye,
Stefan

ChangeLog:

	* nptl/tst-cancel20.c (do_one_test): Reduce sleep times.
	* nptl/tst-cancel21.c (tf): Likewise.

[-- Attachment #2: 20190911_nptl_tstcancel20_21.patch --]
[-- Type: text/x-patch, Size: 1736 bytes --]

commit e89d0d6819799737a6133d3994e6f38d00c745e4
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Wed Sep 11 09:43:08 2019 +0200

    Speedup various nptl/tst-cancel20 and nptl/tst-cancel21 tests.
    
    Each of thease tests - tst-cancel20, tst-cancelx20, tst-cancel21,
    tst-cancelx21 and tst-cancel21-static - runs for 8s.
    
    do_one_test is called 4 times. Either in do_one_test (tst-cancel20.c)
    or in tf (tst-cancel21.c) "sleep (1)" is called 2 times.
    
    This patch reduces the sleep time. Using usleep (5ms) leads to a
    runtime of one tst-cancel... invocation of roughly 40ms instead of 8s.
    As the nptl tests run in sequence, this patch saves roughly 39s of
    runtime for "make check".
    
    ChangeLog:
    
            * nptl/tst-cancel20.c (do_one_test): Reduce sleep times.
            * nptl/tst-cancel21.c (tf): Likewise.

diff --git a/nptl/tst-cancel20.c b/nptl/tst-cancel20.c
index 96dfb71fa9..abf250d508 100644
--- a/nptl/tst-cancel20.c
+++ b/nptl/tst-cancel20.c
@@ -126,7 +126,7 @@ do_one_test (void)
       return 1;
     }
 
-  sleep (1);
+  usleep (5000);
 
   r = pthread_kill (th, SIGHUP);
   if (r)
@@ -137,7 +137,7 @@ do_one_test (void)
     }
 
   while (in_sh_body == 0)
-    sleep (1);
+    usleep (5000);
 
   if (pthread_cancel (th) != 0)
     {
diff --git a/nptl/tst-cancel21.c b/nptl/tst-cancel21.c
index 361510b027..371759c551 100644
--- a/nptl/tst-cancel21.c
+++ b/nptl/tst-cancel21.c
@@ -104,7 +104,7 @@ tf (void *arg)
       exit (1);
     }
 
-  sleep (1);
+  usleep (5000);
 
   r = pthread_kill (th, SIGHUP);
   if (r)
@@ -115,7 +115,7 @@ tf (void *arg)
     }
 
   while (in_sh_body == 0)
-    sleep (1);
+    usleep (5000);
 
   if (pthread_cancel (th) != 0)
     {

             reply	other threads:[~2019-09-12 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 12:15 Stefan Liebler [this message]
2019-09-12 14:07 ` [PATCH] Speedup various nptl/tst-cancel20 and nptl/tst-cancel21 tests Carlos O'Donell
2019-09-20 12:59   ` Stefan Liebler
2019-09-20 15:17     ` Zack Weinberg
2019-09-20 15:50       ` Florian Weimer
2019-10-29 15:46       ` Stefan Liebler

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2818c4a-3afe-e691-6589-1c24651b43a5@linux.ibm.com \
    --to=stli@linux.ibm.com \
    --cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).