/******************************************************************* * Function Name: outputFunction ********************************************************************/ Model &Transducer2::outputFunction( const CollectMessage &msg ) { float time( msg.time().asMsecs() / timeUnit().asMsecs() ) ; sendOutput( msg.time(), throughput, procCount() / time ) ; cpuLoad ( cpuLoad() + static_cast< long >( ( msg.time() - lastChange() ).asMsecs() * unsolved().size() )) ; sendOutput( msg.time(), cpuUsage , cpuLoad() / msg.time().asMsecs() ) ; sendOutput( msg.time(), responsetime, (cpuLoad() / msg.time().asMsecs() ) / (procCount() / time) ); return *this ; }
/******************************************************************* * Function Name: initFunction ********************************************************************/ Model &Transducer2::initFunction() { procCount ( 0 ) ; cpuLoad ( 0 ); unsolved().erase( unsolved().begin(), unsolved().end() ) ; holdIn( AtomicState::active, frecuence() ) ; return *this ; }
/******************************************************************* * Function Name: externalFunction ********************************************************************/ Model &Transducer2::externalFunction( const ExternalMessage &msg ) { long id; union request req; cpuLoad ( cpuLoad() + static_cast< long >( ( msg.time() - lastChange() ).asMsecs() * unsolved().size() )); if( msg.port() == arrived ) { req = (union request) msg.value(); id = req.r.idtask * 100 + req.r.origin; if( unsolved().find( id ) != unsolved().end() ) { MException e( string("Unresolved Work Id: ") + (float) id + " is duplicated." ); e.addLocation( MEXCEPTION_LOCATION() ); throw e; } unsolved()[ id ] = msg.time() ; } if( msg.port() == solved ) { req = (union request) msg.value(); id = req.r.idtask * 100 + req.r.destino; Transducer2State::JobsList::iterator cursor( unsolved().find( id) ) ; if( cursor == unsolved().end() ) { MException e( string("Resolved Work Id: ") + (float) id + " Not Found!" ); e.addLocation( MEXCEPTION_LOCATION() ); throw e; } procCount( procCount() + 1 ); unsolved().erase( cursor ) ; } return *this ; }
void NaughtyProcessMonitor::slotTimeout() { uint cpu = cpuLoad(); emit(load(cpu)); if(cpu > d->triggerLevel_ * (d->interval_ / 1000)) { uint load; QValueList< ulong > l(pidList()); for(QValueList< ulong >::ConstIterator it(l.begin()); it != l.end(); ++it) if(getLoad(*it, load)) _process(*it, load); } d->timer_->start(d->interval_, true); }
bool Mixer::criticalXRuns() const { return cpuLoad() >= 99 && Engine::getSong()->isExporting() == false; }