void AddBreakpointRegularlyDialog::validate() {
	MainWindow& mwParent = dynamic_cast<MainWindow&>(parent);

	qint64 fromTimeMSecs = getMSecs(fromTime), toTimeMSecs = getMSecs(toTime),
	       everyTimeMSecs = getMSecs(everyTime);

	std::vector<qint64> breakpoints{};

	for(qint64 breakpointPos = fromTimeMSecs; breakpointPos <= toTimeMSecs;
	    breakpointPos += everyTimeMSecs) {
		breakpoints.push_back(breakpointPos);
	}

	mwParent.addProjectBreakpoints(breakpoints);

	done(0);
}
예제 #2
0
void Stopwatch::clientRegistered(QJsonObject msg, int id)
{
    QJsonObject ret;
    ret.insert("set",getMSecs());
    if(running)
        ret.insert("start",true);
    else
        ret.insert("stop",true);
    sendMsg(ret,id,true);
}
예제 #3
0
void Stopwatch::stop(bool notify)
{
    snaped = getMSecs();
    running = false;

    if(notify){
        QJsonObject ret;
        ret.insert("stop",true);
        sendMsg(ret,true);
    }

    timer.stop();
}
static void timer_latency(NPP instance, uint32_t timerID) {
    BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin);

    obj->mTimerLatencyCurrentCount += 1;

    uint32_t now = getMSecs();
    uint32_t interval = now - obj->mPrevTime;
    uint32_t dur = now - obj->mStartTime;
    uint32_t expectedDur = obj->mTimerLatencyCurrentCount * TIMER_INTERVAL;
    int32_t drift = dur - expectedDur;
    int32_t avgDrift = drift / obj->mTimerLatencyCurrentCount;

    obj->mPrevTime = now;

    gLogI.log(kDebug_ANPLogType,
              "-------- latency test: [%3d] interval %d expected %d, total %d expected %d, drift %d avg %d\n",
              obj->mTimerLatencyCurrentCount, interval, TIMER_INTERVAL, dur,
              expectedDur, drift, avgDrift);

    if (--obj->mTimerLatencyCount == 0) {
        browser->unscheduletimer(instance, timerID);
    }
}
void BackgroundPlugin::test_timers() {
    NPP instance = this->inst();

    //Setup the testing counters
    mTimerRepeatCount = 5;
    mTimerLatencyCount = 5;

    // test for bogus timerID
    browser->unscheduletimer(instance, 999999);
    // test one-shot
    browser->scheduletimer(instance, 100, false, timer_oneshot);
    // test repeat
    browser->scheduletimer(instance, 50, true, timer_repeat);
    // test timer latency
    browser->scheduletimer(instance, TIMER_INTERVAL, true, timer_latency);
    mStartTime = mPrevTime = getMSecs();
    // test unschedule immediately
    uint32_t id = browser->scheduletimer(instance, 100, false, timer_neverfires);
    browser->unscheduletimer(instance, id);
    // test double unschedule (should be no-op)
    browser->unscheduletimer(instance, id);

}
예제 #6
0
void Stopwatch::sendTimeSync()
{
    QJsonObject ret;
    ret.insert("set",getMSecs());
    sendMsg(ret,true);
}