Libraryless. Click here for Pure Java version (8106L/46K).
static AutoCloseable profileThisThreadToConsole() { int interval = 5000, firstInterval = 1000; final Thread t = currentThread(); ret timerAsAutocloseable(doEvery_daemon(interval, firstInterval, r { print("\nStack trace."); print(lines(asList(t.getStackTrace()))); })); } static <A> A profileThisThreadToConsole(IF0<A> f) { if (f == null) null; temp profileThisThreadToConsole(); ret f!; } svoid profileThisThreadToConsole(Runnable r) { if (r == null) ret; temp profileThisThreadToConsole(); r.run(); }
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: | 581 / 729 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |