diff --git a/src/cycle.h b/src/cycle.h index 16f57e7e1ef942d2736f4328be9117b2deab6d6e..846e7dc3f5168e931c58768ea463ddda4332837f 100644 --- a/src/cycle.h +++ b/src/cycle.h @@ -234,7 +234,7 @@ typedef unsigned long long ticks; # define INLINE inline # endif #endif -INLINE static ticks getticks(void) +INLINE ticks getticks(void) { unsigned a, d; asm volatile("rdtsc" : "=a" (a), "=d" (d)); diff --git a/src/qsched.c b/src/qsched.c index dc60a6c657699a6aaa37cb7c360e5be8bc216927..8074ad265c48f4ac04655a529b8c765dea2352eb 100644 --- a/src/qsched.c +++ b/src/qsched.c @@ -819,7 +819,8 @@ qsched_task_t qsched_gettask ( struct qsched *s , int qid , qsched_task_t last ) int naq, k, tid, qids[ s->nr_queues ]; struct task *t; - + unsigned int seed = qid; + TIMER_TIC /* Check if the sched is ok. */ @@ -845,7 +846,7 @@ qsched_task_t qsched_gettask ( struct qsched *s , int qid , qsched_task_t last ) if ( k != qid && s->queues[k].count > 0 ) qids[ naq++ ] = k; while ( naq > 0 ) { - k = rand() % naq; + k = rand_r(&seed) % naq; TIMER_TIC2 tid = queue_get( &s->queues[ qids[k] ] , s , 0 , last ); TIMER_TOC( s , qsched_timer_queue ) diff --git a/src/queue.c b/src/queue.c index 191500f31178d7a05af5f274a82ec48296adbe91..6cc9411f8946485839b2f9bf7024be8a7de2f657 100644 --- a/src/queue.c +++ b/src/queue.c @@ -59,13 +59,13 @@ float queue_task_overlap ( struct qsched *s , qsched_task_t a , qsched_task_t b if (nr_res_a == 0 || nr_res_b == 0) return nr_res_a == nr_res_b ? 1.0f : 0.0f; struct res *res_a[nr_res_a], *res_b[nr_res_b]; for (int k = 0; k < ta->nr_locks; k++) - res_a[k] = &s->res[s->locks[ta->locks[k]]]; + res_a[k] = &s->res[ta->locks[k]]; for (int k = 0; k < ta->nr_uses; k++) - res_a[ta->nr_locks + k] = &s->res[s->locks[ta->uses[k]]]; + res_a[ta->nr_locks + k] = &s->res[ta->uses[k]]; for (int k = 0; k < tb->nr_locks; k++) - res_b[k] = &s->res[s->locks[tb->locks[k]]]; + res_b[k] = &s->res[tb->locks[k]]; for (int k = 0; k < tb->nr_uses; k++) - res_b[tb->nr_locks + k] = &s->res[s->locks[tb->uses[k]]]; + res_b[tb->nr_locks + k] = &s->res[tb->uses[k]]; /* Compute the resource union, which is just the sum of the resource sizes. */