2.3. Diskdevstat 和​​​​​​​ netdevstat


Diskdevstat 和​​​​​​​ netdevstat 是​​​​​​​收​​​​​​​集​​​​​​​有​​​​​​​关​​​​​​​磁​​​​​​​盘​​​​​​​活​​​​​​​性​​​​​​​以​​​​​​​及​​​​​​​在​​​​​​​系​​​​​​​统​​​​​​​中​​​​​​​运​​​​​​​行​​​​​​​的​​​​​​​所​​​​​​​有​​​​​​​程​​​​​​​序​​​​​​​的​​​​​​​网​​​​​​​络​​​​​​​活​​​​​​​性​​​​​​​的​​​​​​​ SystemTap 工​​​​​​​具​​​​​​​。​​​​​​​这​​​​​​​些​​​​​​​工​​​​​​​具​​​​​​​是​​​​​​​由​​​​​​​ PowerTOP 支​​​​​​​配​​​​​​​,并​​​​​​​可​​​​​​​显​​​​​​​示​​​​​​​每​​​​​​​秒​​​​​​​钟​​​​​​​每​​​​​​​个​​​​​​​程​​​​​​​序​​​​​​​唤​​​​​​​醒​​​​​​​ CPU 的​​​​​​​次​​​​​​​数​​​​​​​(请​​​​​​​参​​​​​​​考​​​​​​​ 第 2.2 节 “PowerTOP”)。​​​​​​​这​​​​​​​些​​​​​​​工​​​​​​​具​​​​​​​收​​​​​​​集​​​​​​​的​​​​​​​统​​​​​​​计​​​​​​​可​​​​​​​让​​​​​​​您​​​​​​​识​​​​​​​别​​​​​​​那​​​​​​​些​​​​​​​使​​​​​​​用​​​​​​​很​​​​​​​多​​​​​​​小​​​​​​​ I/O 操​​​​​​​作​​​​​​​的​​​​​​​程​​​​​​​序​​​​​​​,它​​​​​​​们​​​​​​​比​​​​​​​少​​​​​​​量​​​​​​​的​​​​​​​较​​​​​​​大​​​​​​​操​​​​​​​作​​​​​​​更​​​​​​​耗​​​​​​​能​​​​​​​。​​​​​​​其​​​​​​​它​​​​​​​监​​​​​​​控​​​​​​​工​​​​​​​具​​​​​​​只​​​​​​​是​​​​​​​测​​​​​​​量​​​​​​​传​​​​​​​输​​​​​​​速​​​​​​​度​​​​​​​,无​​​​​​​法​​​​​​​帮​​​​​​​助​​​​​​​确​​​​​​​认​​​​​​​此​​​​​​​类​​​​​​​使​​​​​​​用​​​​​​​。​​​​​​​
使​​​​​​​用​​​​​​​ SystemTap 的​​​​​​​命​​​​​​​令​​​​​​​安​​​​​​​装​​​​​​​这​​​​​​​些​​​​​​​工​​​​​​​具​​​​​​​:
yum install systemtap tuned-utils kernel-debuginfo
使​​​​​​​用​​​​​​​如​​​​​​​下​​​​​​​命​​​​​​​令​​​​​​​运​​​​​​​行​​​​​​​这​​​​​​​些​​​​​​​工​​​​​​​具​​​​​​​:
diskdevstat
或​​​​​​​者​​​​​​​命​​​​​​​令​​​​​​​:
netdevstat
这​​​​​​​两​​​​​​​个​​​​​​​命​​​​​​​令​​​​​​​最​​​​​​​多​​​​​​​可​​​​​​​有​​​​​​​三​​​​​​​个​​​​​​​参​​​​​​​数​​​​​​​,如​​​​​​​下​​​​​​​所​​​​​​​示​​​​​​​:
diskdevstat update_interval total_duration display_histogram
netdevstat update_interval total_duration display_histogram
update_interval
以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​的​​​​​​​显​​​​​​​示​​​​​​​更​​​​​​​新​​​​​​​间​​​​​​​隔​​​​​​​时​​​​​​​间​​​​​​​。​​​​​​​默​​​​​​​认​​​​​​​:5
total_duration
以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​显​​​​​​​示​​​​​​​整​​​​​​​体​​​​​​​运​​​​​​​行​​​​​​​时​​​​​​​间​​​​​​​。​​​​​​​默​​​​​​​认​​​​​​​:86400(一​​​​​​​天​​​​​​​)
display_histogram
是​​​​​​​否​​​​​​​显​​​​​​​示​​​​​​​在​​​​​​​运​​​​​​​行​​​​​​​结​​​​​​​束​​​​​​​时​​​​​​​收​​​​​​​集​​​​​​​的​​​​​​​所​​​​​​​有​​​​​​​数​​​​​​​据​​​​​​​柱​​​​​​​形​​​​​​​图​​​​​​​的​​​​​​​标​​​​​​​签​​​​​​​。​​​​​​​
输​​​​​​​出​​​​​​​结​​​​​​​果​​​​​​​类​​​​​​​似​​​​​​​ PowerTOP。​​​​​​​这​​​​​​​里​​​​​​​是​​​​​​​来​​​​​​​自​​​​​​​使​​​​​​​用​​​​​​​ KDE 4.2 的​​​​​​​ Fedora 10 系​​​​​​​统​​​​​​​中​​​​​​​运​​​​​​​行​​​​​​​的​​​​​​​ diskdevstat 详​​​​​​​细​​​​​​​输​​​​​​​出​​​​​​​结​​​​​​​果​​​​​​​示​​​​​​​例​​​​​​​:
  PID   UID DEV     WRITE_CNT WRITE_MIN WRITE_MAX WRITE_AVG    READ_CNT  READ_MIN  READ_MAX  READ_AVG COMMAND        
 2789  2903 sda1          854     0.000   120.000    39.836           0     0.000     0.000     0.000 plasma            
