4、analyze文件夹
1)analyze_global_innodb_dirty_page_ratio.sh脚本
- #! /bin/sh
- ###########################################################
- # Copyright (c) 2012, Heng.Wang. All rights reserved.
- #
- # This program is used to analyze the dirty pages ratio.
- ###########################################################
- # set -x
- # Get the key value of input arguments format like '--args=value'.
- get_key_value()
- {
- echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
- }
- # Usage will be helpful when you need to input the valid arguments.
- usage()
- {
- cat <<EOF
- Usage: $0 [configure-options]
- -?, --help Show this help message.
- --input=<> Set the input file path.
- --outputdir=<> Set the output directory.
- Note: this script is intended for internal use by developers.
- EOF
- }
- # Print the default value of the arguments of the script.
- print_default()
- {
- cat <<EOF
- The default value of the variables:
- input $INPUT
- outputdir $OUTPUTDIR
- EOF
- }
- # Parse the input arguments and get the value of the input argument.
- parse_options()
- {
- while test $# -gt 0
- do
- case "$1" in
- --input=*)
- INPUT=`get_key_value "$1"`;;
- --outputdir=*)
- OUTPUTDIR=`get_key_value "$1"`;;
- -? | --help)
- usage
- print_default
- exit 0;;
- *)
- echo "Unknown option '$1'"
- exit 1;;
- esac
- shift
- done
- }
- #################################################################
- INPUT=""
- OUTPUTDIR=/opt/result
- parse_options "$@"
- if [ -z $INPUT ]
- then
- echo "Please give the input file address!"
- exit -1
- fi
- if [ -f $INPUT ]
- then
- [[ -d $OUTPUTDIR ]] || mkdir -p $OUTPUTDIR
-
- dir1=`dirname $INPUT`
- dir2=`dirname $dir1`
-
- cat $INPUT | awk ' BEGIN { dt=-1;dr=-1;df=-1 } /Innodb_buffer_pool_pages_data/ \
- { if (dt==-1) { dt=$4} else { dt+=$4 } } /Innodb_buffer_pool_pages_dirty/ \
- { if (dr==-1) { dr=$4} else { dr+=$4 } } /Innodb_buffer_pool_pages_free/ \
- { if (df==-1) { df=$4} else { df+=$4 } ; print (100*dr)/(1+dt+df) } ' \
- >$OUTPUTDIR/dirty_page_ratio_${dir2##*/}_${dir1##*/}.result
- exit 0
- else
- echo "The input file is not exist!"
- echo "Please be double check the input file!"
- exit -1
- fi
2、analyze_global_innodb_page_flushed.sh脚本
- #! /bin/sh
- ###########################################################
- # Copyright (c) 2012, Heng.Wang. All rights reserved.
- #
- # This program is used to analyze the dirty pages ratio.
- ###########################################################
- # set -x
- # Get the key value of input arguments format like '--args=value'.
- get_key_value()
- {
- echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
- }
- # Usage will be helpful when you need to input the valid arguments.
- usage()
- {
- cat <<EOF
- Usage: $0 [configure-options]
- -?, --help Show this help message.
- --input=<> Set the input file path.
- --outputdir=<> Set the output directory.
- Note: this script is intended for internal use by developers.
- EOF
- }
- # Print the default value of the arguments of the script.
- print_default()
- {
- cat <<EOF
- The default value of the variables:
- input $INPUT
- outputdir $OUTPUTDIR
- EOF
- }
- # Parse the input arguments and get the value of the input argument.
- parse_options()
- {
- while test $# -gt 0
- do
- case "$1" in
- --input=*)
- INPUT=`get_key_value "$1"`;;
- --outputdir=*)
- OUTPUTDIR=`get_key_value "$1"`;;
- -? | --help)
- usage
- print_default
- exit 0;;
- *)
- echo "Unknown option '$1'"
- exit 1;;
- esac
- shift
- done
- }
- #################################################################
- INPUT=""
- OUTPUTDIR=/opt/result
- parse_options "$@"
- if [ -z $INPUT ]
- then
- echo "Please give the input file address!"
- exit -1
- fi
- if [ -f $INPUT ]
- then
- [[ -d $OUTPUTDIR ]] || mkdir -p $OUTPUTDIR
-
- dir1=`dirname $INPUT`
- dir2=`dirname $dir1`
-
- cat $INPUT | awk ' BEGIN { df=0 ; dl=0; } /Innodb_buffer_pool_pages_flushed[\s]/ \
- { df=$4 } /Innodb_buffer_pool_pages_LRU_flushed/ { dl=$4; print df,dl } ' \
- >$OUTPUTDIR/flushed_pages_${dir2##*/}_${dir1##*/}.result
- else
- echo "The input file is not exist!"
- echo "Please be double check the input file!"
- exit -1
- fi
3)analyze_innodb_checkpoint.sh脚本
- #! /bin/sh
- ###########################################################
- # Copyright (c) 2012, Heng.Wang. All rights reserved.
- #
- # This program is used to analyze the checkpoint.
- ###########################################################
- # set -x
- # Get the key value of input arguments format like '--args=value'.
- get_key_value()
- {
- echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
- }
- # Usage will be helpful when you need to input the valid arguments.
- usage()
- {
- cat <<EOF
- Usage: $0 [configure-options]
- -?, --help Show this help message.
- --input=<> Set the input file path.
- --outputdir=<> Set the output directory.
- Note: this script is intended for internal use by developers.
- EOF
- }
- # Print the default value of the arguments of the script.
- print_default()
- {
- cat <<EOF
- The default value of the variables:
- input $INPUT
- outputdir $OUTPUTDIR
- EOF
- }
- # Parse the input arguments and get the value of the input argument.
- parse_options()
- {
- while test $# -gt 0
- do
- case "$1" in
- --input=*)
- INPUT=`get_key_value "$1"`;;
- --outputdir=*)
- OUTPUTDIR=`get_key_value "$1"`;;
- -? | --help)
- usage
- print_default
- exit 0;;
- *)
- echo "Unknown option '$1'"
- exit 1;;
- esac
- shift
- done
- }
- #################################################################
- INPUT=""
- OUTPUTDIR=/opt/result
- parse_options "$@"
- if [ -z $INPUT ]
- then
- echo "Please give the input file address!"
- exit -1
- fi
- if [ -f $INPUT ]
- then
- [[ -d $OUTPUTDIR ]] || mkdir -p $OUTPUTDIR
-
- dir1=`dirname $INPUT`
- dir2=`dirname $dir1`
- cat $INPUT | awk ' BEGIN { } /Log sequence number/ {st=$4 } /Last checkpoint at/ \
- { ed=$4; print (st-ed)/1024/1024 } '>$OUTPUTDIR/checkpoint_${dir2##*/}_${dir1##*/}.result
- exit 0
- else
- echo "The input file is not exist!"
- echo "Please be double check the input file!"
- exit -1
- fi
4)analyze_innodb_log_flushed_fallbehind.sh脚本
- #! /bin/sh
- ###########################################################
- # Copyright (c) 2012, Heng.Wang. All rights reserved.
- #
- # This program is used to analyze the dirty pages ratio.
- ###########################################################
- # set -x
- # Get the key value of input arguments format like '--args=value'.
- get_key_value()
- {
- echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
- }
- # Usage will be helpful when you need to input the valid arguments.
- usage()
- {
- cat <<EOF
- Usage: $0 [configure-options]
- -?, --help Show this help message.
- --input=<> Set the input file path.
- --outputdir=<> Set the output directory.
- Note: this script is intended for internal use by developers.
- EOF
- }
- # Print the default value of the arguments of the script.
- print_default()
- {
- cat <<EOF
- The default value of the variables:
- input $INPUT
- outputdir $OUTPUTDIR
- EOF
- }
- # Parse the input arguments and get the value of the input argument.
- parse_options()
- {
- while test $# -gt 0
- do
- case "$1" in
- --input=*)
- INPUT=`get_key_value "$1"`;;
- --outputdir=*)
- OUTPUTDIR=`get_key_value "$1"`;;
- -? | --help)
- usage
- print_default
- exit 0;;
- *)
- echo "Unknown option '$1'"
- exit 1;;
- esac
- shift
- done
- }
- #################################################################
- INPUT=""
- OUTPUTDIR=/opt/result
- parse_options "$@"
- if [ -z $INPUT ]
- then
- echo "Please give the input file address!"
- exit -1
- fi
- if [ -f $INPUT ]
- then
- [[ -d $OUTPUTDIR ]] || mkdir -p $OUTPUTDIR
-
- dir1=`dirname $INPUT`
- dir2=`dirname $dir1`
-
- cat $INPUT | awk ' BEGIN { } /Log sequence number/ {st=$4 } /Log flushed up to/ \
- { ed=$5; print (st-ed) } ' > $OUTPUTDIR/log_flushed_fallbehind_${dir2##*/}_${dir1##*/}.result
- else
- echo "The input file is not exist!"
- echo "Please be double check the input file!"
- exit -1
- fi
5)analyze_sysbench_performance_args.sh脚本
- #! /bin/sh
- ###########################################################
- # Copyright (c) 2012, Heng.Wang. All rights reserved.
- #
- # This program is used to analyze the sysbench test report
- # and get the performance value of per second (transactions,
- # deadlocks, read/write requests and other operations).
- ###########################################################
- # set -x
- # Get the key value of input arguments format like '--args=value'.
- get_key_value()
- {
- echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
- }
- # Usage will be helpful when you need to input the valid arguments.
- usage()
- {
- cat <<EOF
- Usage: $0 [configure-options]
- -?, --help Show this help message.
- --input=<> Set the input file path.
- --outputdir=<> Set the output directory.
- Note: this script is intended for internal use by developers.
- EOF
- }
- # Print the default value of the arguments of the script.
- print_default()
- {
- cat <<EOF
- The default value of the variables:
- input $INPUT
- outputdir $OUTPUTDIR
- EOF
- }
- # Parse the input arguments and get the value of the input argument.
- parse_options()
- {
- while test $# -gt 0
- do
- case "$1" in
- --input=*)
- INPUT=`get_key_value "$1"`;;
- --outputdir=*)
- OUTPUTDIR=`get_key_value "$1"`;;
- -? | --help)
- usage
- print_default
- exit 0;;
- *)
- echo "Unknown option '$1'"
- exit 1;;
- esac
- shift
- done
- }
- #################################################################
- INPUT=""
- OUTPUTDIR=/opt/result
- parse_options "$@"
- if [ -z $INPUT ]
- then
- echo "Please give the input file address!"
- exit -1
- fi
- if [ -f $INPUT ]
- then
- [[ -d $OUTPUTDIR ]] || mkdir -p $OUTPUTDIR
-
- dir1=`dirname $INPUT`
- dir2=`dirname $dir1`
-
- cat $INPUT | awk ' BEGIN { ts=0 ; dl=0; rwq=0; oo=0; } /transactions/ \
- { ts=$3 } /deadlocks/ { dl=$3 } /read\/write requests/ { rwq=$4 } /other operations/ \
- { oo=$4; print substr(ts,2),substr(dl,2),substr(rwq,2),substr(oo,2) }' \
- >> $OUTPUTDIR/sysbench_perform_per_second_${dir2##*/}.result
- else
- echo "The input file is not exist!"
- echo "Please be double check the input file!"
- exit -1
- fi
6)analyze_sysbench_report脚本
- #! /bin/sh
- ###########################################################
- # Copyright (c) 2012, Heng.Wang. All rights reserved.
- #
- # This program is used to analyze the sysbench test report.
- ###########################################################
- # set -x
- # Get the key value of input arguments format like '--args=value'.
- get_key_value()
- {
- echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
- }
- # Usage will be helpful when you need to input the valid arguments.
- usage()
- {
- cat <<EOF
- Usage: $0 [configure-options]
- -?, --help Show this help message.
- --input=<> Set the input file path.
- --outputdir=<> Set the output directory.
- Note: this script is intended for internal use by developers.
- EOF
- }
- # Print the default value of the arguments of the script.
- print_default()
- {
- cat <<EOF
- The default value of the variables:
- input $INPUT
- outputdir $OUTPUTDIR
- EOF
- }
- # Parse the input arguments and get the value of the input argument.
- parse_options()
- {
- while test $# -gt 0
- do
- case "$1" in
- --input=*)
- INPUT=`get_key_value "$1"`;;
- --outputdir=*)
- OUTPUTDIR=`get_key_value "$1"`;;
- -? | --help)
- usage
- print_default
- exit 0;;
- *)
- echo "Unknown option '$1'"
- exit 1;;
- esac
- shift
- done
- }
- #################################################################
- INPUT=""
- OUTPUTDIR=/opt/result
- parse_options "$@"
- if [ -z $INPUT ]
- then
- echo "Please give the input file address!"
- exit -1
- fi
- if [ -f $INPUT ]
- then
- [[ -d $OUTPUTDIR ]] || mkdir -p $OUTPUTDIR
-
- dir1=`dirname $INPUT`
- dir2=`dirname $dir1`
-
- sed -n '/OLTP test statistics/,+30p' $INPUT > $OUTPUTDIR/sysbench_report_${dir2##*/}_${dir1##*/}.result
- else
- echo "The input file is not exist!"
- echo "Please be double check the input file!"
- exit -1
- fi
阅读(2686) | 评论(0) | 转发(0) |