Exemplo n.º 1
0
void Machine::executeTurnovers()
{
    // perform rotor turnovers as calculated
    for (int i = 1; i <= turnoverCounters.count(); i++)
    {
        for (int j = 1; j <= turnoverCounters.value(i); i++)
        {
            rotorArray.value(i)->rotate();
            qDebug("\t\t\t Incrementing rotor [%d] name [%s]",
                   i,
                   rotorArray.value(i)->getRotorName().toStdString().data());
        }
    }
    clearCounters();
}
Exemplo n.º 2
0
/*
 * Synchronous signal processing:
 * This function should be called regularly from the main loop
 */
void
checkSignals(RunTimeOpts * rtOpts, PtpClock * ptpClock)
{
    /*
     * note:
     * alarm signals are handled in a similar way in dep/timer.c
     */

    if(sigint_received || sigterm_received) {
        do_signal_close(ptpClock);
    }

    if(sighup_received) {
        do_signal_sighup(rtOpts, ptpClock);
        sighup_received=0;
    }

    if(sigusr1_received) {
        if(ptpClock->portState == PTP_SLAVE) {
            WARNING("SIGUSR1 received, stepping clock to current known OFM\n");
            servo_perform_clock_step(rtOpts, ptpClock);
        } else {
            ERROR("SIGUSR1 received - will not step clock, not in PTP_SLAVE state\n");
        }
        sigusr1_received = 0;
    }

    if(sigusr2_received) {
        displayCounters(ptpClock);
        if(rtOpts->timingAclEnabled) {
            INFO("\n\n");
            INFO("** Timing message ACL:\n");
            dumpIpv4AccessList(ptpClock->netPath.timingAcl);
        }
        if(rtOpts->managementAclEnabled) {
            INFO("\n\n");
            INFO("** Management message ACL:\n");
            dumpIpv4AccessList(ptpClock->netPath.managementAcl);
        }
        if(rtOpts->clearCounters) {
            clearCounters(ptpClock);
            NOTIFY("PTP engine counters cleared\n");
        }
        sigusr2_received = 0;
    }

}
Exemplo n.º 3
0
void Machine::performTurnover()
{
    clearCounters();

    // find situations where the rotor on the right causes the rotor
    // on the left to turnover
    for (int i = rotorArray.count() - 1; i > 0; i--)
    {
        if (rotorArray.value(i+1)->checkForTurnover())
        {
            qDebug("1 - rotorname [%s] number [%d] turnover YES",
                   rotorArray.value(i)->getRotorName().toStdString().data(),
                   i);
            incCounter(i);
        }
    }

    // rotor double steps if its on its turnover position and
    // its not the first or last rotor.
    for (int i = 2; i < rotorArray.count(); i++)
    {
        qDebug("\t\t Double Step rotor [%d] name [%s]",
               i,
               rotorArray.value(i)->getRotorName().toStdString().data());
        if (rotorArray.value(i)->checkForTurnover() )
        {
            incCounter(i);
        }
    }

    // The right hand rotor ALWAYS turns one position
    qDebug("3 - rotor name [%s] number [%d] turnover YES",
           rotorArray.value(rotorArray.count())->getRotorName().toStdString().data(),
           rotorArray.count());
    incCounter(rotorArray.count()); // force a turnover on the right most rotor

    displayCounters(); // display debug information

    executeTurnovers(); // use the accumulated information to turnover the rotor(s)
}
void
PerformanceMonitorBase<T>::clearTimers ()
{
    clearCounters ();
}
Exemplo n.º 5
0
/*
 * Synchronous signal processing:
 * This function should be called regularly from the main loop
 */
void
checkSignals(RunTimeOpts * rtOpts, PtpClock * ptpClock)
{
	/*
	 * note:
	 * alarm signals are handled in a similar way in dep/timer.c
	 */

	if(sigint_received || sigterm_received){
		do_signal_close(ptpClock);
	}

	if(sighup_received){
		do_signal_sighup(rtOpts, ptpClock);
	sighup_received=0;
	}

	if(sigusr1_received){
	    if(ptpClock->portState == PTP_SLAVE){
		    WARNING("SIGUSR1 received, stepping clock to current known OFM\n");
                    stepClock(rtOpts, ptpClock);                                                                                                        
//		    ptpClock->clockControl.stepRequired = TRUE;
	    } else {
		    ERROR("SIGUSR1 received - will not step clock, not in PTP_SLAVE state\n");
	    }
	sigusr1_received = 0;
	}

	if(sigusr2_received){

/* testing only: testing step detection */
#if 0
		{
		ptpClock->addOffset ^= 1;
		INFO("a: %d\n", ptpClock->addOffset);
		sigusr2_received = 0;
		return;
		}
#endif
		displayCounters(ptpClock);
		if(rtOpts->timingAclEnabled) {
			INFO("\n\n");
			INFO("** Timing message ACL:\n");
			dumpIpv4AccessList(ptpClock->netPath.timingAcl);
		}
		if(rtOpts->managementAclEnabled) {
			INFO("\n\n");
			INFO("** Management message ACL:\n");
			dumpIpv4AccessList(ptpClock->netPath.managementAcl);
		}
		if(rtOpts->clearCounters) {
			clearCounters(ptpClock);
			NOTIFY("PTP engine counters cleared\n");
		}
#ifdef PTPD_STATISTICS
		if(rtOpts->oFilterSMConfig.enabled) {
			ptpClock->oFilterSM.display(&ptpClock->oFilterSM);
		}
		if(rtOpts->oFilterMSConfig.enabled) {
			ptpClock->oFilterMS.display(&ptpClock->oFilterMS);
		}
#endif /* PTPD_STATISTICS */
		sigusr2_received = 0;
	}

}