MCPcopy Create free account
hub / github.com/SIPp/sipp / initRepartition

Method initRepartition

src/stat.cpp:468–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466
467
468void CStat::initRepartition(unsigned int* repartition,
469 int nombre,
470 T_dynamicalRepartition ** tabRepartition,
471 int* tabNb)
472{
473 bool sortDone;
474 int i;
475 unsigned int swap;
476
477 if((nombre <= 0) || (repartition == nullptr) ) {
478 (*tabNb) = 0;
479 (*tabRepartition) = nullptr;
480 return;
481 }
482
483 (*tabNb) = nombre + 1;
484 (*tabRepartition) = new T_dynamicalRepartition[(*tabNb)];
485
486 // copying the repartition table in the local table
487 for(i=0; i<nombre; i++) {
488 (*tabRepartition)[i].borderMax = repartition[i];
489 (*tabRepartition)[i].nbInThisBorder = 0;
490 }
491
492 // sorting the repartition table
493 sortDone = false;
494 while(!sortDone) {
495 sortDone = true;
496 for(i=0; i<(nombre-1); i++) {
497 if((*tabRepartition)[i].borderMax > (*tabRepartition)[i+1].borderMax) {
498 // swapping this two value and setting sortDone to false
499 swap = (*tabRepartition)[i].borderMax;
500 (*tabRepartition)[i].borderMax =
501 (*tabRepartition)[i+1].borderMax;
502 (*tabRepartition)[i+1].borderMax = swap;
503 sortDone = false;
504 }
505 }
506 }
507 // setting the range for max <= value < infinity
508 (*tabRepartition)[nombre].borderMax =
509 (*tabRepartition)[nombre-1].borderMax;
510 (*tabRepartition)[nombre].nbInThisBorder = 0;
511}
512
513void CStat::setRtpEchoErrors(int value)
514{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected