MCPcopy Create free account
hub / github.com/dds-bridge/dds / SortCalc

Method SortCalc

library/src/system/scheduler.cpp:553–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551
552
553void Scheduler::SortCalc()
554{
555 listType * lp;
556 handType * hp;
557 int strain, key, index;
558
559 for (int g = 0; g < numGroups; g++)
560 {
561 strain = group[g].strain;
562 key = group[g].hash;
563 lp = &list[strain][key];
564 index = lp->first;
565 hp = &hands[index];
566
567 // Taking into account repeat times saves 1-2%.
568
569 group[g].pred = 272000;
570
571 int fanout = hp->fanout;
572 double * slist = SORT_CALC_FANOUT[hp->NTflag];
573 double fanoutFactor;
574
575 if (fanout < slist[0])
576 fanoutFactor = 0.; // A bit extreme...
577 else if (fanout < slist[1])
578 fanoutFactor = slist[2] * (fanout - slist[0]);
579 else
580 fanoutFactor = slist[3] * exp( (fanout - slist[1]) / slist[4] );
581
582 group[g].pred = static_cast<int>(
583 (fanoutFactor * static_cast<double>(group[g].pred)));
584 }
585
586 // Sort groups using merge sort.
587 groupType gp;
588 for (int g = 0; g < numGroups; g++)
589 {
590 gp = group[g];
591 int j = g;
592 for (; j && gp.pred > group[j - 1].pred; --j)
593 group[j] = group[j - 1];
594 group[j] = gp;
595 }
596}
597
598
599// These are specific times from a 12-core PC. The hope is

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected