Commit 40db47d7 authored by Jan Kiszka's avatar Jan Kiszka

testsuite/smokey/sched-quote: Make more deterministic and simplify

As optimization can shrink __do_work to just two instruction, the
calibration loop needs to run longer.

At this chance, drop the pthread_kill to stop the thread and rely in
both cases on the throttle mechanism.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent d8f78fff
...@@ -199,13 +199,14 @@ static double run_quota(int quota) ...@@ -199,13 +199,14 @@ static double run_quota(int quota)
req.tv_nsec = 0; req.tv_nsec = 0;
clock_nanosleep(CLOCK_MONOTONIC, 0, &req, NULL); clock_nanosleep(CLOCK_MONOTONIC, 0, &req, NULL);
for (n = 0, count = 0; n < nrthreads; n++) { for (n = 0, count = 0; n < nrthreads; n++)
count += counts[n]; count += counts[n];
pthread_kill(threads[n], SIGDEMT);
}
percent = ((double)count / TEST_SECS) * 100.0 / loops_per_sec; percent = ((double)count / TEST_SECS) * 100.0 / loops_per_sec;
atomic_set(&throttle, 1);
smp_wmb();
for (n = 0; n < nrthreads; n++) { for (n = 0; n < nrthreads; n++) {
smokey_trace("done quota_thread[%d], count=%lu", n, counts[n]); smokey_trace("done quota_thread[%d], count=%lu", n, counts[n]);
pthread_cancel(threads[n]); pthread_cancel(threads[n]);
...@@ -224,7 +225,7 @@ static double run_quota(int quota) ...@@ -224,7 +225,7 @@ static double run_quota(int quota)
static unsigned long long calibrate(void) static unsigned long long calibrate(void)
{ {
struct timespec start, end, delta; struct timespec start, end, delta;
const int crunch_loops = 10000; const int crunch_loops = 100000;
unsigned long long ns, lps; unsigned long long ns, lps;
unsigned long count; unsigned long count;
struct timespec req; struct timespec req;
...@@ -255,10 +256,8 @@ static unsigned long long calibrate(void) ...@@ -255,10 +256,8 @@ static unsigned long long calibrate(void)
req.tv_nsec = 0; req.tv_nsec = 0;
clock_nanosleep(CLOCK_MONOTONIC, 0, &req, NULL); clock_nanosleep(CLOCK_MONOTONIC, 0, &req, NULL);
for (n = 0, lps = 0; n < nrthreads; n++) { for (n = 0, lps = 0; n < nrthreads; n++)
lps += counts[n]; lps += counts[n];
pthread_kill(threads[n], SIGDEMT);
}
atomic_set(&throttle, 1); atomic_set(&throttle, 1);
smp_wmb(); smp_wmb();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment