代码拉取完成,页面将自动刷新
#! /bin/bash
# ڴؽű
function perf_Mem_bw () {
if dmidecode -t processor | grep -qE 'Kunpeng|1620' ;then
CPU0_Die0_BW_R="hisi_sccl1_ddrc0/flux_rd/,hisi_sccl1_ddrc1/flux_rd/,hisi_sccl1_ddrc2/flux_rd/,hisi_sccl1_ddrc3/flux_rd/"
CPU0_Die0_BW_W="hisi_sccl1_ddrc0/flux_wr/,hisi_sccl1_ddrc1/flux_wr/,hisi_sccl1_ddrc2/flux_wr/,hisi_sccl1_ddrc3/flux_wr/"
CPU0_Die1_BW_R="hisi_sccl3_ddrc0/flux_rd/,hisi_sccl3_ddrc1/flux_rd/,hisi_sccl3_ddrc2/flux_rd/,hisi_sccl3_ddrc3/flux_rd/"
CPU0_Die1_BW_W="hisi_sccl3_ddrc0/flux_wr/,hisi_sccl3_ddrc1/flux_wr/,hisi_sccl3_ddrc2/flux_wr/,hisi_sccl3_ddrc3/flux_wr/"
CPU1_Die0_BW_R="hisi_sccl5_ddrc0/flux_rd/,hisi_sccl5_ddrc1/flux_rd/,hisi_sccl5_ddrc2/flux_rd/,hisi_sccl5_ddrc3/flux_rd/"
CPU1_Die0_BW_W="hisi_sccl5_ddrc0/flux_wr/,hisi_sccl5_ddrc1/flux_wr/,hisi_sccl5_ddrc2/flux_wr/,hisi_sccl5_ddrc3/flux_wr/"
CPU1_Die1_BW_R="hisi_sccl7_ddrc0/flux_rd/,hisi_sccl7_ddrc1/flux_rd/,hisi_sccl7_ddrc2/flux_rd/,hisi_sccl7_ddrc3/flux_rd/"
CPU1_Die1_BW_W="hisi_sccl7_ddrc0/flux_wr/,hisi_sccl7_ddrc1/flux_wr/,hisi_sccl7_ddrc2/flux_wr/,hisi_sccl7_ddrc3/flux_wr/"
ifdie1=`perf list|grep hisi_sccl1_ddrc0`
if [ -z "$ifdie1" ]
then
BW_Events="$CPU0_Die1_BW_R,$CPU0_Die1_BW_W,$CPU1_Die1_BW_R,$CPU1_Die1_BW_W"
else
BW_Events="$CPU0_Die0_BW_R,$CPU0_Die0_BW_W,$CPU0_Die1_BW_R,$CPU0_Die1_BW_W,$CPU1_Die0_BW_R,$CPU1_Die0_BW_W,$CPU1_Die1_BW_R,$CPU1_Die1_BW_W"
fi
else
echo "not support"
exit
fi
let interval=1000;
timeout $1 perf stat -x ',' -a -I $interval -e $BW_Events 2>&1| \
awk -F, '
BEGIN {
tpre=-1;
first=1;
}
{
idx_failed = index($0, "failed")
if (idx_failed > 0)
{
printf("failed\n");
}
else {
tcurr=$1;
if(first==1)
{
tpre=tcurr;
first=0;
}
if (tcurr!=tpre)
{
printf("cpu0_Die0:%8.2f MB|cpu0_Die1:%8.2f MB|cpu1_Die0:%8.2f MB|cpu1_Die1:%8.2f MB\n",(CPU0_Die0_R+CPU0_Die0_W)*32/1024/1024,(CPU0_Die1_R+CPU0_Die1_W)*32/1024/1024,(CPU1_Die0_R+CPU1_Die0_W)*32/1024/1024,(CPU1_Die1_R+CPU1_Die1_W)*32/1024/1024);
CPU0_Die0_R=0;
CPU0_Die0_W=0;
CPU0_Die1_R=0;
CPU0_Die1_W=0;
CPU1_Die0_R=0;
CPU1_Die0_W=0;
CPU1_Die1_R=0;
CPU1_Die1_W=0;
tpre=tcurr;
}
switch ($4)
{
case /sccl1.*rd/:
CPU0_Die0_R += $2;
break;
case /sccl1.*wr/:
CPU0_Die0_W += $2;
break;
case /sccl3.*rd/:
CPU0_Die1_R += $2;
break;
case /sccl3.*wr/:
CPU0_Die1_W += $2;
break;
case /sccl5.*rd/:
CPU1_Die0_R += $2;
break;
case /sccl5.*wr/:
CPU1_Die0_W += $2;
break;
case /sccl7.*rd/:
CPU1_Die1_R += $2;
break;
case /sccl7.*wr/:
CPU1_Die1_W += $2;
break;
}
}
}
'
}
perf_Mem_bw 100
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。