|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!一.成绩的来历
MySQL在Linux下是多线程的,并且只能将多个线程散布到一个CPU上。以是,企业中,利用小型办事器,大概PCSERVER,多个CPU使用率其实不高。
基础上有1~2个在利用。本文次要为了统计CPU的使用率。但愿引发人人注重。
二.步伐完成
1.输出top-bn1(b把持输入格局为文本格局,非交互格局)
[mysql@longxibendi.host]$top-bn1
2.输出top,进进交互形式,为下一步设置输入格局做筹办
[mysql@longxibendi.host]$top
然后输出1
就能够看到多个CPU使用率了
top-21:40:51up25days,9:32,1user,loadaverage:0.15,0.30,0.33
Tasks:101total,1running,96sleeping,0stopped,4zombie
Cpu0:0.8%us,0.3%sy,0.0%ni,98.4%id,0.3%wa,0.0%hi,0.0%si
Cpu1:1.1%us,0.2%sy,0.0%ni,98.6%id,0.1%wa,0.0%hi,0.0%si
Cpu2:0.5%us,0.1%sy,0.0%ni,99.4%id,0.0%wa,0.0%hi,0.0%si
Cpu3:0.4%us,0.1%sy,0.0%ni,99.5%id,0.0%wa,0.0%hi,0.0%si
Cpu4:0.3%us,0.1%sy,0.0%ni,99.5%id,0.0%wa,0.0%hi,0.0%si
Cpu5:0.3%us,0.1%sy,0.0%ni,99.6%id,0.0%wa,0.0%hi,0.0%si
Cpu6:0.3%us,0.1%sy,0.0%ni,99.6%id,0.0%wa,0.0%hi,0.0%si
Cpu7:0.2%us,0.1%sy,0.0%ni,99.7%id,0.0%wa,0.0%hi,0.0%si
3.保留以后输入格局的参数(设置输入)
在2的基本上按W,然后按ctri+c
保留加入
按q
(如许就会在/home/mysql下有.toprc文件)
4.编写shell步伐cpu.sh
#!/bin/bash
whiletrue
do
top-bcisSn1>>cpu.log
sleep10
done
5.安排cpu.sh步伐
shcpu.sh&
三.剖析日记
catcpu.log|grepcpu等操纵,就能够剖析已往工夫,各个cpu的使用率了。
这里省略.....,依团体喜好,输入,乃至能够把输入用cacti画图出来。
四.删除设置文件
假如不想利用上述的top输入格局,能够删除设置文件
rm/home/mysql/.toprc
有乐趣能够看看.toprc的内容
凤凰舞者qq:578989855
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们! |
|