Wednesday, September 7, 2016

Generate FlameGraph for your java projects

1) Clone the lightweight-java-profiler: git clone https://github.com/dcapwell/lightweight-java-profiler.git

2) Go to it : cd lightweight-java-profiler/

3) Compile it: make all

4) Add this to the VM Options : -agentpath:/space/projects/lightweight-java-profiler/build-64/liblagent.so


5) Click Ok..Start the process...Send some requests.. close/terminate the application...traces.txt will be produced after terminating the project..See the below picture ..It is there..At the bottom..That file contains all cpu- measurements about the requests that you have sent (Actually not only the requests, everthing is recorded from the beginning of the time).


Now we need something to display this data..

It is the FlameGraph : https://github.com/brendangregg/FlameGraph

6) Get the FlameGraph : git clone https://github.com/brendangregg/FlameGraph.git

7) Execute the following command under the FlameGraph directory $: ./stackcollapse-ljp.awk < /pathToThe_traces_file/traces.txt | ./flamegraph.pl > traces.svg

8) Open the travces.svg with firefox

firefox travces.svg

9) Press Enter

10) bye




No comments:

Post a Comment