cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wilderrodrigues <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Replace System.currentTimeMillis() by Sys...
Date Tue, 23 Jun 2015 08:19:49 GMT
Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/509#discussion_r33018851
  
    --- Diff: utils/src/com/cloud/utils/Profiler.java ---
    @@ -23,24 +23,20 @@
         private Long startTickInMs;
         private Long stopTickInMs;
     
    -    public Profiler() {
    -        startTickInMs = null;
    -        stopTickInMs = null;
    -    }
    -
         public long start() {
    -        startTickInMs = System.currentTimeMillis();
    +        startTickInMs = System.nanoTime();
             return startTickInMs.longValue();
         }
     
         public long stop() {
    -        stopTickInMs = System.currentTimeMillis();
    +        stopTickInMs = System.nanoTime();
             return stopTickInMs.longValue();
         }
     
         public long getDuration() {
    -        if (startTickInMs != null && stopTickInMs != null)
    +        if (startTickInMs != null && stopTickInMs != null) {
                 return stopTickInMs.longValue() - startTickInMs.longValue();
    --- End diff --
    
    I did... and it doesn't change. Only the resolution does,
    
    Quick googled that one here for you: https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks
    
    Implementation is still the same:
    
    ![image](https://cloud.githubusercontent.com/assets/5129209/8301764/54ac5202-1991-11e5-9522-2567af5454b7.png)
    
    http://stackoverflow.com/questions/351565/system-currenttimemillis-vs-system-nanotime
    
    Cheers,
    Wilder


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message