Example #1
0
static ImageHost::Bias
UpdateBias(const TimeStamp& aCompositionTime,
           const TimeStamp& aCompositedImageTime,
           const TimeStamp& aNextImageTime, // may be null
           ImageHost::Bias aBias)
{
  if (aCompositedImageTime.IsNull()) {
    return ImageHost::BIAS_NONE;
  }
  TimeDuration threshold = TimeDuration::FromMilliseconds(1.0);
  if (aCompositionTime - aCompositedImageTime < threshold &&
      aCompositionTime - aCompositedImageTime > -threshold) {
    // The chosen frame's time is very close to the composition time (probably
    // just before the current composition time, but due to previously set
    // negative bias, it could be just after the current composition time too).
    // If the inter-frame time is almost exactly equal to (a multiple of)
    // the inter-composition time, then we're in a dangerous situation because
    // jitter might cause frames to fall one side or the other of the
    // composition times, causing many frames to be skipped or duplicated.
    // Try to prevent that by adding a negative bias to the frame times during
    // the next composite; that should ensure the next frame's time is treated
    // as falling just before a composite time.
    return ImageHost::BIAS_NEGATIVE;
  }
  if (!aNextImageTime.IsNull() &&
      aNextImageTime - aCompositionTime < threshold &&
      aNextImageTime - aCompositionTime > -threshold) {
    // The next frame's time is very close to our composition time (probably
    // just after the current composition time, but due to previously set
    // positive bias, it could be just before the current composition time too).
    // We're in a dangerous situation because jitter might cause frames to
    // fall one side or the other of the composition times, causing many frames
    // to be skipped or duplicated.
    // Try to prevent that by adding a negative bias to the frame times during
    // the next composite; that should ensure the next frame's time is treated
    // as falling just before a composite time.
    return ImageHost::BIAS_POSITIVE;
  }
  return ImageHost::BIAS_NONE;
}
Example #2
0
int main()
{
  TimeStamp start;
  TimeStamp newTime;
  TimeStamp dt;
  start.now();
  while (1) {
    newTime.now();
    dt=newTime-start;
    std::cout << dt.getSec() << "sec " << dt.getUSec() << "usec\n";
    if (dt.getSec()>3) return 0;
  }
  return 1;
}
bool SybCTnewDAImpl::CheckCloseOpenedConnections(long lTimeout)
{
	StartTrace(SybCTnewDAImpl.CheckCloseOpenedConnections);
	bool bRet = false;
	Anything anyTimeStamp(coast::storage::Global());
	TimeStamp aStamp;
	aStamp -= lTimeout;
	Trace("current timeout " << lTimeout << "s, resulting time [" << aStamp.AsString() << "]");
	LockUnlockEntry me(fgStructureMutex);
	if ( fgInitialized ) {
		TraceAny(fgListOfSybCT, "current list of connections");
		if ( fgListOfSybCT.LookupPath(anyTimeStamp, "Open") && anyTimeStamp.GetSize() ) {
			SybCTnewDA *pSyb = NULL;
			long lTS = 0L;
			// if we still have open connections and the last access is older than lTimeout seconds
			while ( anyTimeStamp.GetSize() && ( aStamp > TimeStamp(anyTimeStamp.SlotName(lTS)) ) ) {
				Anything anyTS(coast::storage::Global());
				anyTS = anyTimeStamp[lTS];
				TraceAny(anyTS, "stamp of connections to close [" << anyTimeStamp.SlotName(0L) << "]");
				while ( anyTS.GetSize() ) {
					pSyb = SafeCast(anyTS[0L][0L].AsIFAObject(), SybCTnewDA);
					anyTS.Remove(0L);
					if ( pSyb != NULL ) {
						Trace("closing timeouted connection");
						if ( pSyb->Close() ) {
							bRet = true;
						}
					} else {
						SYSWARNING("Sybase connection with address " << (long)pSyb << " not valid anymore!");
					}
					fgListOfSybCT["Unused"].Append((IFAObject *)pSyb);
				}
				anyTimeStamp.Remove(lTS);
			}
		}
	} else {
		SYSERROR("SybCTnewDAImpl not initialized!");
	}
	return bRet;
}
Example #4
0
    coredata::dmcp::ModuleExitCodeMessage::ModuleExitCode Vehicle::body() {
        stringstream sstrConfiguration;
        getKeyValueConfiguration().writeTo(sstrConfiguration);

        // Use libodsimulation's odsimirus implementation.
        string config = sstrConfiguration.str();
        vehiclecontext::model::SimplifiedBicycleModel simplifiedBicycleModel(config);
        simplifiedBicycleModel.setup();

        // Use the most recent EgoState available.
        KeyValueDataStore &kvs = getKeyValueDataStore();

        TimeStamp previousTime;

        while (getModuleStateAndWaitForRemainingTimeInTimeslice() == coredata::dmcp::ModuleStateMessage::RUNNING) {
            // Get current VehicleControl.
            Container c = kvs.get(Container::VEHICLECONTROL);
            automotive::VehicleControl vc = c.getData<automotive::VehicleControl>();

            TimeStamp currentTime;
            const double timeStep = (currentTime.toMicroseconds() - previousTime.toMicroseconds()) / (1000.0 * 1000.0);

            // Calculate result and propagate it.
            vector<Container> toBeSent = simplifiedBicycleModel.calculate(vc, timeStep);
            if (toBeSent.size() > 0) {
                vector<Container>::iterator it = toBeSent.begin();
                while(it != toBeSent.end()) {
                    getConference().send(*it);
                    it++;
                    Thread::usleepFor(50);
                }
            }

            previousTime = currentTime;
        }

        simplifiedBicycleModel.tearDown();

        return coredata::dmcp::ModuleExitCodeMessage::OKAY;
    }
Example #5
0
/*
 * Check for data loss.
 * TODO(simon): move to the ola server
 */
bool DmxMonitor::CheckDataLoss() {
  if (m_last_data.IsSet()) {
    TimeStamp now;
    Clock clock;
    clock.CurrentTime(&now);
    TimeInterval diff = now - m_last_data;
    if (diff > TimeInterval(2, 5000000)) {
      // loss of data
      DrawDataLossWindow();
    }
  }
  return true;
}
Example #6
0
void CWriteLogClass::WriteLogToFile(const char* filename,const char* module,const char* info,const int status)
{
	TimeStamp ts;
	string mlog = ts.getTimeString(2).c_str() ;
	mlog += module;
	mlog += ",";
	mlog += info;
	mlog += ",";
	if (!status)
	{
		mlog += "³É¹¦";
	}
	else
	{
		mlog += "ʧ°Ü";
	}
	mlog += "\n";
	cout << mlog << endl;
	FILE * fp = fopen(filename,"a+");
	fwrite(mlog.c_str(),1,mlog.size(),fp);
	fclose(fp);
}
        void ClientModule::wait() {
            // Update liveliness.
            m_cycleCounter++;
            TimeStamp current;
            const float FREQ = getFrequency();
            const long TIME_CONSUMPTION_OF_CURRENT_SLICE = (current.toMicroseconds() - m_lastCycle.toMicroseconds()) - m_lastWaitTime;
            m_lastCycle = current;
            const long ONE_SECOND_IN_MICROSECONDS = 1000 * 1000 * 1;
            const long NOMINAL_DURATION_OF_ONE_SLICE = static_cast<long>((1.0f/FREQ) * ONE_SECOND_IN_MICROSECONDS);
            const long WAITING_TIME_OF_CURRENT_SLICE = NOMINAL_DURATION_OF_ONE_SLICE - TIME_CONSUMPTION_OF_CURRENT_SLICE;

            // Inform supercomponent about statistical runtime data.
            bool sendStatistics = false;
            if (FREQ < 1) {
                sendStatistics = true;
            }
            else {
				const int32_t CYCLES_PER_SECOND = static_cast<int32_t>(fabs(floor(FREQ + 0.5)));
                if ( (m_cycleCounter % CYCLES_PER_SECOND) == 0 ) {
                    sendStatistics = true;
                    m_cycleCounter = 0;
                }
            }

            if (sendStatistics) {
                RuntimeStatistic rts;
                rts.setSliceConsumption((float)TIME_CONSUMPTION_OF_CURRENT_SLICE/(float)NOMINAL_DURATION_OF_ONE_SLICE);
                m_dmcpClient->sendStatistics(rts);
            }

            if (WAITING_TIME_OF_CURRENT_SLICE > 0) {
                m_lastWaitTime = WAITING_TIME_OF_CURRENT_SLICE;
                Thread::usleep(WAITING_TIME_OF_CURRENT_SLICE);
            }
            else {
                m_lastWaitTime = 0;
            }
        }
