I am trying to get some information on the details of the TBB scheduler code in task.cpp. I basically want to profile how well the random task scheduler performs by tracking each instance of a false negative -- that is, one thread tries to steal a task from another randomly selected task queue, and fails to do so despite the fact that other task queues in fact do have tasks available.
I am curious what do you mean by "how well the random task scheduler performs"? What sources of false-negatives are you looking for?
I see only 2 possible sources of false-negatives:
(1) thread is unable to steal too "low-level" tasks, i.e.:
task* GenericScheduler::steal_task( UnpaddedArenaSlot& arena_slot, depth_type d ) {
task* result = NULL;
ExponentialBackoff backoff;
bool sync_prepare_done = false;
depth_type steal_end = arena_slot.steal_end;
for(;;) {
if( steal_end>>1<d ) {
// Nothing of interest to steal
if( sync_prepare_done )
ITT_NOTIFY(sync_cancel, &arena_slot);
goto done;
}
(2) thread fails to "strip the proxy" after task stealing:
t = steal_task( *victim, d );
if( !t ) goto fail;
if( is_proxy(*t) ) {
t = strip_proxy((task_proxy*)t);
if( !t ) goto fail;
GATHER_STATISTIC( ++proxy_steal_count );
}
If you are trying to track these sources of false-negatives, then probably it's easier to insert statistics collection directly into the places marked with bold.