FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
JVM timing options
NewsProgramming Languages

JVM timing options

via Dev.toNicolas Fränkel1mo ago

For as long as I have been coding in Java, we have had requirements to measure the execution time of blocks of code. While the current good practice is to use OpenTelemetry's traces, not every company has reached this stage yet. Plus, some of the alternatives are OpenTelemetry-compatible. Let's see them in order. The basic option The basic option is what we have been doing for ages, and what the other options rely on anyway. It's based on the following API: System.currentTimeMillis() . Usage is pretty straightforward: long start = System . currentTimeMillis (); // Execute code long end = System . currentTimeMillis (); System . out . println ( "Code executed in " + ( end - start ) + " milliseconds" ); The Object-Oriented alternative If you are an OOP developer, then you'd rather encapsulate state. Here's a draft of such encapsulation: class Timer { private long startTime ; public void start () { startTime = System . currentTimeMillis (); } public long stop () { return System . currentTi

Continue reading on Dev.to

Opens in a new tab

Read Full Article
19 views

Related Articles

FedEx chooses partnerships over proprietary tech for its automation strategy
News

FedEx chooses partnerships over proprietary tech for its automation strategy

TechCrunch • 20h ago

News

Software You Can Love 2026 tickets are on sale

Lobsters • 20h ago

The Subprime Technical Debt Crisis
News

The Subprime Technical Debt Crisis

Lobsters • 21h ago

“It Worked on My Machine” — Until It Reached Production
News

“It Worked on My Machine” — Until It Reached Production

Medium Programming • 21h ago

The best way to protect your phone from a warrantless search in 2026
News

The best way to protect your phone from a warrantless search in 2026

ZDNet • 21h ago

Discover More Articles