コード例 #1
0
ファイル: transduc2.cpp プロジェクト: melkyades/cdpp
/*******************************************************************
* 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 ;
}
コード例 #2
0
ファイル: transduc2.cpp プロジェクト: melkyades/cdpp
/*******************************************************************
* Function Name: initFunction
********************************************************************/
Model &Transducer2::initFunction()
{
	procCount ( 0 ) ;
	cpuLoad ( 0 );
	unsolved().erase( unsolved().begin(), unsolved().end() ) ;
	holdIn( AtomicState::active, frecuence() ) ;
	return *this ;
}
コード例 #3
0
ファイル: transduc2.cpp プロジェクト: melkyades/cdpp
/*******************************************************************
* 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 ;
}
コード例 #4
0
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);
}
コード例 #5
0
ファイル: Mixer.cpp プロジェクト: Israel-/lmms
bool Mixer::criticalXRuns() const
{
	return cpuLoad() >= 99 && Engine::getSong()->isExporting() == false;
}