diff options
| -rw-r--r-- | test/595-profile-saving/profile-saving.cc | 5 | ||||
| -rw-r--r-- | test/595-profile-saving/src/Main.java | 31 |
2 files changed, 6 insertions, 30 deletions
diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc index 00aa944726..ae3dad80d0 100644 --- a/test/595-profile-saving/profile-saving.cc +++ b/test/595-profile-saving/profile-saving.cc @@ -48,9 +48,8 @@ extern "C" JNIEXPORT void JNICALL Java_Main_ensureProfileProcessing(JNIEnv*, jcl ProfileSaver::ForceProcessProfiles(); } -extern "C" JNIEXPORT jboolean JNICALL Java_Main_profileHasMethod(JNIEnv* env, +extern "C" JNIEXPORT jboolean JNICALL Java_Main_presentInProfile(JNIEnv* env, jclass, - jboolean hot, jstring filename, jobject method) { ScopedUtfChars filename_chars(env, filename); @@ -59,7 +58,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_profileHasMethod(JNIEnv* env, ObjPtr<mirror::Executable> exec = soa.Decode<mirror::Executable>(method); ArtMethod* art_method = exec->GetArtMethod(); return ProfileSaver::HasSeenMethod(std::string(filename_chars.c_str()), - hot != JNI_FALSE, + /*hot*/ true, MethodReference(art_method->GetDexFile(), art_method->GetDexMethodIndex())); } diff --git a/test/595-profile-saving/src/Main.java b/test/595-profile-saving/src/Main.java index 197c4e74ff..18c0598bef 100644 --- a/test/595-profile-saving/src/Main.java +++ b/test/595-profile-saving/src/Main.java @@ -42,14 +42,6 @@ public class Main { System.out.println("Class loader does not match boot class"); } testAddMethodToProfile(file, bootMethod); - - // Test a sampled method that is only warm and not hot. - Method reflectMethod = Main.class.getDeclaredMethod("testReflectionInvoke"); - reflectMethod.invoke(null); - testSampledMethodInProfile(file, reflectMethod); - if (staticObj == null) { - throw new AssertionError("Object was not set"); - } } finally { if (file != null) { file.delete(); @@ -57,38 +49,23 @@ public class Main { } } - static Object staticObj = null; - - static void testReflectionInvoke() { - staticObj = new Object(); - } - static void testAddMethodToProfile(File file, Method m) { // Make sure we have a profile info for this method without the need to loop. ensureProfilingInfo(m); - // Make sure the profile gets processed. + // Make sure the profile gets saved. ensureProfileProcessing(); // Verify that the profile was saved and contains the method. - if (!profileHasMethod(true, file.getPath(), m)) { + if (!presentInProfile(file.getPath(), m)) { throw new RuntimeException("Method with index " + m + " not in the profile"); } } - static void testSampledMethodInProfile(File file, Method m) { - // Make sure the profile gets processed. - ensureProfileProcessing(); - // Verify that the profile was saved and contains the method. - if (!profileHasMethod(false, file.getPath(), m)) { - throw new RuntimeException("Method with index " + m + " not sampled in the profile"); - } - } - // Ensure a method has a profiling info. public static native void ensureProfilingInfo(Method method); // Ensures the profile saver does its usual processing. public static native void ensureProfileProcessing(); - // Checks if the profile saver has the method as a warm/sampled method. - public static native boolean profileHasMethod(boolean hot, String profile, Method method); + // Checks if the profiles saver knows about the method. + public static native boolean presentInProfile(String profile, Method method); private static final String TEMP_FILE_NAME_PREFIX = "dummy"; private static final String TEMP_FILE_NAME_SUFFIX = "-file"; |