Created attachment 21665 [details] Uses System.nanoTime() to achieve 1-ms resolution The timer, as implemented using System.currentTimeMillis() in JMeter 2.3.1's SampleResult class, provides approximately 10-ms resolution on Windows. I'd like to see 1-ms resolution.
Thanks for the patch. However, there are some problems with it: 2 public createTestSample() methods are deleted by the patch. Access to the static fields reference...Clock needs to be synchronized - or the fields need to be final. Also, the code requires Java 1.5; JMeter is currently targeted at 1.4, but this may change.
(In reply to comment #1) > 2 public createTestSample() methods are deleted by the patch. I removed them because I didn't find any callers, but I'll put them back since you prefer it. > Access to the static fields reference...Clock needs to be synchronized - or the > fields need to be final. Which would you prefer? > Also, the code requires Java 1.5; JMeter is currently targeted at 1.4, but this > may change. Would you prefer a patch that's conditional on the JVM version?
(In reply to comment #2) > (In reply to comment #1) > > 2 public createTestSample() methods are deleted by the patch. > > I removed them because I didn't find any callers, but I'll put them back since > you prefer it. Methods cannot be arbitrarily removed. > > Access to the static fields reference...Clock needs to be synchronized - or the > > fields need to be final. > > Which would you prefer? > Final is safer and likely cheaper. > > Also, the code requires Java 1.5; JMeter is currently targeted at 1.4, but this > > may change. > > Would you prefer a patch that's conditional on the JVM version? > Depends how convoluted it becomes.
Created attachment 21672 [details] Updated patch I think this new patch addresses your concerns.
Thanks, the new patch should allow the code to run on Java 1.4 or 1.5. However, it requires Java 1.5 to build. It would be better if the code also compiled on 1.4.
(In reply to comment #5) > It would be better if the code also compiled on 1.4. I took another step in that direction, but it got ugly quickly. I'm open to suggestions if you have a clean-ish way to do a conditional compile. My first attempt used Ant to copy a 1.4- or 1.5-compatible implementation to the source directory before the javac task.
Yes, it's not easy to do. The code needs to compile on 1.4 and run on 1.4+. I think the only way to do it is to use reflection to see if the method exists, and use it if so; if not, then revert to the default.
Created attachment 21702 [details] Patch using reflection (In reply to comment #7) > The code needs to compile on 1.4 and run on 1.4+. > > I think the only way to do it is to use reflection to see if the method exists, > and use it if so; if not, then revert to the default. Try this new patch using reflection.
Thanks a lot. The reflection patch looks fine; committed to SVN in r642469.
(In reply to comment #9) > Thanks a lot. You're welcome. Thanks for accepting it.
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2083