15494     0 sda1            0     0.000     0.000     0.000         758     0.000     0.012     0.000 0logwatch         
15520     0 sda1            0     0.000     0.000     0.000         140     0.000     0.009     0.000 perl              
15549     0 sda1            0     0.000     0.000     0.000         140     0.000     0.009     0.000 perl              
15585     0 sda1            0     0.000     0.000     0.000         108     0.001     0.002     0.000 perl              
 2573     0 sda1           63     0.033  3600.015   515.226           0     0.000     0.000     0.000 auditd            
15429     0 sda1            0     0.000     0.000     0.000          62     0.009     0.009     0.000 crond             
15379     0 sda1            0     0.000     0.000     0.000          62     0.008     0.008     0.000 crond             
15473     0 sda1            0     0.000     0.000     0.000          62     0.008     0.008     0.000 crond             
15415     0 sda1            0     0.000     0.000     0.000          62     0.008     0.008     0.000 crond             
15433     0 sda1            0     0.000     0.000     0.000          62     0.008     0.008     0.000 crond             
15425     0 sda1            0     0.000     0.000     0.000          62     0.007     0.007     0.000 crond             
15375     0 sda1            0     0.000     0.000     0.000          62     0.008     0.008     0.000 crond             
15477     0 sda1            0     0.000     0.000     0.000          62     0.007     0.007     0.000 crond             
15469     0 sda1            0     0.000     0.000     0.000          62     0.007     0.007     0.000 crond             
15419     0 sda1            0     0.000     0.000     0.000          62     0.008     0.008     0.000 crond             
15481     0 sda1            0     0.000     0.000     0.000          61     0.000     0.001     0.000 crond             
15355     0 sda1            0     0.000     0.000     0.000          37     0.000     0.014     0.001 laptop_mode       
 2153     0 sda1           26     0.003  3600.029  1290.730           0     0.000     0.000     0.000 rsyslogd          
