Libraryless. Click here for Pure Java version (8106L/46K).
1 | static AutoCloseable profileThisThreadToConsole() { |
2 | int interval = 5000, firstInterval = 1000; |
3 | final Thread t = currentThread(); |
4 | ret timerAsAutocloseable(doEvery_daemon(interval, firstInterval, r { |
5 | print("\nStack trace."); |
6 | print(lines(asList(t.getStackTrace()))); |
7 | })); |
8 | } |
9 | |
10 | static <A> A profileThisThreadToConsole(IF0<A> f) { |
11 | if (f == null) null; |
12 | temp profileThisThreadToConsole(); |
13 | ret f!; |
14 | } |
15 | |
16 | svoid profileThisThreadToConsole(Runnable r) { |
17 | if (r == null) ret; |
18 | temp profileThisThreadToConsole(); |
19 | r.run(); |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017986 |
Snippet name: | profileThisThreadToConsole - prints stack trace every 5 seconds. also posts stack traces when thread sleeps |
Eternal ID of this version: | #1017986/7 |
Text MD5: | d0ee9a02dc08eb1aa5393359be8c3c4d |
Transpilation MD5: | 625808531ef7f304230f0e50e465afa3 |
Author: | stefan |
Category: | javax / profiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-26 02:15:22 |
Source code size: | 550 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 357 / 456 |
Version history: | 6 change(s) |
Referenced in: | [show references] |