org.quickperf.annotation.ExpectMaxExecutionTime Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*
* Copyright 2019-2020 the original author or authors.
*/
package org.quickperf.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* The ExpectMaxExecutionTime
annotation measures the execution time of the test method.
*
*
* Example:
*
* @ExpectMaxExecutionTime(seconds = 2)
* public void executeLongAPIcall() {
* ...
* }
*
*
* QuickPerf will give the following feedback on the console: [QUICK PERF] Execution time of the test method: 5 s 289
* ms (5 289 245 600 ns)
*
*
*
Note:
* Be cautious with time measurement results. It is a rough and first level result. Data has no meaning below the
* ~second/millisecond. JIT warm-up, GC, or safe
* points can impact the measure and its reproducibility. We recommend JMH
* to do more in-depth experiments.
*
* @see MeasureExecutionTime
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface ExpectMaxExecutionTime {
int hours() default 0;
int minutes() default 0;
int seconds() default 0;
int milliSeconds() default 0;
}