Exemplo n.º 1
0
void Stopwatch::notifyStop(const std::string& option, const std::string& stopWatchName) {
	StopWatchOptions::iterator option_it = options.find(option);
	if (option_it == options.end())
		return;

	StopwatchItems::iterator sw_it = (*option_it).second.find(stopWatchName);
	if (sw_it == (*option_it).second.end()) // could happen if option got enabled just now
		return;

	notifyStop((*sw_it).second, option, stopWatchName);
}
Exemplo n.º 2
0
void PUParticleSystem3D::forceStopParticleSystem()
{
    if (_render)
        _render->notifyStop();

    for (auto &it : _observers){
        it->notifyStop();
    }

    for (auto& it : _emitters) {
        auto emitter = static_cast<PUEmitter*>(it);
        emitter->notifyStop();
    }

    for (auto& it : _affectors) {
        auto affector = static_cast<PUAffector*>(it);
        affector->notifyStop();
    }
    unscheduleUpdate();
    unPrepared();
}
Exemplo n.º 3
0
void Stopwatch::notifyStop(StopwatchItem& stopwatchItem, const std::string& option, const std::string& stopWatchName) {
	if (stopwatchItem.option != option || stopwatchItem.name != stopWatchName) {
		notifyStop(option, stopWatchName);
		return;
	}

	stopwatchItem.stop    = getCurrentMicroTime();
	stopwatchItem.isValid = true;

	// update the statistics of the item
	stopwatchItem.n++;
	Millisecond value = Millisecond(stopwatchItem.stop - stopwatchItem.start);

	stopwatchItem.min = std::min(stopwatchItem.min, value);
	stopwatchItem.max = std::max(stopwatchItem.max, value);

	// update the mean iteratively
	// c(n) = c(n-1) + (x_n - c(n-1))/n
	stopwatchItem.mean += (value - stopwatchItem.mean) / (double)stopwatchItem.n;

	stopwatchItem.lastValue = value;
}
Exemplo n.º 4
0
void Processor::setScheduledState(ScheduledState state) {
  state_ = state;
  if (state == STOPPED) {
    notifyStop();
  }
}