]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
modifty sleepers to have easier evaluation of interaction between cpu freq scaling
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 19 Feb 2017 11:23:46 +0000 (11:23 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 19 Feb 2017 11:23:46 +0000 (11:23 +0000)
and scheduler lock (pipe based or futex based)

See http://www.valgrind.org/docs/manual/manual-core.html#manual-core.pthreads_perf_sched
for background info about cpu freq scaling and valgrind thread scheduler.

To reproduce the interaction, do:
for sched in --fair-sched=yes --fair-sched=no
do
  for affinity in 0 1
  do
    echo $sched $affinity
    time ./vg-in-place $sched -q ./gdbserver_tests/sleepers 1000000 0 1000 B-B-B-B- $affinity
  done
done

which gives the below output (intel core i5-6402P, debian 8, kernel  3.16.0).
In summary: the fair scheduler is fair, the pipe based scheduler
can be really unfair (e.g. with --fair-sched=no and no affinity,
2 threads are finishing their work, while the 2 other threads are
starting their work only after the first 2 have fully finished).
The difference in timing is significant : 1m14s versus around 47 seconds.

  Note: If the governor is set to performance, strangely, the time needed for
  --fair-sched=no increases slighltly (to around 48 seconds).
  The time for --fair-sched=yes with or without affinity is then also
  to around 48 seconds.

Below is timing with on-demand governor:

--fair-sched=yes 0
loops/sleep_ms/burn/threads_spec/affinity:  1000000 0 1000 B-B-B-B- 0
Brussels ready to sleep and/or burn
London ready to sleep and/or burn
Petaouchnok ready to sleep and/or burn
main ready to sleep and/or burn
Brussels finished to sleep and/or burn
London finished to sleep and/or burn
Petaouchnok finished to sleep and/or burn
main finished to sleep and/or burn

real 1m14.582s
user 1m14.348s
sys 0m0.204s
--fair-sched=yes 1
loops/sleep_ms/burn/threads_spec/affinity:  1000000 0 1000 B-B-B-B- 1
Brussels ready to sleep and/or burn
London ready to sleep and/or burn
Petaouchnok ready to sleep and/or burn
main ready to sleep and/or burn
main finished to sleep and/or burn
Brussels finished to sleep and/or burn
Petaouchnok finished to sleep and/or burn
London finished to sleep and/or burn

real 0m46.785s
user 0m46.756s
sys 0m0.032s
--fair-sched=no 0
loops/sleep_ms/burn/threads_spec/affinity:  1000000 0 1000 B-B-B-B- 0
Brussels ready to sleep and/or burn
Brussels finished to sleep and/or burn
London ready to sleep and/or burn
London finished to sleep and/or burn
Petaouchnok ready to sleep and/or burn
main ready to sleep and/or burn
Petaouchnok finished to sleep and/or burn
main finished to sleep and/or burn

real 0m47.742s
user 0m48.224s
sys 0m0.084s
--fair-sched=no 1
loops/sleep_ms/burn/threads_spec/affinity:  1000000 0 1000 B-B-B-B- 1
Brussels ready to sleep and/or burn
London ready to sleep and/or burn
Petaouchnok ready to sleep and/or burn
main ready to sleep and/or burn
Brussels finished to sleep and/or burn
London finished to sleep and/or burn
main finished to sleep and/or burn
Petaouchnok finished to sleep and/or burn

real 0m46.601s
user 0m46.568s
sys 0m0.036s

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16251

gdbserver_tests/mcinfcallRU.stderr.exp
gdbserver_tests/mcinfcallRU.vgtest
gdbserver_tests/mcinfcallWSRU.stderr.exp
gdbserver_tests/mcinfcallWSRU.vgtest
gdbserver_tests/mcinvokeRU.vgtest
gdbserver_tests/nlcontrolc.stderr.exp
gdbserver_tests/nlcontrolc.vgtest
gdbserver_tests/nlsigvgdb.vgtest
gdbserver_tests/nlvgdbsigqueue.stderr.exp
gdbserver_tests/nlvgdbsigqueue.vgtest
gdbserver_tests/sleepers.c

index 502dd8a37c37df02434f09e372aa932e12cf5f74..492c9c4e96b9c33ce07c6083d80b860298ed53d5 100644 (file)
@@ -1,4 +1,4 @@
-loops/sleep_ms/burn/threads_spec:  1 0 2000000000 ------B-
+loops/sleep_ms/burn/threads_spec/affinity:  1 0 2000000000 ------B- 1
 main ready to sleep and/or burn
 pid .... Thread .... inferior call pushed from gdb in mcinfcallRU.stdinB.gdb
 Reset valgrind output to log (orderly_finish)
index 0c7b0793a7f5e07bab925b64f3d16a75719e883b..e16df045307d3c5a36d580ca0470e0e3ae154b97 100644 (file)
@@ -2,7 +2,7 @@
 prog: sleepers
 # We would like to use B-B-B-B- instead of ------B- but this gives
 # too much dependencies to the scheduler fairness.
-args: 1 0 2000000000 ------B-
+args: 1 0 2000000000 ------B- 1
 vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcinfcallRU
 # filter_gdb to replace pid and Thread numbers in the output of the program:
 stderr_filter: filter_gdb
index a6ac61769ac654b66eb3ea57894ca74f7ad0f84a..8a9939c6fa5c03ba40bf6418f15c94744cbaaf3e 100644 (file)
@@ -1,4 +1,4 @@
-loops/sleep_ms/burn/threads_spec:  100 100000000 1000000000 -S-S-SB-
+loops/sleep_ms/burn/threads_spec/affinity:  100 100000000 1000000000 -S-S-SB- 1
 Brussels ready to sleep and/or burn
 London ready to sleep and/or burn
 Petaouchnok ready to sleep and/or burn
index fd3922f54ca462bc68b5610e14ec1869abbb4372..af260ff20230bd8acdead6f991a7b9bdc8ef2227 100644 (file)
@@ -3,7 +3,7 @@
 prog: sleepers
 # We would like to have two threads running (i.e. -S-SB-B-)
 # but this introduces too much dependencies to scheduler fairness.
-args: 100 100000000 1000000000 -S-S-SB-
+args: 100 100000000 1000000000 -S-S-SB- 1
 vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcinfcallWSRU
 # We need a non buggy gdb.step on arm thumb.
 # Disable on Darwin: inferior call rejected as it cannot find malloc.
index 1d56b7fdb6ad30d9dfa822a22f82b43233b4d4fb..ab9ada7a08a4b2c5b77a5e7bc214a5b67aef2dde 100644 (file)
@@ -1,7 +1,7 @@
 # test that vgdb can invoke a process when all threads are in Runnable or Yielding mode
 # If the test goes wrong, it might consume CPU during a long time.
 prog: sleepers
-args: 1 0 1000000000 B-B-B-B-
+args: 1 0 1000000000 B-B-B-B- 1
 vgopts: --tool=memcheck --vgdb=yes --vgdb-prefix=./vgdb-prefix-mcinvokeRU
 stderr_filter: filter_make_empty
 # as the Valgrind process is always busy, we do not need the vgdb.invoker prereq.
index 0f27d71bf618eff4bca2c316a02c1103446c6efe..ac75bb3dae071800ed5657b8242366a0da8f7091 100644 (file)
@@ -3,7 +3,7 @@ Nulgrind, the minimal Valgrind tool
 (action at startup) vgdb me ... 
 
 
-loops/sleep_ms/burn/threads_spec:  1000000000 1000000000 1000000000 BSBSBSBS
+loops/sleep_ms/burn/threads_spec/affinity:  1000000000 1000000000 1000000000 BSBSBSBS 1
 Brussels ready to sleep and/or burn
 London ready to sleep and/or burn
 Petaouchnok ready to sleep and/or burn
index 077b2bb81a524a51ca0ff5d60bc2a1ffee9bbbe9..f54f2828b7cabbafc8c3670dfda1c54a80d0c533 100644 (file)
@@ -9,7 +9,7 @@
 # This test is disabled on Solaris because modifying select/poll/ppoll timeout
 # has no effect if a thread is already blocked in that syscall.
 prog: sleepers
-args: 1000000000 1000000000 1000000000 BSBSBSBS
+args: 1000000000 1000000000 1000000000 BSBSBSBS 1
 vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlcontrolc
 stderr_filter: filter_stderr
 # Bug 338633 nlcontrol hangs on arm64 currently.
index f488748e4e3a307fed8db19ba0ac424d242fddc7..0b03b04055c230d71afb69c43986946ce406866f 100644 (file)
@@ -4,7 +4,7 @@
 # But if this signal is masked, then vgdb does not recuperate the control
 # and Valgrind dies. See function give_control_back_to_vgdb in m_gdbserver.c
 prog: sleepers
-args: 1 10000000 0 -S-S-S-S
+args: 1 10000000 0 -S-S-S-S 1
 vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlsigvgdb
 stderr_filter: filter_stderr
 prereq: test -e gdb -a -f vgdb.invoker
index 616c0a872e338d60dc5684865e0186eecd895623..52b10c9dbb077d7ac0bc1442367267c70c7793fc 100644 (file)
@@ -3,7 +3,7 @@ Nulgrind, the minimal Valgrind tool
 (action at startup) vgdb me ... 
 
 
-loops/sleep_ms/burn/threads_spec:  1000000000 1000000000 1 BSBSBSBS
+loops/sleep_ms/burn/threads_spec/affinity:  1000000000 1000000000 1 BSBSBSBS 1
 Brussels ready to sleep and/or burn
 London ready to sleep and/or burn
 Petaouchnok ready to sleep and/or burn
index d8aa1c2c299fed9f9e29226a1998deffb239dbf7..877568211beb338f65a1f50bd496eb5fe3569770 100644 (file)
@@ -3,7 +3,7 @@
 # vgdb must queue these signals and deliver them before PTRACE_DETACHing.
 # sleepers is started with argument so that it will mostly sleep.
 prog: sleepers
-args: 1000000000 1000000000 1 BSBSBSBS
+args: 1000000000 1000000000 1 BSBSBSBS 1
 vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue
 stderr_filter: filter_stderr
 prereq: test -e gdb -a -f vgdb.invoker
index 64ab0eaf4c510ea459f32b8789b126ee58575369..5ffc6f8e3371de1b5b195fbe9dde42bf677c2709 100644 (file)
@@ -137,7 +137,7 @@ int main (int argc, char *argv[])
   pthread_t ebbr, egll, zzzz;
   struct spec b, l, p, m;
   char *some_mem __attribute__((unused)) = malloc(100);
-  setaffinity();
+  if (argc > 5 && atoi(argv[5])) setaffinity();
   setup_sigusr_handler();
   if (argc > 1)
      loops = atoi(argv[1]);
@@ -153,8 +153,8 @@ int main (int argc, char *argv[])
   else
      threads_spec = "BSBSBSBS";
   
-  fprintf(stderr, "loops/sleep_ms/burn/threads_spec:  %d %d %d %s\n",
-          loops, sleepms, burn, threads_spec);
+  fprintf(stderr, "loops/sleep_ms/burn/threads_spec/affinity:  %d %d %d %s %d\n",
+          loops, sleepms, burn, threads_spec, argc > 5 && atoi(argv[5]));
   fflush(stderr);
 
   b.name = "Brussels";