Measure Java Code Execution Time
with a Single Annotation
Track code execution time in Java effortlessly. Get a full call hierarchy with timing & arguments — no heavy tracing frameworks required.
Performance Tracking,
Without the Pain
Full method timing with call hierarchy & argument details — without the weight of a distributed tracing framework.
One Annotation
Replace 6 lines of timestamp boilerplate with @TimerNinjaTracker. That's it.
Visual Call Tree + Args
See nested method calls as a clear, indented hierarchy — with full argument values. Instantly pinpoint what was called and with which data.
Block Tracking
Measure arbitrary code blocks with TimerNinjaBlock.measure() — no need to extract separate methods.
Smart Thresholds
Only surface slow operations. Set a threshold and Timer Ninja filters the noise automatically.
Zero Dependencies
Just AspectJ + SLF4J. No framework lock-in. Works with Spring Boot, plain Java, or anything in between.
No Heavy Frameworks
Skip the complexity of OpenTelemetry, Zipkin, or Micrometer. Timer Ninja gives you actionable timing insights with zero infrastructure overhead.
Stop Timing Methods
The Hard Way
See how Timer Ninja eliminates manual timestamp boilerplate.
long before = System.currentTimeMillis();
doSomethingInteresting();
long after = System.currentTimeMillis();
System.out.println(
"Execution time (ms): " + (after - before)
);
@TimerNinjaTracker
public String doSomethingInteresting() {
// Your business logic — that's it!
}
Beautiful Trace Output
Timer Ninja prints a visual call tree showing the full execution hierarchy, timing, and arguments.
Heavy Tracing Frameworks
Are Overkill
Most apps don't need distributed tracing infrastructure just to answer “why is this method slow?”
- Install collector agent & backend (Jaeger/Zipkin)
- Add SDK + multiple dependencies
- Configure exporters, samplers, propagators
- Manually create spans with
TracerAPI - Deploy & manage a separate tracing dashboard
- Instrument each method individually
- Arguments & context? Write custom attributes by hand
- One dependency — add to Gradle or Maven
- One annotation —
@TimerNinjaTracker - Auto call hierarchy — nested tree, zero config
- Arguments included —
includeArgs = true - Threshold alerts — only see what's slow
- No infrastructure — output goes to your existing logs
- Works immediately — no dashboards to deploy
Get Started in 60 Seconds
Four simple steps to start tracking method execution time.
Add the Dependency
Add Timer Ninja from Maven Central to your project.
implementation 'io.github.thanglequoc:timer-ninja:1.3.0'
aspect 'io.github.thanglequoc:timer-ninja:1.3.0'
<dependency>
<groupId>io.github.thanglequoc</groupId>
<artifactId>timer-ninja</artifactId>
<version>1.3.0</version>
</dependency>
Add AspectJ Plugin
Enable AspectJ compilation so annotations get woven.
plugins {
id "io.freefair.aspectj.post-compile-weaving" version '9.1.0'
}
<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14.1</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>io.github.thanglequoc</groupId>
<artifactId>timer-ninja</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
</plugin>
Annotate Your Methods
Place @TimerNinjaTracker on any method or constructor.
@TimerNinjaTracker
public void processPayment(User user, int amount) {
// Your business logic
}
Run & See the Trace 🐇
Execute your code — Timer Ninja automatically logs the execution trace.
Note: Timer Ninja uses SLF4J. Spring Boot projects work out of the box. For other projects without a logging provider, enable console output with TimerNinjaConfiguration.getInstance().toggleSystemOutLog(true).
public void processPayment(User user, int amount) - 770 ms
|-- public boolean changeAmount(User user, int amount) - 306 ms
|-- public void notify(User user) - 258 ms
Ready to track them all?
Block tracking, custom thresholds, constructor tracking, and more — explore all features in the docs and start measuring Java method execution time the smart way.