cloudstack-dev mailing list archives

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

    https://github.com/apache/cloudstack/pull/509#discussion_r33019962
  
    --- 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 --
    
    Yes, and so does the semantics of the return of starts() stop() and getDuration().
    I checked; the first two are never cought in a variable but the last one is used in output
and to check against settings. There the semantics really changes. It now returns higher numbers
then axpected.


---
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