void VectorPerformanceThread::run()
{
    TimeStamp timeStamp;
    TimeStamp timeStampLast;
    timeStampLast.getCurrent();
    int nSinceLastReport = 0;
    while(true) {
        if(delay>0.0) epicsThreadSleep(delay);
        {
            Lock lock(mutex);
            if(isDestroyed) {
                runReturned = true;
                return;
            }
        }
        timeStamp.getCurrent();
        double diff = TimeStamp::diff(timeStamp,timeStampLast);
        if(diff>=1.0) {
            cout << "thread" << threadNumber;
            cout << " value " << value;
            cout << " time " << diff;
            double iterations = nSinceLastReport;
            iterations /= diff;
            cout << " iterations/sec " << iterations;
            double elementSize = size;
            double elementsPerSecond = elementSize*nSinceLastReport;
            elementsPerSecond /= diff;
            elementsPerSecond /= 1e6;
            cout << " elements/sec " << elementsPerSecond << "million" << endl;
            cout.flush();
            timeStampLast = timeStamp;
            nSinceLastReport = 0;
        }
        ++nSinceLastReport;
        ++value;
        for(size_t i=0; i<size; ++i) vector[i] = value;
    }
}
Example #9
0
// aID is a sub-identifier (in particular a specific MediaStramTrack)
void AsyncLatencyLogger::WriteLog(LatencyLogIndex aIndex, uint64_t aID, int64_t aValue,
                                  TimeStamp aTimeStamp)
{
  if (aTimeStamp.IsNull()) {
    MOZ_LOG(GetLatencyLog(), LogLevel::Debug,
      ("Latency: %s,%" PRIu64 ",%" PRId64 ",%" PRId64,
       LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue));
  } else {
    MOZ_LOG(GetLatencyLog(), LogLevel::Debug,
      ("Latency: %s,%" PRIu64 ",%" PRId64 ",%" PRId64 ",%" PRId64,
       LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue,
       static_cast<int64_t>((aTimeStamp - gAsyncLogger->mStart).ToMilliseconds())));
  }
}
Example #10
0
/*PLONK_INLINE_LOW*/ bool TimeStamp::operator>= (TimeStamp const& other) const throw()
{
    plonk_assert (fractionIsValid (this->fraction));
    plonk_assert (fractionIsValid (other.fraction));
    
    if (this->isInfinite())
    {
        if (other.isInfinite())
            return false;
        else
            return true;
    }
    else return ((time > other.time) || ((time == other.time) && (fraction >= other.fraction)));
}
Example #11
0
// aID is a sub-identifier (in particular a specific MediaStramTrack)
void AsyncLatencyLogger::WriteLog(LatencyLogIndex aIndex, uint64_t aID, int64_t aValue,
                                  TimeStamp aTimeStamp)
{
  if (aTimeStamp.IsNull()) {
    PR_LOG(GetLatencyLog(), PR_LOG_DEBUG,
      ("Latency: %s,%llu,%lld,%lld",
       LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue));
  } else {
    PR_LOG(GetLatencyLog(), PR_LOG_DEBUG,
      ("Latency: %s,%llu,%lld,%lld,%lld",
       LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue,
       static_cast<int64_t>((aTimeStamp - gAsyncLogger->mStart).ToMilliseconds())));
  }
}
Example #12
0
void Canvas::Draw()
{
	if (_StyleModules.empty())
		return;
	preDraw();
	TimeStamp *timestamp = TimeStamp::instance();

	for (unsigned int i = 0; i < _StyleModules.size(); ++i) {
		_current_sm = _StyleModules[i];

		if (i < _Layers.size() && _Layers[i])
			delete _Layers[i];

		_Layers[i] = _StyleModules[i]->execute();
		if (!_Layers[i])
			continue;

		stroke_count += _Layers[i]->strokes_size();

		timestamp->increment();
	}
	postDraw();
}
Example #13
0
LightSpeed::StringA dateTimeToDB(const LightSpeed::JSON::INode &nd) {
	using namespace LightSpeed;
	if (nd.getType() == JSON::ndString) {
		ConstStrA str = nd.getStringUtf8();
		TextParser<char, SmallAlloc<256> > parser;
		if (parser(" NOW ",str)) {
			TimeStamp st = TimeStamp::now();
			return st.formatTime(dbDateTimeFormat);
		} else if (parser(" NOW %[-+]f1 ",str)) {
			float ofs = parser[1];
			TimeStamp st = TimeStamp::now() + TimeStamp(ofs);
			return st.formatTime(dbDateTimeFormat);
		}
		return nd.getStringUtf8();
	} else if (nd.getType() == JSON::ndFloat || nd.getType() == JSON::ndInt) {
		TimeStamp st(nd.getFloat());
		return st.formatTime(dbDateTimeFormat);
	} else if (nd.getType() == JSON::ndNull) {
		return "0000-00-00 00:00:00";
	}
	return "0000-00-00 00:00:00";

}
Example #14
0
/*
 * Makes n plots and times them.
 * Plot number k is called sink.
 * It is a plot of sin(kx) vs. x
 */
