@Override public boolean isBenchmarkMethod(Method method) { return method.isAnnotationPresent(Benchmark.class) || BenchmarkMethods.isTimeMethod(method); }
@Override public boolean isBenchmarkMethod(Method method) { return method.isAnnotationPresent(Benchmark.class) || BenchmarkMethods.isTimeMethod(method); }
@Override public boolean isBenchmarkMethod(Method method) { return method.isAnnotationPresent(Benchmark.class) || BenchmarkMethods.isTimeMethod(method) || method.isAnnotationPresent(Macrobenchmark.class); }
@Override public boolean isBenchmarkMethod(Method method) { return method.isAnnotationPresent(Benchmark.class) || BenchmarkMethods.isTimeMethod(method) || method.isAnnotationPresent(Macrobenchmark.class); }
/** * For instruments that use {@link #isTimeMethod} to identify their methods, this method checks * the {@link Method} appropriately. */ static Method checkTimeMethod(Method timeMethod) throws InvalidBenchmarkException { checkArgument(isTimeMethod(timeMethod)); Class<?>[] parameterTypes = timeMethod.getParameterTypes(); if (!Arrays.equals(parameterTypes, new Class<?>[] {int.class}) && !Arrays.equals(parameterTypes, new Class<?>[] {long.class})) { throw new InvalidBenchmarkException( "Microbenchmark methods must accept a single int parameter: " + timeMethod.getName()); } // Static technically doesn't hurt anything, but it's just the completely wrong idea if (Util.isStatic(timeMethod)) { throw new InvalidBenchmarkException( "Microbenchmark methods must not be static: " + timeMethod.getName()); } return timeMethod; } }
/** * For instruments that use {@link #isTimeMethod} to identify their methods, this method checks * the {@link Method} appropriately. */ static Method checkTimeMethod(Method timeMethod) throws InvalidBenchmarkException { checkArgument(isTimeMethod(timeMethod)); Class<?>[] parameterTypes = timeMethod.getParameterTypes(); if (!Arrays.equals(parameterTypes, new Class<?>[] {int.class}) && !Arrays.equals(parameterTypes, new Class<?>[] {long.class})) { throw new InvalidBenchmarkException( "Microbenchmark methods must accept a single int parameter: " + timeMethod.getName()); } // Static technically doesn't hurt anything, but it's just the completely wrong idea if (Util.isStatic(timeMethod)) { throw new InvalidBenchmarkException( "Microbenchmark methods must not be static: " + timeMethod.getName()); } return timeMethod; } }