本文整理匯總了Java中jdk.vm.ci.meta.ProfilingInfo.getTypeProfile方法的典型用法代碼示例。如果您正苦於以下問題:Java ProfilingInfo.getTypeProfile方法的具體用法?Java ProfilingInfo.getTypeProfile怎麽用?Java ProfilingInfo.getTypeProfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jdk.vm.ci.meta.ProfilingInfo
的用法示例。
在下文中一共展示了ProfilingInfo.getTypeProfile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTypeProfile
import jdk.vm.ci.meta.ProfilingInfo; //導入方法依賴的package包/類
private void testTypeProfile(String testSnippet, int bci) {
ResolvedJavaType stringType = getMetaAccess().lookupJavaType(String.class);
ResolvedJavaType stringBuilderType = getMetaAccess().lookupJavaType(StringBuilder.class);
ProfilingInfo info = profile(testSnippet, "ABC");
JavaTypeProfile typeProfile = info.getTypeProfile(bci);
Assert.assertEquals(0.0, typeProfile.getNotRecordedProbability(), DELTA);
Assert.assertEquals(1, typeProfile.getTypes().length);
Assert.assertEquals(stringType, typeProfile.getTypes()[0].getType());
Assert.assertEquals(1.0, typeProfile.getTypes()[0].getProbability(), DELTA);
continueProfiling(testSnippet, new StringBuilder());
typeProfile = info.getTypeProfile(bci);
Assert.assertEquals(0.0, typeProfile.getNotRecordedProbability(), DELTA);
Assert.assertEquals(2, typeProfile.getTypes().length);
Assert.assertEquals(stringType, typeProfile.getTypes()[0].getType());
Assert.assertEquals(stringBuilderType, typeProfile.getTypes()[1].getType());
Assert.assertEquals(0.5, typeProfile.getTypes()[0].getProbability(), DELTA);
Assert.assertEquals(0.5, typeProfile.getTypes()[1].getProbability(), DELTA);
resetProfile(testSnippet);
typeProfile = info.getTypeProfile(bci);
Assert.assertNull(typeProfile);
}