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

20
LINES

< > BotCompany Repo | #1035050 // SingleThreadProfiler

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

Transpiled version (11177L) is out of date.

sclass SingleThreadProfiler extends AbstractProfiler {
  // config
  settable Thread threadToSample = currentThread();
  
  toString {
    ret threadToSample == null
      ? shortClassName(this)
      : "Profiler for " + threadToSample;
  }

  void stepImpl() {
    samples++;
    StackTraceElement[] stackTrace = threadToSample.getStackTrace();
    if (skipSleeping && !isThreadRunnable_x(stackTrace)) ret;
    lock lock;
    addSample(stackTrace);
  }
  
  @Override void assertCanStart { assertNotNull(+threadToSample); }
}

Author comment

Began life as a copy of #1011686

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035050
Snippet name: SingleThreadProfiler
Eternal ID of this version: #1035050/18
Text MD5: f8670064be9d5c1668ea8dae53f8b462
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-30 11:59:49
Source code size: 545 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 181 / 325
Version history: 17 change(s)
Referenced in: [show references]