/proc/sysrq-trigger的一点介绍

        前两天,缓存系统的一哥们儿在帮忙排查他们超时线程在某个机房占用cpu使用率比较高的情况的时候,用到了

sudo sh -c 'echo w > /proc/sysrq-trigger' ; dmesg

不解,查了下:

          dmesg 用来显示系统启动时候的系统信息的,这对系统管理员或者排查问题的时候很重要,参考鸟哥的解释和更详细的资料

       sh -c是用sh执行命令

         当然,最重要的还是echo w > /proc/sysrq-trigger,查了只知道proc/sysrq-trigger是一个神奇的文件,用echo写一些System Request Key上去,就可以像操作本地计算机一样操纵远程计算机。w呢就是将进入uninterrupted状态的任务的信息dump出来,结果在/var/log/messages里边,输入类似于:

Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.482818] SysRq : Show Blocked State
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.486807]   task                        PC stack   pid father
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487382] Sched Debug Version: v0.09, 2.6.32-220.23.2.ali1113.el5.x86_64 #1
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487385] now at 3277054986.674554 msecs
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487386]   .jiffies                                 : 7571722282
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487388]   .sysctl_sched_latency                    : 20.000000
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487390]   .sysctl_sched_min_granularity            : 4.000000
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487392]   .sysctl_sched_wakeup_granularity         : 4.000000
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487393]   .sysctl_sched_child_runs_first           : 0.000000
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487395]   .sysctl_sched_features                   : 3183
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.487397]   .sysctl_sched_tunable_scaig     1(oatc<[7143]<[7143]p0200M
Sep  7 22:18:35 hostnameXX.cm10 >24.71 nrng      :
Sep  7 22:18:35 hostnameXX.cm10 >24.72 ld        :0
Sep  7 22:18:35 hostnameXX.cm10 >24.74 nste      :091
Sep  7 22:18:35 hostnameXX.cm10 >24.75 nldpt     :130<[7144] rntrtl     <[7144] e_lc       774

......

Sep  7 22:18:35 hostnameXX.cm10 >24.78
Sep  7 22:18:35 hostnameXX.cm10 >24.79c_[:<[7149] x_o        4134<[7149] Ivnm       00
Sep  7 22:18:35 hostnameXX.cm10 >24.73 m_ui      :9529
Sep  7 22:18:35 hostnameXX.cm10 >24.75 m_ui      :.01435784 .rd        000<[7149] pa         82267<[7149] rpaor      <[7149] rui        <[7149] o          <[7149] o_g        00
Sep  7 22:18:35 hostnameXX.cm10 >24.74 ldeo      :.00435785 .actb      0435785 .at        0435785 435785 nb s:435785     s I   r-yste i  erte   mx   use<[7149]-----------------------------------
Sep  7 22:18:35 hostnameXX.cm10 >24.79
Sep  7 22:18:35 hostnameXX.cm10 >24.79c# 04 z435780 ._nn       0435780 .a         0435780 ._ih       144<[7140] ro_de      06
Sep  7 22:18:35 hostnameXX.cm10 >24.86 nunrpb    :
Sep  7 22:18:35 hostnameXX.cm10 >24.87 ntan      :5.20435780 .r>d       0435781 .o         356433<[7140] pld]       <[7140] pld]       <[7140] pld]       <[7140] pld]       <[7140] pld]       
Sep  7 22:18:35 hostnameXX.cm10 4[251.808  ydot       4
Sep  7 22:18:35 hostnameXX.cm10 >24.89 sest    <[7140] cdot       82
Sep  7 22:18:35 hostnameXX.cm10 >24.82 .cegd      :87
Sep  7 22:18:35 hostnameXX.cm10 >24.83 a_l       :00
Sep  7 22:18:35 hostnameXX.cm10 >24.85 tuot      :91
Sep  7 22:18:35 hostnameXX.cm10 >24.86 tuol      :86

......
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488179]   .load_contrib                  : 0
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488180]   .load_tg                       : 0
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488182] 
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488182] runnable tasks:
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488183]             task   PID         tree-key  switches  prio     exec-runtime         sum-exec        sum-sleep
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488184] ----------------------------------------------------------------------------------------------------------
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488223] 
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488223] cpu#7, 2300.408 MHz
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488224]   .nr_running                    : 0
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488225]   .load                          : 0
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488227]   .nr_switches                   : 2890549089
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488228]   .nr_load_updates               : 701752633
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488230]   .nr_uninterruptible            : 0

......       
                 
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488309]   .load_avg                      : 0.000000
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488310]   .load_period                   : 0.000000
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488312]   .load_contrib                  : 0
Sep  7 22:18:35 hostnameXX.cm10 kernel: : [3275417.488313]   .load_tg                       : 0
......

         还有一点sysctl_sched_latency的资料,这里和这里

你可能感兴趣的:(/proc/sysrq-trigger的一点介绍)