diff --git a/DiSLProject2022/src-profiler/ex10/Instrumentation.java b/DiSLProject2022/src-profiler/ex10/Instrumentation.java index 58592d1..e01af2e 100644 --- a/DiSLProject2022/src-profiler/ex10/Instrumentation.java +++ b/DiSLProject2022/src-profiler/ex10/Instrumentation.java @@ -33,14 +33,12 @@ public class Instrumentation { try { final Class clazz = cls.loadClass(clazzName); final Set declaredMethods = Set.of(clazz.getDeclaredMethods()); - for (final Method m : declaredMethods) { - Profiler.registerDeclare(clazzName, m.toString()); - } for (final Method m : clazz.getMethods()) { if (declaredMethods.contains(m)) { - continue; + Profiler.registerDeclared(clazzName, m.toString()); + } else { + Profiler.registerInherited(clazzName, m.toString()); } - Profiler.registerInherited(clazzName, m.toString()); } } catch (final ClassNotFoundException e) { throw new RuntimeException(e); diff --git a/DiSLProject2022/src-profiler/ex10/Profiler.java b/DiSLProject2022/src-profiler/ex10/Profiler.java index d6d0675..a2c6d2f 100644 --- a/DiSLProject2022/src-profiler/ex10/Profiler.java +++ b/DiSLProject2022/src-profiler/ex10/Profiler.java @@ -41,7 +41,7 @@ public class Profiler { register(className, methodName, methodInvocations); } - public static void registerDeclare(final String className, final String methodName) { + public static void registerDeclared(final String className, final String methodName) { register(className, methodName, methodDeclarations); }