15575     0 sda1            0     0.000     0.000     0.000          16     0.000     0.000     0.000 cat               
15581     0 sda1            0     0.000     0.000     0.000          12     0.001     0.002     0.000 perl              
15582     0 sda1            0     0.000     0.000     0.000          12     0.001     0.002     0.000 perl              
15579     0 sda1            0     0.000     0.000     0.000          12     0.000     0.001     0.000 perl              
15580     0 sda1            0     0.000     0.000     0.000          12     0.001     0.001     0.000 perl              
15354     0 sda1            0     0.000     0.000     0.000          12     0.000     0.170     0.014 sh                
15584     0 sda1            0     0.000     0.000     0.000          12     0.001     0.002     0.000 perl              
15548     0 sda1            0     0.000     0.000     0.000          12     0.001     0.014     0.001 perl              
15577     0 sda1            0     0.000     0.000     0.000          12     0.001     0.003     0.000 perl              
15519     0 sda1            0     0.000     0.000     0.000          12     0.001     0.005     0.000 perl              
15578     0 sda1            0     0.000     0.000     0.000          12     0.001     0.001     0.000 perl              
15583     0 sda1            0     0.000     0.000     0.000          12     0.001     0.001     0.000 perl              
15547     0 sda1            0     0.000     0.000     0.000          11     0.000     0.002     0.000 perl              
15576     0 sda1            0     0.000     0.000     0.000          11     0.001     0.001     0.000 perl              
15518     0 sda1            0     0.000     0.000     0.000          11     0.000     0.001     0.000 perl              
15354     0 sda1            0     0.000     0.000     0.000          10     0.053     0.053     0.005 lm_lid.sh
这​​​​​​​些​​​​​​​列​​​​​​​代​​​​​​​表​​​​​​​:
PID
应​​​​​​​用​​​​​​​程​​​​​​​序​​​​​​​的​​​​​​​进​​​​​​​程​​​​​​​ ID
UID
运​​​​​​​行​​​​​​​中​​​​​​​的​​​​​​​应​​​​​​​用​​​​​​​程​​​​​​​序​​​​​​​用​​​​​​​户​​​​​​​ ID
DEV
发​​​​​​​生​​​​​​​ I/O 的​​​​​​​设​​​​​​​备​​​​​​​
WRITE_CNT
写​​​​​​​操​​​​​​​作​​​​​​​总​​​​​​​数​​​​​​​
WRITE_MIN
两​​​​​​​个​​​​​​​连​​​​​​​续​​​​​​​写​​​​​​​入​​​​​​​操​​​​​​​作​​​​​​​所​​​​​​​需​​​​​​​最​​​​​​​短​​​​​​​时​​​​​​​间​​​​​​​(以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​)
WRITE_MAX
两​​​​​​​个​​​​​​​连​​​​​​​续​​​​​​​写​​​​​​​入​​​​​​​操​​​​​​​作​​​​​​​所​​​​​​​需​​​​​​​最​​​​​​​长​​​​​​​时​​​​​​​间​​​​​​​(以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​)
WRITE_AVG
两​​​​​​​个​​​​​​​连​​​​​​​续​​​​​​​写​​​​​​​入​​​​​​​操​​​​​​​作​​​​​​​所​​​​​​​需​​​​​​​平​​​​​​​均​​​​​​​时​​​​​​​间​​​​​​​(以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​)
READ_CNT
读​​​​​​​操​​​​​​​作​​​​​​​的​​​​​​​总​​​​​​​数​​​​​​​
READ_MIN
两​​​​​​​个​​​​​​​连​​​​​​​续​​​​​​​读​​​​​​​操​​​​​​​作​​​​​​​所​​​​​​​需​​​​​​​最​​​​​​​短​​​​​​​时​​​​​​​间​​​​​​​(以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​)
READ_MAX
两​​​​​​​个​​​​​​​连​​​​​​​续​​​​​​​读​​​​​​​操​​​​​​​作​​​​​​​所​​​​​​​需​​​​​​​最​​​​​​​长​​​​​​​时​​​​​​​间​​​​​​​(以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​)
READ_AVG
两​​​​​​​个​​​​​​​连​​​​​​​续​​​​​​​读​​​​​​​操​​​​​​​作​​​​​​​所​​​​​​​需​​​​​​​平​​​​​​​均​​​​​​​时​​​​​​​间​​​​​​​(以​​​​​​​秒​​​​​​​为​​​​​​​单​​​​​​​位​​​​​​​)
COMMAND
进​​​​​​​程​​​​​​​名​​​​​​​称​​​​​​​
在​​​​​​​这​​​​​​​个​​​​​​​示​​​​​​​例​​​​​​​中​​​​​​​可​​​​​​​看​​​​​​​到​​​​​​​三​​​​​​​个​​​​​​​非​​​​​​​常​​​​​​​明​​​​​​​显​​​​​​​的​​​​​​​应​​​​​​​用​​​​​​​程​​​​​​​序​​​​​​​:
  PID   UID DEV     WRITE_CNT WRITE_MIN WRITE_MAX WRITE_AVG    READ_CNT  READ_MIN  READ_MAX  READ_AVG COMMAND
 2789  2903 sda1          854     0.000   120.000    39.836           0     0.000     0.000     0.000 plasma
 2573     0 sda1           63     0.033  3600.015   515.226           0     0.000     0.000     0.000 auditd
 2153     0 sda1           26     0.003  3600.029  1290.730           0     0.000     0.000     0.000 rsyslogd
