使用prime95做cpu压力测试

 

上次因为cpu的发热问题, 我把cpu的硅胶给重新换了下。想试试什么时候能再引发这个温度过热,cpu自动降频的问题.

     dmesg | grep cpu
    [22115.380360] CPU0: Core temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380362] CPU3: Package temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380364] CPU2: Core temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380365] CPU1: Package temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380368] CPU2: Package temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380373] CPU0: Package temperature above threshold, cpu clock throttled (total events = 1)  

以前用的命令是 dd if=/dev/zero of=/dev/null, 不过今天打算用prime95来做。  

  1.  下载prime95开始测试  

     mkdir -p prime95
     wget http://www.mersenne.org/ftp_root/gimps/p95v294b8.linux64.tar.gz
     tar zxvf p95v294b8.linux64.tar.gz  
    
    
    
    
     root@kali:/opt/prime95# ./mprime
    
     Welcome to GIMPS, the hunt for huge prime numbers. You will be asked a
     few simple questions and then the program will contact the primenet server
     to get some work for your computer. Good
    
     Attention Mprime has gained a reputation as a useful
     stress testing tool for people that enjoy pushing their hardware to the
     limit. You are more than welcome to use this software for that purpose.
     Please select the stress testing choice below to avoid interfering with
     the PrimeNet server. Use the Options/Torture Test menu choice for your
     stress tests. Also, read the stress.txt file.
    
     If you want to both join GIMPS and run stress tests, then Join GIMPS and
     answer the questions. After the server gets some work for you, stop
     mprime, then run mprime -m and choose Options/Torture Test.
    
     Join Gimps? (Y=Yes, N=Just stress testing) (Y): n
     Number of torture test threads to run (4): 2
     Choose a type of torture test to run.
       1 = Small FFTs (maximum heat and FPU stress, data fits in L2 cache, RAM
     not tested much).
       2 = In-place large FFTs (maximum power consumption, some RAM tested).
       3 = Blend (tests some of everything, lots of RAM tested).
       11,12,13 = Allows you to fine tune the above three selections.
     Blend is the default. NOTE: if you fail the blend test, but can pass the
     small FFT test then your problem is likely bad memory or a bad memory
     controller.
     Type of torture test to run (3): 1
    
     Accept the answers above? (Y): y
    

    在这里,我只用了2线程来跑这个测试,跑测试1=Small FFTs。为什么不用4线程,因为经过我的测试,4线程瞬间就能把cpu给耗光,cpu占用会在90%以上。系统性能急速下降。

  2.  开第二个shell, 执行vmstat 1,每秒打印一行,来检查系统性能。 下面这个是4线程测试的vmstat的结果,有大量的进程在等待无法执行(r列的数值远超cpu的个数)。cpu利用率us在90%以上,正常情况下,这个数值应该在85%下。

     r b swpd free buff cache si so bi bo in cs us sy id wa st
      5 0 0 4464356 422712 1432820 0 0 0 0 3161 4918 94 6 0 0 0
      6 0 0 4464004 422712 1433196 0 0 0 0 2761 4150 98 2 0 0 0
      8 0 0 4461152 422712 1435656 0 0 0 0 3412 5202 94 6 0 0 0
      5 0 0 4460036 422720 1436028 0 0 0 268 2747 4199 98 2 0 0 0
      5 0 0 4460780 422720 1435344 0 0 0 0 3040 4748 97 3 0 0 0
      5 0 0 4459664 422720 1436148 0 0 0 0 3033 4667 96 4 0 0 0
      4 0 0 4458764 422720 1436204 0 0 0 0 3426 5487 95 5 0 0 0
      4 0 0 4458300 422720 1436232 0 0 0 0 3225 4838 97 3 0 0 0
      4 0 0 4457928 422720 1436232 0 0 0 0 2764 4110 96 4 0 0 0
      4 0 0 4460824 422720 1432592 0 0 0 0 2227 2869 99 1 0 0 0
      4 0 0 4435760 422720 1457372 0 0 0 0 3789 6498 95 5 0 0 0
      4 0 0 4449720 422720 1443204 0 0 0 0 2623 4125 98 2 0 0 0
      4 0 0 4452672 422728 1439492 0 0 0 20 2645 3985 96 4 0 0 0
      4 0 0 4452812 422728 1439320 0 0 0 0 2841 4483 97 3 0 0 0
      4 0 0 4452316 422728 1439492 0 0 0 0 2708 4176 97 3 0 0 0
      4 0 0 4452972 422728 1435888 0 0 0 0 2694 4292 98 2 0 0 0
      5 0 0 4450716 422728 1435592 0 0 0 0 2369 3552 99 1 0 0 0
      5 0 0 4438948 422728 1435532 0 0 0 0 2317 3332 99 1 0 0 0
      4 0 0 4454244 422736 1436484 0 0 0 812 2926 4875 97 3 0 0 0
      4 0 0 4449152 422736 1441128 0 0 0 0 2699 4115 97 3 0 0 0
      6 0 0 4448720 422736 1440988 0 0 0 0 4631 8295 97 3 0 0 0
     procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
      r b swpd free buff cache si so bi bo in cs us sy id wa st
      6 0 0 4449804 422736 1439568 0 0 0 0 3648 6144 96 4 0 0 0
      4 0 0 4449680 422736 1439652 0 0 0 0 2588 4085 99 1 0 0 0
      5 0 0 4448768 422736 1439996 0 0 0 0 2779 4457 99 1 0 0 0
      4 0 0 4447696 422744 1441220 0 0 0 60 3036 4729 98 2 0 0 0
      4 0 0 4447572 422744 1441384 0 0 0 0 2655 3998 99 2 0 0 0
      8 0 0 4447448 422744 1441108 0 0 0 0 2772 4512 98 2 0 0 0
      4 0 0 4447764 422744 1440700 0 0 0 0 3381 5338 97 3 0 0 0
      6 0 0 4451128 422744 1436988 0 0 0 0 2724 3841 98 2 0 0 0
      4 0 0 4451780 422744 1435828 0 0 0 16 3340 4783 98 2 0 0 0
      4 0 0 4447820 422744 1439396 0 0 0 0 4191 7188 97 3 0 0 0
      4 0 0 4447076 422744 1440240 0 0 0 0 2950 4299 98 3 0 0 0
      5 0 0 4446456 422744 1439912 0 0 0 0 3001 4543 98 2 0 0 0
    
  3. 开启i7z来检查cpu的频率,我的cpu是5200u.  标准频率2200.   linux kernel有governer 动态调整cpu的频率.

       Cpu speed from cpuinfo 2194.00Mhz
       cpuinfo might be wrong if cpufreq is enabled. To guess correctly try estimating
       Linux ccounting Turbo) 2194 MHz
       CPU Multiplier 22x || Bus clock frequency (BCLK) 99.73 MHz
            
       Socket [0] - [physical cores=2, logical cores=4, max online cores ever=2]
         TURBO ENABLED on 2 Cores, Hyper Threading ON
         Max Frequency without considering Turbo 2293.73 MHz (99.73 x [23])
         Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is  27x/25x/25x/25x
         Real Current Frequency 1441.98 MHz [99.73 x 14.46] (Max of below)
       Core [core-id]  :Actual Freq (Mult.)C0%   Halt(C1)%  C3 %   C6 %
       Core 1 [0]:1416.00 (14.20x)15.9    83.8    3.57    2.39
       Core 2 [1]:1441.98 (14.46x)  22    80.4    2.76     2.4
            
       C0 = Processor running without halting
       C1 = Processor running with halts (States >C0 are power saver modes with cores i
       C3 = Cores running with PLL turned off and core cache turned off
       C6, C7 = Everything in C3 + core state saved to last level cache, C7 is deeper t
       Above values in table are in percentage over the last 1 sec
    
  4. 检测5分钟后,停掉prime95,使用sensors来继续检查cpu的温度,是否cpu的温度能迅速的下降,检查dmesg,是否有cpu温度过高降频的event.   对于笔记本cpu 5200u,开机温度50,正常工作70度, 极限到80-90度,只要不长时间在90度以上,应该是可以接受的.  

    root@kali:~# dmesg |grep "cpu clock"
    [22115.380360] CPU0: Core temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380362] CPU3: Package temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380364] CPU2: Core temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380365] CPU1: Package temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380368] CPU2: Package temperature above threshold, cpu clock throttled (total events = 1)
    [22115.380373] CPU0: Package temperature above threshold, cpu clock throttled (total events = 1)
    [23696.734283] CPU0: Core temperature above threshold, cpu clock throttled (total events = 20090)
    [23696.734284] CPU2: Core temperature above threshold, cpu clock throttled (total events = 20090)
    [23696.734287] CPU3: Package temperature above threshold, cpu clock throttled (total events = 20276)
    [23696.734288] CPU1: Package temperature above threshold, cpu clock throttled (total events = 20276)
    [23696.734294] CPU2: Package temperature above threshold, cpu clock throttled (total events = 20276)
    [23696.734299] CPU0: Package temperature above threshold, cpu clock throttled (total events = 20276)
    root@kali:~# sensors
    acpitz-virtual-0
    Adapter: Virtual device
    temp1:        +50.0°C  (crit = +105.0°C)
    temp2:         +0.0°C  (crit = +105.0°C)
        
    coretemp-isa-0000
    Adapter: ISA adapter
    Package id 0:  +49.0°C  (high = +105.0°C, crit = +105.0°C)
    Core 0:        +48.0°C  (high = +105.0°C, crit = +105.0°C)
    Core 1:        +48.0°C  (high = +105.0°C, crit = +105.0°C)