Home | History | Annotate | Download | only in tools
      1 #!/bin/bash
      2 #
      3 # Copyright 2015 the V8 project authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 # Convenience Script used to rank GC NVP output.
      8 
      9 print_usage_and_die() {
     10   echo "Usage: $0 new-gen-rank|old-gen-rank max|avg logfile"
     11   exit 1
     12 }
     13 
     14 if [ $# -ne 3 ]; then
     15   print_usage_and_die
     16 fi
     17 
     18 case $1 in
     19   new-gen-rank|old-gen-rank)
     20     OP=$1
     21     ;;
     22   *)
     23     print_usage_and_die
     24 esac
     25 
     26 case $2 in 
     27   max|avg)
     28     RANK_MODE=$2
     29     ;;
     30   *)
     31     print_usage_and_die
     32 esac
     33 
     34 LOGFILE=$3
     35 
     36 GENERAL_INTERESTING_KEYS="\
     37   pause \
     38 "
     39 
     40 INTERESTING_NEW_GEN_KEYS="\
     41   ${GENERAL_INTERESTING_KEYS} \
     42   scavenge \
     43   weak \
     44   roots \
     45   old_new \
     46   code \
     47   semispace \
     48   object_groups \
     49 "
     50 
     51 INTERESTING_OLD_GEN_KEYS="\
     52   ${GENERAL_INTERESTING_KEYS} \
     53   external \
     54   clear \
     55   clear.code_flush \
     56   clear.dependent_code \
     57   clear.global_handles \
     58   clear.maps \
     59   clear.slots_buffer \
     60   clear.store_buffer \
     61   clear.string_table \
     62   clear.weak_cells \
     63   clear.weak_collections \
     64   clear.weak_lists \
     65   finish \
     66   evacuate \
     67   evacuate.candidates \
     68   evacuate.clean_up \
     69   evacuate.new_space \
     70   evacuate.update_pointers \
     71   evacuate.update_pointers.between_evacuated \
     72   evacuate.update_pointers.to_evacuated \
     73   evacuate.update_pointers.to_new \
     74   evacuate.update_pointers.weak \
     75   mark \
     76   mark.finish_incremental \
     77   mark.prepare_code_flush \
     78   mark.roots \
     79   mark.weak_closure \
     80   sweep \
     81   sweep.code \
     82   sweep.map \
     83   sweep.old \
     84   incremental_finalize \
     85 "
     86 
     87 BASE_DIR=$(dirname $0)
     88 
     89 case $OP in
     90   new-gen-rank)
     91     cat $LOGFILE | grep "gc=s" \
     92       | $BASE_DIR/eval_gc_nvp.py \
     93       --no-histogram \
     94       --rank $RANK_MODE \
     95       ${INTERESTING_NEW_GEN_KEYS}
     96     ;;
     97   old-gen-rank)
     98     cat $LOGFILE | grep "gc=ms" | grep "reduce_memory=0" | grep -v "steps=0" \
     99       | $BASE_DIR/eval_gc_nvp.py \
    100       --no-histogram \
    101       --rank $RANK_MODE \
    102       ${INTERESTING_OLD_GEN_KEYS}
    103     ;;
    104   *)
    105     ;;
    106 esac
    107 
    108