这​​​​​​​三​​​​​​​个​​​​​​​应​​​​​​​用​​​​​​​程​​​​​​​序​​​​​​​的​​​​​​​ WRITE_CNT 都​​​​​​​大​​​​​​​于​​​​​​​ 0,就​​​​​​​是​​​​​​​说​​​​​​​它​​​​​​​们​​​​​​​在​​​​​​​管​​​​​​​理​​​​​​​期​​​​​​​间​​​​​​​执​​​​​​​行​​​​​​​了​​​​​​​一​​​​​​​些​​​​​​​写​​​​​​​操​​​​​​​作​​​​​​​。​​​​​​​其​​​​​​​中​​​​​​​ plasma 是​​​​​​​最​​​​​​​捣​​​​​​​乱​​​​​​​的​​​​​​​程​​​​​​​序​​​​​​​:它​​​​​​​执​​​​​​​行​​​​​​​的​​​​​​​写​​​​​​​操​​​​​​​作​​​​​​​作​​​​​​​多​​​​​​​,当​​​​​​​然​​​​​​​写​​​​​​​操​​​​​​​作​​​​​​​平​​​​​​​均​​​​​​​间​​​​​​​隔​​​​​​​时​​​​​​​间​​​​​​​就​​​​​​​最​​​​​​​短​​​​​​​。​​​​​​​如​​​​​​​果​​​​​​​您​​​​​​​关​​​​​​​注​​​​​​​不​​​​​​​能​​​​​​​有​​​​​​​效​​​​​​​利​​​​​​​用​​​​​​​能​​​​​​​源​​​​​​​的​​​​​​​程​​​​​​​序​​​​​​​,那​​​​​​​么​​​​​​​ Plasma 就​​​​​​​是​​​​​​​最​​​​​​​佳​​​​​​​审​​​​​​​查​​​​​​​对​​​​​​​象​​​​​​​。​​​​​​​
请​​​​​​​使​​​​​​​用​​​​​​​ strace 和​​​​​​​ ltrace 命​​​​​​​令​​​​​​​,通​​​​​​​过​​​​​​​追​​​​​​​踪​​​​​​​所​​​​​​​有​​​​​​​给​​​​​​​定​​​​​​​进​​​​​​​程​​​​​​​ ID 的​​​​​​​系​​​​​​​统​​​​​​​调​​​​​​​用​​​​​​​更​​​​​​​进​​​​​​​一​​​​​​​步​​​​​​​检​​​​​​​查​​​​​​​应​​​​​​​用​​​​​​​程​​​​​​​序​​​​​​​。​​​​​​​在​​​​​​​这​​​​​​​个​​​​​​​示​​​​​​​例​​​​​​​中​​​​​​​,您​​​​​​​可​​​​​​​以​​​​​​​运​​​​​​​行​​​​​​​:
strace -p 2789
在​​​​​​​这​​​​​​​个​​​​​​​示​​​​​​​例​​​​​​​中​​​​​​​,strace 的​​​​​​​输​​​​​​​出​​​​​​​结​​​​​​​果​​​​​​​中​​​​​​​包​​​​​​​含​​​​​​​一​​​​​​​个​​​​​​​每​​​​​​​ 45 秒​​​​​​​重​​​​​​​复​​​​​​​一​​​​​​​次​​​​​​​的​​​​​​​图​​​​​​​案​​​​​​​,该​​​​​​​图​​​​​​​案​​​​​​​打​​​​​​​开​​​​​​​用​​​​​​​户​​​​​​​的​​​​​​​ KDE 图​​​​​​​标​​​​​​​缓​​​​​​​冲​​​​​​​文​​​​​​​件​​​​​​​,接​​​​​​​着​​​​​​​写​​​​​​​入​​​​​​​,然​​​​​​​后​​​​​​​马​​​​​​​上​​​​​​​再​​​​​​​次​​​​​​​关​​​​​​​闭​​​​​​​该​​​​​​​文​​​​​​​件​​​​​​​。​​​​​​​这​​​​​​​导​​​​​​​致​​​​​​​一​​​​​​​个​​​​​​​在​​​​​​​硬​​​​​​​盘​​​​​​​中​​​​​​​的​​​​​​​必​​​​​​​需​​​​​​​物​​​​​​​理​​​​​​​写​​​​​​​入​​​​​​​,因​​​​​​​为​​​​​​​已​​​​​​​经​​​​​​​更​​​​​​​改​​​​​​​了​​​​​​​文​​​​​​​件​​​​​​​原​​​​​​​数​​​​​​​据​​​​​​​(特​​​​​​​别​​​​​​​是​​​​​​​修​​​​​​​改​​​​​​​时​​​​​​​间​​​​​​​)。​​​​​​​最​​​​​​​终​​​​​​​修​​​​​​​复​​​​​​​是​​​​​​​防​​​​​​​止​​​​​​​那​​​​​​​些​​​​​​​在​​​​​​​没​​​​​​​有​​​​​​​图​​​​​​​标​​​​​​​更​​​​​​​新​​​​​​​时​​​​​​​的​​​​​​​不​​​​​​​必​​​​​​​要​​​​​​​调​​​​​​​用​​​​​​​。​​​​​​​
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.