本文整理汇总了C++中ThreadProfile::flush方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadProfile::flush方法的具体用法?C++ ThreadProfile::flush怎么用?C++ ThreadProfile::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadProfile
的用法示例。
在下文中一共展示了ThreadProfile::flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tick
void TableTicker::Tick(TickSample* sample)
{
// Marker(s) come before the sample
ProfileStack* stack = mPrimaryThreadProfile.GetStack();
for (int i = 0; stack->getMarker(i) != NULL; i++) {
mPrimaryThreadProfile.addTag(ProfileEntry('m', stack->getMarker(i)));
}
stack->mQueueClearMarker = true;
bool recordSample = true;
if (mJankOnly) {
// if we are on a different event we can discard any temporary samples
// we've kept around
if (sLastSampledEventGeneration != sCurrentEventGeneration) {
// XXX: we also probably want to add an entry to the profile to help
// distinguish which samples are part of the same event. That, or record
// the event generation in each sample
mPrimaryThreadProfile.erase();
}
sLastSampledEventGeneration = sCurrentEventGeneration;
recordSample = false;
// only record the events when we have a we haven't seen a tracer event for 100ms
if (!sLastTracerEvent.IsNull()) {
TimeDuration delta = sample->timestamp - sLastTracerEvent;
if (delta.ToMilliseconds() > 100.0) {
recordSample = true;
}
}
}
#if defined(USE_BACKTRACE) || defined(USE_NS_STACKWALK) || defined(USE_LIBUNWIND)
if (mUseStackWalk) {
doBacktrace(mPrimaryThreadProfile, sample);
} else {
doSampleStackTrace(stack, mPrimaryThreadProfile, sample);
}
#else
doSampleStackTrace(stack, mPrimaryThreadProfile, sample);
#endif
if (recordSample)
mPrimaryThreadProfile.flush();
if (!sLastTracerEvent.IsNull() && sample) {
TimeDuration delta = sample->timestamp - sLastTracerEvent;
mPrimaryThreadProfile.addTag(ProfileEntry('r', delta.ToMilliseconds()));
}
if (sample) {
TimeDuration delta = sample->timestamp - mStartTime;
mPrimaryThreadProfile.addTag(ProfileEntry('t', delta.ToMilliseconds()));
}
if (sLastFrameNumber != sFrameNumber) {
mPrimaryThreadProfile.addTag(ProfileEntry('f', sFrameNumber));
sLastFrameNumber = sFrameNumber;
}
}