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

1  
sclass TimeCollector {
2  
  long count, totalNanos;
3  
  
4  
  void addNanos(long nanos) {
5  
    ++count;
6  
    totalNanos += nanos;
7  
  }
8  
  
9  
  toString {
10  
    ret count == 0 ? "Empty time collector"
11  
      : "Average time: " + formatElapsedTimeWithAppropriateUnit(nanosToSeconds(doubleRatio(totalNanos, count))) + " (n=" + count + ")";
12  
  }
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, 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: 239 / 531
Version history: 2 change(s)
Referenced in: [show references]