void timeplot(int n){
	double x[n*10];
	double y[n*10];
	StatVector stats(n);
	TimeStamp clk;
	for(int i=1; i <= n; i++){
		printf("\r%d", i);
		fflush(stdout);
		char name[30];
		sprintf(name, "sin%d", i);
		for(int j=0; j < n*10; j++){
			x[j] = 2*PI*i*j/(n*10.0);
			y[j] = sin(x[j]*i);
		}
		clk.tic();
		makeplot(x, y, 10*n, name);
		double cycles = clk.toc();
		stats.insert(cycles);
	}
	char banner[200];
	sprintf(banner, "cycle stats for %d plots", n);
	stats.print(banner);
	system("rm FIGS/sin*.pdf");
}
Example #15
0
int EndRun()
{
  RunEndTime = PrevSubEvtTime;
  FullTimes[ CurrRun ] = (RunEndTime - RunStartTime).GetSeconds();
  LiveTimes[ CurrRun ] = FullTimes[ CurrRun ] - MuonShadowTime.GetSeconds();
  MuonCounters[ CurrRun ] = MuonCounter;
  
  for( int det = 1; det <= 4; det++ )   {
    NSinglesUp[ CurrRun ][ det ]  = SinglesUpCounter[ det ];
    NSinglesLow[ CurrRun ][ det ] = SinglesLowCounter[ det ];
  }


  return 1;
}
Example #16
0
void DialogEditTime::on_buttonBox_accepted()
{
    // workaround for missing leading zero bug: prepend a "0", if it is missing
    QString tStr = ui->lineEdit->text();
    QStringList helper = tStr.split(":");
    if(helper.first().length() == 1){
        tStr.prepend("0");
    }
    // end of workaround

    QTime t = QTime::fromString(tStr);
    qDebug() << "zeit: " << t.toString();

	TimeStamp* ts =0;

	if(myRun){// ignore runns with Nullpointer
		if(myTimeType == TT_START){
			if(myRun->getStartTimeID() == 0){ // if no TS exists, create a new one
				ts = new TimeStamp(0, t, TimeStamp::E);
				MainWindow::competition()->addTimeStamp(ts);
				ts->setRunID(myRun->getID());
				myRun->setStartTimeID(ts->getID());
			}else{
				ts = MainWindow::competition()->getTimeStamp(myRun->getStartTimeID());
			}
        }else{ // goal
			if(myRun->getGoalTimeID() == 0){ // if no TS exists, create a new one
				ts = new TimeStamp(0, t, TimeStamp::E);
				MainWindow::competition()->addTimeStamp(ts);
				ts->setRunID(myRun->getID());
				myRun->setGoalTimeID(ts->getID());
			}else{
				ts = MainWindow::competition()->getTimeStamp(myRun->getGoalTimeID());
			}
		}

		// if new time != old time
		// compare strings, because of sub-0.01s differences, which should be ignored
		if(MainWindow::convertTimeToString(ts->getTime()) != MainWindow::convertTimeToString(t)){
			ts->setTime(t);
			ts->setSource(TimeStamp::E);
			emit timeEdited(myRun);
		}
	}
	hide();
}
Example #17
0
double time(double *a, double *b, int n, enum sumcopy_enum flag){
	const int count = 10;
	StatVector stats(count);
	TimeStamp clk;
	
	double bytes = 8.0*n;
	for(int i=0; i < count; i++){
		clk.tic();
		
		switch(flag){
		case SUM:
			sum(a, n);
			break;
		case SUMSTR:
			sumstride(a, n, STR);
			break;
		case SUMCONSTSTR:
			sumconststride(a, n);
			break;
		case COPY:
			copy(a, b, n);
			break;
		case COPYCONSTSTR:
			copyconststride(a, b, n);
			break;
		}
		double cycles = clk.toc();
		stats.insert(cycles);
	}

	if(flag == COPY || flag == COPYCONSTSTR)
		bytes *= 2;
	if (!(flag == SUM || flag == COPY))
		bytes /= STR;
	return bytes/stats.median();
}
void VideoFrameContainer::SetCurrentFrame(const gfxIntSize& aIntrinsicSize,
                                          Image* aImage,
                                          TimeStamp aTargetTime)
{
  MutexAutoLock lock(mMutex);

  if (aIntrinsicSize != mIntrinsicSize) {
    mIntrinsicSize = aIntrinsicSize;
    mIntrinsicSizeChanged = true;
  }

  gfxIntSize oldFrameSize = mImageContainer->GetCurrentSize();
  TimeStamp lastPaintTime = mImageContainer->GetPaintTime();
  if (!lastPaintTime.IsNull() && !mPaintTarget.IsNull()) {
    mPaintDelay = lastPaintTime - mPaintTarget;
  }

  // When using the OMX decoder, destruction of the current image can indirectly
  //  block on main thread I/O. If we let this happen while holding onto
  //  |mImageContainer|'s lock, then when the main thread then tries to
  //  composite it can then block on |mImageContainer|'s lock, causing a
  //  deadlock. We use this hack to defer the destruction of the current image
  //  until it is safe.
  nsRefPtr<Image> kungFuDeathGrip;
  kungFuDeathGrip = mImageContainer->LockCurrentImage();
  mImageContainer->UnlockCurrentImage();

  mImageContainer->SetCurrentImage(aImage);
  gfxIntSize newFrameSize = mImageContainer->GetCurrentSize();
  if (oldFrameSize != newFrameSize) {
    mImageSizeChanged = true;
    mNeedInvalidation = true;
  }

  mPaintTarget = aTargetTime;
}
Example #19
0
bool TimeToFileTime(TimeStamp& time, LPFILETIME pFileTime)
{
	SYSTEMTIME sysTime;
	time.getTime(sysTime);

	// convert system time to local file time
	FILETIME localTime;
	if (!SystemTimeToFileTime((LPSYSTEMTIME)&sysTime, &localTime))
		return false;

	// convert local file time to UTC file time
	if (!LocalFileTimeToFileTime(&localTime, pFileTime))
		return false;

	return true;
}
Example #20
0
void mozilla_sampler_responsiveness(const TimeStamp& aTime)
{
  if (!sLastTracerEvent.IsNull()) {
    if (sResponsivenessLoc == 100) {
      for(size_t i = 0; i < 100-1; i++) {
        sResponsivenessTimes[i] = sResponsivenessTimes[i+1];
      }
      sResponsivenessLoc--;
    }
    TimeDuration delta = aTime - sLastTracerEvent;
    sResponsivenessTimes[sResponsivenessLoc++] = delta.ToMilliseconds();
  }
  sCurrentEventGeneration++;

  sLastTracerEvent = aTime;
}
Example #21
0
Nullable<TimeDuration> DocumentTimeline::ToTimelineTime(
    const TimeStamp& aTimeStamp) const {
  Nullable<TimeDuration> result;  // Initializes to null
  if (aTimeStamp.IsNull()) {
    return result;
  }

  nsDOMNavigationTiming* timing = mDocument->GetNavigationTiming();
  if (MOZ_UNLIKELY(!timing)) {
    return result;
  }

  result.SetValue(aTimeStamp - timing->GetNavigationStartTimeStamp() -
                  mOriginTime);
  return result;
}
void
LayerManagerComposite::EndTransaction(const TimeStamp& aTimeStamp,
                                      EndTransactionFlags aFlags)
{
  NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
  NS_ASSERTION(!(aFlags & END_NO_COMPOSITE),
               "Shouldn't get END_NO_COMPOSITE here");
  mInTransaction = false;
  mRenderStartTime = TimeStamp::Now();

  if (!mIsCompositorReady) {
    return;
  }
  mIsCompositorReady = false;

#ifdef MOZ_LAYERS_HAVE_LOG
  MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
  Log();
#endif

  if (mDestroyed) {
    NS_WARNING("Call on destroyed layer manager");
    return;
  }

  // Set composition timestamp here because we need it in
  // ComputeEffectiveTransforms (so the correct video frame size is picked) and
  // also to compute invalid regions properly.
  mCompositor->SetCompositionTime(aTimeStamp);

  if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
    MOZ_ASSERT(!aTimeStamp.IsNull());
    UpdateAndRender();
    mCompositor->FlushPendingNotifyNotUsed();
  } else {
    // Modified the layer tree.
    mGeometryChanged = true;
  }

  mCompositor->ClearTargetContext();
  mTarget = nullptr;

#ifdef MOZ_LAYERS_HAVE_LOG
  Log();
  MOZ_LAYERS_LOG(("]----- EndTransaction"));
#endif
}
Example #23
0
TimeStamp TimeStamp::operator+ (TimeStamp const& other) const throw()
{
    if (this->isInfinite())
    {
        return *this;
    }
    else if (other.isInfinite())
    {
        return other;
    }
    else
    {
        TimeStamp result (this->time + other.time, this->fraction);
        result += other.fraction;
        return result;
    }
}
Example #24
0
NS_IMETHODIMP
nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval)
{
  JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));

  aRetval.setObject(*obj);

  TimeStamp procTime = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
  TimeStamp now = TimeStamp::Now();
  PRTime absNow = PR_Now();

  if (procTime.IsNull()) {
    bool error = false;

    procTime = TimeStamp::ProcessCreation(error);

    if (error) {
      Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS,
        StartupTimeline::PROCESS_CREATION);
    }

    StartupTimeline::Record(StartupTimeline::PROCESS_CREATION, procTime);
  }

  for (int i = StartupTimeline::PROCESS_CREATION;
       i < StartupTimeline::MAX_EVENT_ID;
       ++i)
  {
    StartupTimeline::Event ev = static_cast<StartupTimeline::Event>(i);
    TimeStamp stamp = StartupTimeline::Get(ev);

    if (stamp.IsNull() && (ev == StartupTimeline::MAIN)) {
      // Always define main to aid with bug 689256.
      stamp = procTime;
      MOZ_ASSERT(!stamp.IsNull());
      Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS,
        StartupTimeline::MAIN);
    }

    if (!stamp.IsNull()) {
      if (stamp >= procTime) {
        PRTime prStamp = ComputeAbsoluteTimestamp(absNow, now, stamp)
          / PR_USEC_PER_MSEC;
        JS::Rooted<JSObject*> date(aCx, JS::NewDateObject(aCx, JS::TimeClip(prStamp)));
        JS_DefineProperty(aCx, obj, StartupTimeline::Describe(ev), date, JSPROP_ENUMERATE);
      } else {
        Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, ev);
      }
    }
  }

  return NS_OK;
}
Example #25
0
int32 TimeStamp::compare( const TimeStamp &ts ) const
{
    if ( m_year < ts.m_year  ) return -1;
    if ( m_year > ts.m_year  ) return 1;

    if ( m_month < ts.m_month  ) return -1;
    if ( m_month > ts.m_month  ) return 1;

    if ( m_day < ts.m_day  ) return -1;
    if ( m_day > ts.m_day  ) return 1;

    if ( ts.m_timezone == m_timezone || ts.m_timezone == tz_NONE || m_timezone == tz_NONE )
    {
        if ( m_hour < ts.m_hour  ) return -1;
        if ( m_hour > ts.m_hour  ) return 1;

        if ( m_day < ts.m_day  ) return -1;
        if ( m_day > ts.m_day  ) return 1;
    }
    else {
        int16 hdisp=0, mdisp=0;
        int16 ts_hdisp=0, ts_mdisp=0;
        \

        getTZDisplacement( hdisp, mdisp );
        ts.getTZDisplacement( ts_hdisp, ts_mdisp );

        if ( m_hour + hdisp < ts.m_hour + ts_hdisp ) return -1;
        if ( m_hour + hdisp > ts.m_hour + ts_hdisp ) return 1;

        if ( m_day + mdisp < ts.m_day + ts_mdisp ) return -1;
        if ( m_day + mdisp > ts.m_day + ts_mdisp ) return 1;
    }

    if ( m_minute < ts.m_minute  ) return -1;
    if ( m_minute > ts.m_minute  ) return 1;

    if ( m_second < ts.m_second  ) return -1;
    if ( m_second > ts.m_second  ) return 1;

    if ( m_msec < ts.m_msec  ) return -1;
    if ( m_msec > ts.m_msec  ) return 1;

    return 0;
}
Example #26
0
bool
SpdyPushedStream3::IsOrphaned(TimeStamp now)
{
  MOZ_ASSERT(!now.IsNull());

  // if spdy is not transmitting, and is also not connected to a consumer
  // stream, and its been like that for too long then it is oprhaned

  if (mConsumerStream)
    return false;

  bool rv = ((now - mLastRead).ToSeconds() > 30.0);
  if (rv) {
    LOG3(("SpdyPushCache::IsOrphaned 0x%X IsOrphaned %3.2f\n",
          mStreamID, (now - mLastRead).ToSeconds()));
  }
  return rv;
}
Example #27
0
bool TimeStamp::operator> (TimeStamp const& other) const throw()
{
    plonk_assert (fractionIsValid (this->fraction));
    plonk_assert (fractionIsValid (other.fraction));
    
    if (this->isInfinite())
    {
        if (other.isInfinite())
            return false;
        else
            return true;
    }
    else if (time > other.time)
        return true;
    else if ((time == other.time) && (fraction > other.fraction))
        return true;
    else
        return false;    
}
void mozilla_sampler_responsiveness(TimeStamp aTime)
{
  if (!sLastTracerEvent.IsNull()) {
    if (sResponsivenessLoc == 100) {
      for(size_t i = 0; i < 100-1; i++) {
        sResponsivenessTimes[i] = sResponsivenessTimes[i+1];
      }
      sResponsivenessLoc--;
      //for(size_t i = 0; i < 100; i++) {
      //  sResponsivenessTimes[i] = 0;
      //}
      //sResponsivenessLoc = 0;
    }
    TimeDuration delta = aTime - sLastTracerEvent;
    sResponsivenessTimes[sResponsivenessLoc++] = delta.ToMilliseconds();
  }

  sLastTracerEvent = aTime;
}
Example #29
0
void TimeStamp::add( const TimeStamp &ts )
{
    m_day += ts.m_day;
    m_hour += ts.m_hour;
    m_minute += ts.m_minute;
    m_second += ts.m_second;
    m_msec += ts.m_msec;

    if ( m_timezone != ts.m_timezone && m_timezone != tz_NONE && ts.m_timezone != tz_NONE )
    {
        int16 hours=0, mins=0, ts_hours=0, ts_mins=0;
        ts.getTZDisplacement( ts_hours, ts_mins );
        getTZDisplacement( hours, mins );
        m_hour += hours - ts_hours;
        m_minute += hours - ts_mins;
    }

    rollOver();
    if ( m_timezone == tz_NONE )
        m_timezone = ts.m_timezone;
}
Example #30
0
bool
CompositorParent::SetTestSampleTime(LayerTransactionParent* aLayerTree,
                                    const TimeStamp& aTime)
{
  if (aTime.IsNull()) {
    return false;
  }

  mIsTesting = true;
  mTestTime = aTime;

  // Update but only if we were already scheduled to animate
  if (mCompositionManager && mCurrentCompositeTask) {
    AutoResolveRefLayers resolve(mCompositionManager);
    bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
    if (!requestNextFrame) {
      CancelCurrentCompositeTask();
    }
  }

  return true;
}