Libraryless. Click here for Pure Java version (4520L/25K).
1 | static <A> WithSideValue<FunctionResourceUse, A> evaluateWithResourceUse(IF0<A> f) {
|
2 | long time1 = nanoTime(); |
3 | long value1 = bytesAllocatedByCurrentThread(); |
4 | A a = f?!; |
5 | long value2 = bytesAllocatedByCurrentThread(); |
6 | long time2 = nanoTime(); |
7 | ret withSideValue(FunctionResourceUse() |
8 | .bytesAllocated(value1 < 0 ? -1 : value2-value1) |
9 | .runtime(nanosToSecondsObject(time2-time1)), a); |
10 | } |
Began life as a copy of #1033099
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033107 |
| Snippet name: | evaluateWithResourceUse |
| Eternal ID of this version: | #1033107/3 |
| Text MD5: | 3296206dad697089e987a1cd73371384 |
| Transpilation MD5: | e7b14618c4b4fb8ca5fbc795c928b51b |
| Author: | stefan |
| Category: | javax / monitoring |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-14 16:44:36 |
| Source code size: | 408 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 439 / 606 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |