本文整理了Java中android.os.Trace.beginSection()
方法的一些代码示例,展示了Trace.beginSection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trace.beginSection()
方法的具体详情如下:
包路径:android.os.Trace
类名称:Trace
方法名:beginSection
暂无
代码示例来源:origin: facebook/litho
@Override
public void beginSection(String name) {
if (ComponentsConfiguration.IS_INTERNAL_BUILD
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Trace.beginSection(name);
}
}
代码示例来源:origin: facebook/litho
@Override
public void flush() {
Trace.beginSection(mName);
}
代码示例来源:origin: google/ExoPlayer
@TargetApi(18)
private static void beginSectionV18(String sectionName) {
android.os.Trace.beginSection(sectionName);
}
代码示例来源:origin: JakeWharton/hugo
private static void enterMethod(JoinPoint joinPoint) {
if (!enabled) return;
CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature();
Class<?> cls = codeSignature.getDeclaringType();
String methodName = codeSignature.getName();
String[] parameterNames = codeSignature.getParameterNames();
Object[] parameterValues = joinPoint.getArgs();
StringBuilder builder = new StringBuilder("\u21E2 ");
builder.append(methodName).append('(');
for (int i = 0; i < parameterValues.length; i++) {
if (i > 0) {
builder.append(", ");
}
builder.append(parameterNames[i]).append('=');
builder.append(Strings.toString(parameterValues[i]));
}
builder.append(')');
if (Looper.myLooper() != Looper.getMainLooper()) {
builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]");
}
Log.v(asTag(cls), builder.toString());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
final String section = builder.toString().substring(2);
Trace.beginSection(section);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
switch(appStep) {
case BeginFrame:
android.os.Trace.beginSection("Frame");
break;
case QueuedTasks:
android.os.Trace.beginSection("QueuedTask");
break;
case ProcessInput:
android.os.Trace.endSection();
android.os.Trace.beginSection("ProcessInput");
break;
case ProcessAudio:
android.os.Trace.endSection();
android.os.Trace.beginSection("ProcessAudio");
break;
case StateManagerUpdate:
android.os.Trace.endSection();
android.os.Trace.beginSection("StateManagerUpdate");
break;
case SpatialUpdate:
android.os.Trace.endSection();
android.os.Trace.beginSection("SpatialUpdate");
break;
case StateManagerRender:
android.os.Trace.endSection();
android.os.Trace.beginSection("StateManagerRender");
break;
case RenderFrame:
android.os.Trace.endSection();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void vpStep(VpStep vpStep, ViewPort vp, RenderQueue.Bucket bucket) {
if (androidApiLevel >= 18) {
switch (vpStep) {
case BeginRender:
android.os.Trace.beginSection("Render: " + vp.getName());
break;
case RenderScene:
android.os.Trace.beginSection("RenderScene: " + vp.getName());
break;
case PostQueue:
android.os.Trace.endSection();
android.os.Trace.beginSection("PostQueue: " + vp.getName());
break;
case FlushQueue:
android.os.Trace.endSection();
android.os.Trace.beginSection("FlushQueue: " + vp.getName());
break;
case PostFrame:
android.os.Trace.endSection();
android.os.Trace.beginSection("PostFrame: " + vp.getName());
break;
case EndRender:
android.os.Trace.endSection();
android.os.Trace.endSection();
break;
}
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void beginSection_tagIsNull_throwsNullPointerException() throws Exception {
try {
Trace.beginSection(null);
fail("Must throw");
} catch (NullPointerException e) {
// Must throw.
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void beginSection_tagIsTooLong_throwsIllegalArgumentException() throws Exception {
try {
Trace.beginSection(VERY_LONG_TAG_NAME);
fail("Must throw");
} catch (IllegalArgumentException e) {
// Must throw.
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void beginSection_tagIsNullAndCrashDisabled_doesNotThrow() throws Exception {
ShadowTrace.doNotUseSetCrashOnIncorrectUsage(false);
Trace.beginSection(null);
// Should not crash.
}
代码示例来源:origin: robolectric/robolectric
@Test
public void beginSection_calledTwice_addsBothSections() throws Exception {
Trace.beginSection("section1");
Trace.beginSection("section2");
assertThat(ShadowTrace.getCurrentSections()).containsExactly("section1", "section2");
assertThat(ShadowTrace.getPreviousSections()).isEmpty();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void beginSection_tagIsTooLongAndCrashDisabled_doesNotThrow() throws Exception {
ShadowTrace.doNotUseSetCrashOnIncorrectUsage(false);
Trace.beginSection(VERY_LONG_TAG_NAME);
// Should not crash.
}
代码示例来源:origin: robolectric/robolectric
@Test
public void endSection_twoSections_closesLastSection() throws Exception {
Trace.beginSection("section1");
Trace.beginSection("section2");
Trace.endSection();
assertThat(ShadowTrace.getCurrentSections()).containsExactly("section1");
assertThat(ShadowTrace.getPreviousSections()).containsExactly("section2");
}
代码示例来源:origin: robolectric/robolectric
@Test
public void endSection_twoSequentialSections_closesAllSections() throws Exception {
Trace.beginSection("section1");
Trace.endSection();
Trace.beginSection("section2");
Trace.endSection();
assertThat(ShadowTrace.getCurrentSections()).isEmpty();
assertThat(ShadowTrace.getPreviousSections()).containsExactly("section1", "section2");
}
代码示例来源:origin: robolectric/robolectric
@Test
public void reset_resetsInternalState() throws Exception {
Trace.beginSection("section1");
Trace.endSection();
Trace.beginSection("section2");
ShadowTrace.reset();
assertThat(ShadowTrace.getCurrentSections()).isEmpty();
assertThat(ShadowTrace.getPreviousSections()).isEmpty();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void endSection_twoRecursiveSectionsAndCalledTwice_closesAllSections() throws Exception {
Trace.beginSection("section1");
Trace.beginSection("section2");
Trace.endSection();
Trace.endSection();
assertThat(ShadowTrace.getCurrentSections()).isEmpty();
assertThat(ShadowTrace.getPreviousSections()).containsExactly("section2", "section1");
}
代码示例来源:origin: robolectric/robolectric
@Test
public void beginSection_calledOnce_addsSection() throws Exception {
Trace.beginSection("section1");
assertThat(ShadowTrace.getCurrentSections()).containsExactly("section1");
assertThat(ShadowTrace.getPreviousSections()).isEmpty();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void endSection_oneSectionButCalledTwice_doesNotThrow() throws Exception {
Trace.beginSection("section1");
Trace.endSection();
Trace.endSection();
// Should not crash.
}
代码示例来源:origin: robolectric/robolectric
@Test
public void endSection_oneSection_closesSection() throws Exception {
Trace.beginSection("section1");
Trace.endSection();
assertThat(ShadowTrace.getCurrentSections()).isEmpty();
assertThat(ShadowTrace.getPreviousSections()).containsExactly("section1");
}
代码示例来源:origin: halfhp/androidplot
public static void begin(final String sectionName) {
if(Build.VERSION.SDK_INT >= 18) {
Trace.beginSection(sectionName);
} else {
// TODO: alternate impl?
}
}
代码示例来源:origin: geniusgithub/AndroidDialer
@Override
public void onCreate(Bundle savedState) {
if (DEBUG) Log.d(TAG, "onCreate()");
Trace.beginSection(TAG + " onCreate");
super.onCreate(savedState);
mAnimationDuration = getResources().getInteger(R.integer.fade_duration);
Trace.endSection();
}
内容来源于网络,如有侵权,请联系作者删除!