[ 
https://issues.apache.org/jira/browse/HTRACE-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15340478#comment-15340478
 ] 

Colin Patrick McCabe commented on HTRACE-376:
---------------------------------------------

Thanks for attaching HTRACE-376.002.patch.  I apologize that our review process 
still generally involves patch attachments.  We've been looking into using 
gerrit, but so far we haven't managed to get the ASF infrastructure set up to 
use it.

{code}
+      begin(System.currentTimeMillis(),System.nanoTime()).
+      end(0,0).
{code}
As I commented earlier in my review of patch 001, you cannot use 
{{System#nanoTime}} here.  It's wrong in a few different ways: it results in us 
fetching the time twice, and it fetches the monotonic clock rather than the 
wall clock.  HTrace spans are identified by the wall-clock, not the monotonic 
clock.  Please understand that the monotonic clock normally gets reset each 
time the machine is rebooted, and you cannot meaningfully compare monotonic 
clock times across different machines (except by duration).

According to Stack Overflow, there is no way to get the wall-clock time with a 
better granularity than milliseconds in JDK8 and earlier.  In JDK9, there are 
some functions in {{java.time}} which can do it.   It seems that you probably 
should use reflection to make use of those methods, if they exist in the 
current JDK.  (We are not ready to drop JDK8 support yet). See 
http://stackoverflow.com/questions/1712205/current-time-in-microseconds-in-java

> HTrace should support nanosecond time granularities
> ---------------------------------------------------
>
>                 Key: HTRACE-376
>                 URL: https://issues.apache.org/jira/browse/HTRACE-376
>             Project: HTrace
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.1.0
>            Reporter: Colin Patrick McCabe
>            Assignee: Pranavan
>         Attachments: HTRACE-376.001.patch, HTRACE-376.002.patch
>
>
> HTrace should support nanosecond time granularities.  Currently only a 
> granularity of milliseconds is supported.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to