Posted By

narkisr on 01/31/09


Tagged

Bash java btrace jps


Versions (?)

Runing btrace in a single command


 / Published in: Java
 

Running a btrace script takes two separate steps by default: 1. Running jps to get the Java process ID. 2. Running btrace on the ID. A simple awk script can merge the two into a single step.

  1. # instead of running
  2. $ jps
  3. 18904 Main
  4. 18951 SpringMain
  5. 19055 Jps
  6. $ btrace 18951 jdftm/ReflecTracer.class
  7.  
  8. # We issue (the traced application main class is SpringMain)
  9. $ jps | awk '/SpringMain/{system("btrace " $1 " jdftm/ReflecTracer.class")}'

Report this snippet  

You need to login to post a comment.