Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1028993 - TimeCollector

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (107L/1K).

sclass TimeCollector {
  long count, totalNanos;
  
  void addNanos(long nanos) {
    ++count;
    totalNanos += nanos;
  }
  
  toString {
    ret count == 0 ? "Empty time collector"
      : "Average time: " + formatElapsedTimeWithAppropriateUnit(nanosToSeconds(doubleRatio(totalNanos, count))) + " (n=" + count + ")";
  }
}

download  show line numbers  debug dex   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028993
Snippet name: TimeCollector
Eternal ID of this version: #1028993/3
Text MD5: 68a7c6f64cf68ec70e2b42c908f3c6f8
Transpilation MD5: e2f554e16c7ff621e6398c0755f8556f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-16 18:03:15
Source code size: 337 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 42 / 136
Version history: 2 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1028993 & http://1028993.tinybrain.de