test-definitions/blob/master/auto-test/gprof/gprof.sh

#!/bin/sh

set -x

cd ../../utils
    . ./sys_info.sh
cd -

# 检查是否root 用户
if [ `whoami` != 'root' ] ; then
    echo "You must be the superuser to run this script" >&2
    exit 1
fi
安装gcc包
case $distro in
    "centos")
        yum install gcc -y
        print_info $? install-gcc
        ;;
    "ubuntu")
        apt-get install gcc -y
        print_info $? install-gcc
         ;;
esac
#所以这个gprof的tool就是在gcc编译的时候添加-pg 这个flag
gcc -g -pg gprof.c
print_info $? gcc-gprof.c
#运行c 函数
./a.out
print_info $? run-a.out
#输出c语言编译后的信息,主要用于优化c语言.
gprof a.out gmon.out > report.txt
print_info $? run-gprof

case $distro into
    "ubuntu")
        apt-get remove gcc -y
        print_info $? remove-gcc
        ;;
    "centos")
        yum remove gcc -y
        print_info $? remove-gcc
        ;;
esac

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值