|
/* This function allows you to calculate how much of your SynqNet cycle
you are actually using. The Foreground Cycle is reading values from
all the nodes, where the TX (transmit) is sending data to nodes, and
commanding motion. The larger the TX Start means that the Transmiting
is happening later in the SynqNet Cycle (increasing latency between
reading values, and interpreting them). However it is crucial that
the TX Cycle Start NEVER is lower than the Foreground Cycle legnth.
Always leave a Buffer.
*/
long synqNetTimingStatistics(MPIControl control, MEISynqNet synqNet) {
MEISynqNetTiming timingValues; long returnValue;
// Grab Timing Data & Calculate Positions returnValue = meiControlStatisticsReset(meiObjects->MpiControl()); if(returnValue != MPIMessageOK){ return returnValue; }
returnValue = meiSynqNetTiming(meiObjects->MpiSynqNet(), &timingValues);
if(returnValue != MPIMessageOK){ return returnValue; }
printf("Foreground Cycle Usage: %3.2lf%%\n",
timingValues.calculationTime/SQcontrollerPeriod*100);
printf("TX Start @ Cycle Percent: %3.2lf%%\n",
timingValues.txTime); printf("TX Cycle Usage: %3.2lf%%\n",
timingValues.downstream.total/timingValues.controllerPeriod*100);
return returnValue; }
|