Speedup nptl/tst-cond11 and nptl/tst-cond11-static.
diff mbox series

Message ID 4b3367a8-8aec-e9f1-46fd-7b3577d3c204@linux.ibm.com
State New
Headers show
Series
  • Speedup nptl/tst-cond11 and nptl/tst-cond11-static.
Related show

Commit Message

Stefan Liebler Sept. 12, 2019, 12:16 p.m. UTC
Hi,

each test runs for 5s as run_test is called 5 times.
in run_test, the timeout for pthread_cond_timedwait
or pthread_cond_clockwait is tested by adding 1s to
current time.

This patch reduces the timeout to 0.3s which leads to
a runtime of 1.5s for one invocation.
As the nptl tests run in sequence, this patch saves roughly
7s of runtime for "make check".

Bye,
Stefan

ChangeLog:

	* nptl/tst-cond11.c (run_test): Reduce timeout.

Comments

Carlos O'Donell Sept. 12, 2019, 2:16 p.m. UTC | #1
On 9/12/19 8:16 AM, Stefan Liebler wrote:
> Hi,
> 
> each test runs for 5s as run_test is called 5 times.
> in run_test, the timeout for pthread_cond_timedwait
> or pthread_cond_clockwait is tested by adding 1s to
> current time.
> 
> This patch reduces the timeout to 0.3s which leads to
> a runtime of 1.5s for one invocation.
> As the nptl tests run in sequence, this patch saves roughly
> 7s of runtime for "make check".
> 
> Bye,
> Stefan
> 
> ChangeLog:
> 
>     * nptl/tst-cond11.c (run_test): Reduce timeout.

Same comment as with "[PATCH] Speedup various nptl/tst-mutex5 tests."

Patch
diff mbox series

commit c7bf98b0cc862a679e876d4142e3cac84aa2d2b2
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Thu Sep 12 10:10:35 2019 +0200

    Speedup nptl/tst-cond11 and nptl/tst-cond11-static.
    
    Each test runs for 5s as run_test is called 5 times.
    in run_test, the timeout for pthread_cond_timedwait
    or pthread_cond_clockwait is tested by adding 1s to
    current time.
    
    This patch reduces the timeout to 0.3s which leads to
    a runtime of 1.5s for one invocation.
    As the nptl tests run in sequence, this patch saves roughly
    7s of runtime for "make check".
    
    ChangeLog:
    
            * nptl/tst-cond11.c (run_test): Reduce timeout.

diff --git a/nptl/tst-cond11.c b/nptl/tst-cond11.c
index afb15ef66e..6d703a1607 100644
--- a/nptl/tst-cond11.c
+++ b/nptl/tst-cond11.c
@@ -64,8 +64,13 @@  run_test (clockid_t attr_clock, clockid_t wait_clock)
   xclock_gettime (wait_clock == CLOCK_USE_ATTR_CLOCK ? attr_clock : wait_clock,
                   &ts_timeout);
 
-  /* Wait one second.  */
-  ++ts_timeout.tv_sec;
+  /* Wait 0.3 second.  */
+  ts_timeout.tv_nsec += 300000000;
+  if (ts_timeout.tv_nsec >= 1000000000)
+    {
+      ts_timeout.tv_nsec -= 1000000000;
+      ++ts_timeout.tv_sec;
+    }
 
   if (wait_clock == CLOCK_USE_ATTR_CLOCK) {
     TEST_COMPARE (pthread_cond_timedwait (&cond, &mut, &ts_timeout), ETIMEDOUT);