buddyinfo 内存碎片数据采集
不说了,上工具
#cat buddyinfo.sh
#!/bin/sh
BC_MUTI(){
#subtraction
if [[ -n $1 && -n $2 ]];then
res1=$(printf "%.2f" `echo "scale=2;($1*$2)"|bc`)
echo $res1
fi
}
MESG(){
local GROUP="$1"
local KEY=$2
local VALUE=$3
local MEASURE=$4
if [[ -n $VALUE ]];then
echo -e "$(date "+%F %H:%M:%S"),$GROUP,$KEY,$VALUE,$MEASURE" >> $REAL_LOG
return 0
fi
}
BC_BUDDY(){
aa=$1
bb=$2
let "res1=$aa*2**$bb"
echo $res1
}
CONVERT_BUDDY_VALUE(){
start=$1
MAX=`cat /proc/buddyinfo | grep "Normal"| awk -F"Normal" '{print $2}'|awk '{print NF}'`
MAX=`echo "$MAX - 1" | bc`
buddy_values=`cat /proc/buddyinfo | grep "Normal"| awk -F"Normal" '{print $2}'`
array2=(
$buddy_values
)
bb=`echo ${array2[@]:$start:$MAX}`
count=0
final_vvv=0
for value in ${bb[@]};do
vvv=`BC_BUDDY $value $count`
count=`echo "$count +1 "|bc`
final_vvv=`echo "$final_vvv + $vvv"|bc`
done
echo $final_vvv
}
LOOP_VMSTAT(){
while [[ 0 == 0 ]] ;do
sleep 1
CALCULATE_VMSTAT
done
}
CALCULATE_VMSTAT(){
timestamp=$(date "+%Y-%m-%d-%H:%M:%S")
order1=`CONVERT_BUDDY_VALUE 1`
order2=`CONVERT_BUDDY_VALUE 2`
order3=`CONVERT_BUDDY_VALUE 3`
order4=`CONVERT_BUDDY_VALUE 4`
order5=`CONVERT_BUDDY_VALUE 5`
order6=`CONVERT_BUDDY_VALUE 6`
order7=`CONVERT_BUDDY_VALUE 7`
order8=`CONVERT_BUDDY_VALUE 8`
order9=`CONVERT_BUDDY_VALUE 9`
order10=`CONVERT_BUDDY_VALUE 10`
printf "%-20s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s\n" $timestamp $order1 $order2 $order3 $order4 $order5 $order6 $order7 $order8 $order9 $order10
}
main(){
printf "%-20s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s\n" "timestamp" "order1" "order2" "order3" "order4" "order5" "order6" "order7" "order8" "order9" "order10"
LOOP_VMSTAT
}
main
[root@host /home/ahao.mah]
#sh buddyinfo.sh
timestamp order1 order2 order3 order4 order5 order6 order7 order8 order9 order10
2017-04-26-20:53:20 9952240 4975948 2487866 1243711 621496 309892 154207 76867 38313 19124
2017-04-26-20:53:22 9952309 4975928 2487861 1243712 621496 309892 154207 76867 38313 19124
2017-04-26-20:53:23 9952392 4975970 2487869 1243713 621496 309892 154207 76867 38313 19124
2017-04-26-20:53:24 9952429 4975992 2487877 1243713 621496 309892 154207 76867 38313 19124
2017-04-26-20:53:26 9952449 4975993 2487879 1243713 621496 309892 154207 76867 38313 19124
2017-04-26-20:53:27 9952485 4975998 2487880 1243713 621496 309892 154207 76867 38313 19124
2017-04-26-20:53:28 9952490 4976003 2487883 1243715 621497 309892 154207 76867 38313 19124
2017-04-26-20:53:29 9952475 4975996 2487882 1243716 621498 309892 154207 76867 38313 19124
2017-04-26-20:53:31 9952404 4975956 2487881 1243716 621498 309892 154207 76867 38313 19124
2017-04-26-20:53:32 9952494 4975998 2487886 1243716 621498 309892 154207 76867 38313 19124

buddyinfo 内存碎片数据采集的更多相关文章
- 关于linux 内存碎片指数
linux针对每一个node的每个zone的每个order,都有一个碎片指数来描述当前的碎片程度,也就是 extfrag_index 参数: extfrag_index这个要展示出来,需要内核编译了两 ...
- Atitit.每月数据采集与备份 v4
Atitit.每月数据采集与备份 v4 备份检查表 r12 00cate 00item im Inputmethod ok ok Log Log ok cyar Cyar log ... ok c ...
- C#工业物联网和集成系统解决方案的技术路线(数据源、数据采集、数据上传与接收、ActiveMQ、Mongodb、WebApi、手机App)
目 录 工业物联网和集成系统解决方案的技术路线... 1 前言... 1 第一章 系统架构... 3 1.1 硬件构架图... 3 1.2 ...
- Atitit.数据检索与网络爬虫与数据采集的原理概论
Atitit.数据检索与网络爬虫与数据采集的原理概论 1. 信息检索1 1.1. <信息检索导论>((美)曼宁...)[简介_书评_在线阅读] - dangdang.html1 1.2. ...
- 现场打印智能无线PDA安卓POS 条码识别、打印、数据采集销售开单收银管理软件
现场打印安卓POS 条码识别.打印.数据采集管理软件 案例: 经营日化品牌,从事小型超市和日用品商店的批发配送业务. 公司以前的销售模式:三个业务员负责跑市场,每个人负责一个区域,平均每天每个人要去到 ...
- 大家都在用PDA条码扫描枪管理企业仓库 PDA无线数据采集程序
PDA数据采集器又称之为手持终端,这些都是用于扫描货物条码统计数据用的,PDA扫描枪有效提高企业仓库管理,在仓库管理中引入条码技术,对仓库的到货检验.入库.出库.调拨.移库移位.库存盘点等各个作业环节 ...
- Python网络数据采集系列-------概述
这是一个正在准备中的系列文章,主要参考的是<Web Scraping with Python_Collecting Data from the Modern Web-O'Reilly(2015) ...
- 【数据采集】VBA数据采集可用 COM 组件
windows 中提供了4个COM组件都可以进行数据采集. Wininet WinHttp XmlHttp MSHTML https://msdn.microsoft.com/en-us/librar ...
- Flume NG安装部署及数据采集测试
转载请注明出处:http://www.cnblogs.com/xiaodf/ Flume作为日志收集工具,监控一个文件目录或者一个文件,当有新数据加入时,采集新数据发送给消息队列等. 1 安装部署Fl ...
随机推荐
- 字体大小之px、em、rem、pt,字号详解
PX px像素(Pixel).相对长度单位.像素px是相对于显示器屏幕分辨率而言的. 是一个虚拟长度单位,是计算机系统的数字化图像长度单位,如果px要换算成物理长度,需要指定精度DPI(Dots Pe ...
- Co-prime
Co-prime Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem ...
- lca学习题
http://www.cnblogs.com/scau20110726/archive/2013/06/14/3135095.html
- LightOJ - 1231 - Coin Change (I)
先上题目: 1231 - Coin Change (I) PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: ...
- Spring事务的传播行为分析
前言 最近项目有涉及到Spring事务,所以工作之余,想认真了解学习下Spring事务,查阅了若干资料,做了一个demo(PS:参考了大牛的). 现分享总结如下: 1.Spring 事务的简介 理解事 ...
- Linux Terminal fortune
Linux下,我们能够使用apt-get安装fortune,这是一个比較有趣的功能 在输入fortune之后,Terminal会输出一句名言.诗句,或一些有趣的话: 默认情况下.fortune仅仅会显 ...
- iOS GCD使用指南
Grand Central Dispatch(GCD)是异步运行任务的技术之中的一个. 一般将应用程序中记述的线程管理用的代码在系统级中实现.开发人员仅仅须要定义想运行的任务并追加到适当的Dispat ...
- 怎样 获取 ios的系统版本
获得Ios系统版本的函数,比方 函数定义: [cpp] view plaincopy + (float)getIOSVersion; 函数实现: [cpp] view plaincopy + (flo ...
- UVA 10888 - Warehouse(二分图完美匹配)
UVA 10888 - Warehouse option=com_onlinejudge&Itemid=8&page=show_problem&category=562& ...
- Libgdx: android单机斗地主支持局域网wifi联网的网络模块核心代码
这个作品是我近期写的,结合我的毕业设计的通信模块和之前的单机版斗地主.我已经上架到豌豆荚了,贴了点广告,看看能不能赚点茶钱. 但是一点也不乐观.因此我想分享给大家源代码. 仅仅要不用于商业. 以下先贴 ...