Skip to content

Instantly share code, notes, and snippets.

@alexandrnikitin
Last active October 2, 2018 11:33
Show Gist options
  • Select an option

  • Save alexandrnikitin/c1f409c0db55de83cda7cb48d464a154 to your computer and use it in GitHub Desktop.

Select an option

Save alexandrnikitin/c1f409c0db55de83cda7cb48d464a154 to your computer and use it in GitHub Desktop.

Revisions

  1. alexandrnikitin revised this gist Oct 2, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions flamegraphs.sh
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,8 @@ make
    cd ~
    git clone https://github.com/brendangregg/FlameGraph.git


    # for jvm PID only
    export JAVA_HOME=/opt/jdk1.8.0_91
    export FLAMEGRAPH_DIR=~/FlameGraph/
    export PERF_RECORD_SECONDS=60
  2. alexandrnikitin revised this gist Oct 2, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions flamegraphs.sh
    Original file line number Diff line number Diff line change
    @@ -20,13 +20,13 @@ ps ax | grep java
    ./perf-map-agent/bin/perf-java-flames <PID> -F 99 -a -g


    # with kernel
    # with kernel stackframes
    ps ax | grep java
    export JAVA_HOME=/opt/jdk1.8.0_91
    ./create-java-perf-map.sh <PID>
    ./perf-map-agent/bin/create-java-perf-map.sh <PID>

    perf record -F 99 -a -g -- sleep 60
    perf script > out.perf

    ./stackcollapse-perf.pl out.perf > out.folded
    ./flamegraph.pl out.folded > out.svg
    ./FlameGraph/stackcollapse-perf.pl out.perf > out.folded
    ./FlameGraph/flamegraph.pl out.folded > out.svg
  3. alexandrnikitin revised this gist Oct 2, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions flamegraphs.sh
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,7 @@ ps ax | grep java

    # with kernel
    ps ax | grep java
    export JAVA_HOME=/opt/jdk1.8.0_91
    ./create-java-perf-map.sh <PID>

    perf record -F 99 -a -g -- sleep 60
  4. alexandrnikitin revised this gist Oct 2, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion flamegraphs.sh
    Original file line number Diff line number Diff line change
    @@ -17,11 +17,15 @@ export JAVA_HOME=/opt/jdk1.8.0_91
    export FLAMEGRAPH_DIR=~/FlameGraph/
    export PERF_RECORD_SECONDS=60
    ps ax | grep java
    # spot the PID
    ./perf-map-agent/bin/perf-java-flames <PID> -F 99 -a -g


    # with kernel
    ps ax | grep java
    ./create-java-perf-map.sh <PID>

    perf record -F 99 -a -g -- sleep 60
    perf script > out.perf

    ./stackcollapse-perf.pl out.perf > out.folded
    ./flamegraph.pl out.folded > out.svg
  5. alexandrnikitin revised this gist Oct 2, 2018. 1 changed file with 12 additions and 5 deletions.
    17 changes: 12 additions & 5 deletions flamegraphs.sh
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,27 @@
    yum install git perf cmake gcc gcc-c++


    # generates method mappings
    cd ~
    git clone https://github.com/jrudolph/perf-map-agent.git
    cd perf-map-agent/
    export JAVA_HOME=/opt/jdk1.8.0_91
    cmake .
    make

    cd ~
    git clone https://github.com/brendangregg/FlameGraph.git

    # add -XX:+PreserveFramePointer to java exec cmd

    cd ~
    git clone https://github.com/brendangregg/FlameGraph.git

    export JAVA_HOME=/opt/jdk1.8.0_91
    export FLAMEGRAPH_DIR=~/FlameGraph/
    export PERF_RECORD_SECONDS=60
    ps ax | grep java
    # spot the PID
    ./perf-map-agent/bin/perf-java-flames <PID> -F 99 -a -g


    # with kernel
    perf record -F 99 -a -g -- sleep 60
    perf script > out.perf
    ./stackcollapse-perf.pl out.perf > out.folded
    ./flamegraph.pl out.folded > out.svg
  6. alexandrnikitin created this gist Sep 24, 2018.
    20 changes: 20 additions & 0 deletions flamegraphs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    yum install git perf cmake gcc gcc-c++

    git clone https://github.com/jrudolph/perf-map-agent.git
    cd perf-map-agent/
    export JAVA_HOME=/opt/jdk1.8.0_91
    cmake .
    make

    cd ~
    git clone https://github.com/brendangregg/FlameGraph.git

    # add -XX:+PreserveFramePointer to java exec cmd

    export JAVA_HOME=/opt/jdk1.8.0_91
    export FLAMEGRAPH_DIR=~/FlameGraph/
    export PERF_RECORD_SECONDS=60
    ps ax | grep java
    # spot the PID
    ./perf-map-agent/bin/perf-java-flames <PID> -F 99 -a -g