Ubuntu 16.04: CPU Stress test

5,762

The delay you are talking about will always be there. It takes some time to load apps or files from the disc to ram. You can reduce this delay by switching to a faster hard drive or a solid state drive but it can't be eliminated. Speed of the mass storage media has always been a bottleneck, and the situation doesn't seem to change very soon. If the app runs smoothly once it has finished loading, there is nothing to worry about.

Share:
5,762

Related videos on Youtube

Comrade
Author by

Comrade

Updated on September 18, 2022

Comments

  • Comrade
    Comrade almost 2 years

    I have Lenovo Thinkpad E531, Core i3. I feel my machine is not working properly, Like opening applications, File to file opening, Everything takes a bit extra time both on linux and windows, But now i am using ubuntu 16.04.

    So i used stress-ng.

    With the following command stress-ng --cpu 4 --cpu-method matrixprod --metrics-brief --perf -t 60.

    I got the following results:

    stress-ng: info:  [4717] dispatching hogs: 4 cpu
    stress-ng: info:  [4717] cache allocate: default cache size: 3072K
    stress-ng: info:  [4717] successful run completed in 60.01s (1 min, 0.01 secs)
    stress-ng: info:  [4717] stressor      bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
    stress-ng: info:  [4717]                          (secs)    (secs)    (secs)   (real time) (usr+sys time)
    stress-ng: info:  [4717] cpu              16728     60.00    220.07      0.48       278.78        75.85
    stress-ng: info:  [4717] cpu:
    stress-ng: info:  [4717]            486,809,130,288 CPU Cycles                     8.11 B/sec
    stress-ng: info:  [4717]            299,665,293,760 Instructions                   4.99 B/sec (0.616 instr. per cycle)
    stress-ng: info:  [4717]             23,618,473,352 Cache References               0.39 B/sec
    stress-ng: info:  [4717]                155,046,972 Cache Misses                   2.58 M/sec ( 0.66%)
    stress-ng: info:  [4717]            340,515,406,760 Stalled Cycles Frontend        5.67 B/sec
    stress-ng: info:  [4717]            173,093,935,356 Stalled Cycles Backend         2.88 B/sec
    stress-ng: info:  [4717]             36,696,289,676 Branch Instructions            0.61 B/sec
    stress-ng: info:  [4717]                289,823,652 Branch Misses                  4.83 M/sec ( 0.79%)
    stress-ng: info:  [4717]             22,175,572,704 Bus Cycles                     0.37 B/sec
    stress-ng: info:  [4717]            510,047,929,756 Total Cycles                   8.50 B/sec
    stress-ng: info:  [4717]                        776 Page Faults Minor             12.93 sec  
    stress-ng: info:  [4717]                          0 Page Faults Major              0.00 sec  
    stress-ng: info:  [4717]                     22,952 Context Switches             382.46 sec  
    stress-ng: info:  [4717]                        188 CPU Migrations                 3.13 sec  
    stress-ng: info:  [4717]                          0 Alignment Faults               0.00 sec  
    

    Now i don't know whether the results are fine or if its ambiguous?

    Update

    As @ColinIanKing author of stress-ng, Mentioned in the answer comment, The results of vmstat 1 is :

    procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
     2  0      0 213980  69832 1450000    0    0   672     0  793 3419 26  2 69  3  0
     1  0      0 213360  69832 1450060    0    0     0   312 1155 3243 30  2 68  0  0
     2  0      0 213420  69848 1450072    0    0     4   120  991 2534 29  2 68  2  0
     1  0      0 213172  69848 1450072    0    0     0     0 1306 2173 28  2 70  0  0
     2  0      0 174192  70008 1465956    0    0  4964    96 2152 8701 29  5 48 18  0
     0  0      0 141592  70136 1467132    0    0  4240     0 1838 6137 15  4 70 11  0
     2  0      0 129532  70136 1466920    0    0   296    12 1718 4069 16  3 80  0  0
     0  0      0 128664  70136 1467084    0    0   128     0 1436 3546 15  3 82  0  0
     1  0      0 138956  70136 1467212    0    0   128     0 1508 3388 14  3 83  0  0
     0  0      0 213120  70152 1452916    0    0  1284   128 1817 6011 23  4 70  4  0
     0  0      0 212920  70152 1452928    0    0     0     0 1075 1948  3  2 95  0  0
     0  0      0 212720  70188 1452640    0    0    24   484 1218 2970  5  2 87  5  0
     0  0      0 212812  70188 1452640    0    0     0     0  361 1161  3  1 96  0  0
     0  0      0 212812  70188 1452640    0    0     0     0  251  554  2  1 98  0  0
     0  0      0 212812  70188 1452512    0    0     0     0  302  830  2  1 97  0  0
     0  0      0 212812  70188 1452512    0    0     0     0  250  552  1  1 98  0  0
     0  0      0 212728  70196 1452512    0    0     0    36  527 1786  6  1 93  1  0
     0  0      0 217416  70196 1447648    0    0     0     0  296  738  2  1 97  0  0
     0  0      0 205140  70196 1459488    0    0     0     0  405 1429  4  2 94  0  0
     0  0      0 205140  70196 1459788    0    0     0    12  499 2010  5  1 94  0  0
     2  0      0 205048  70196 1459820    0    0     0     0 1127 3336 14  3 83  0  0
    

    And results of free -m :

                  total        used        free      shared  buff/cache   available
    Mem:           3518        1861         280         425        1376         912
    Swap:             0  
    

    In this duration i played a video clip via VLC.

    • NeoTheThird
      NeoTheThird over 7 years
      Well cpu performance is not really a boolean, so you can't say "this is ok", "that is not ok". Also, remember that the i3 is not really a powerhouse.
    • Comrade
      Comrade over 7 years
      @NeoTheThird I know but at least the it should should work normal. My machine responds a bit slow.
    • NeoTheThird
      NeoTheThird over 7 years
      Maybe it's not the CPU that's holding you back. Do you have a dedicated GPU? How much RAM do you have? The Unity desktop is quite heavy on resources for slow machines, so maybe you'd be better of with Lubuntu, as it is known to be a little faster.
    • Comrade
      Comrade over 7 years
      I was using ubuntu 16.04 on core2duo and everything was fine. Now i am using lenovo thinkpad E531, 4Gb Ram , Intel HD 3000 Integrated Graphics. 320Gb Hard drive. And i know Lubuntu is fast, But this machine is fine too for Ubuntu.
    • Colin Ian King
      Colin Ian King over 7 years
      The stress-ng stream stressor is a better indicator of overall memory bandwidth and CPU throughput. (Speaking as the author of stress-ng).
    • Comrade
      Comrade over 7 years
      @colinianKing Nooooo, Really ? So the results are fine ?
    • Colin Ian King
      Colin Ian King over 7 years
      You seem to have plenty of CPU cycles, so I guess the sluggishness is more to do with the I/O, that is, when you start applications it's taking a while to read the application off disk.
    • Comrade
      Comrade over 7 years
      @colinianking So i got a bad hard drive then ?
    • Colin Ian King
      Colin Ian King over 7 years
      I doubt it, best to give it some kind of disk benchmark test to see if it is sane. However, I looked up the specs of the machine and it seems like the default drive is a 5400rpm model, so that's a bit on the slow side. The slower it spins, the longer the latency is to fetch data. This is especially noticeable if you have a lot of random I/O patterns.
  • Comrade
    Comrade over 7 years
    Yeah i know that it will take its time, But i takes a bit extra time, Suppose i have a series of videos, When i open one and play it for a while then close VLC and then back to another one then it takes around 5-10 seconds, Which is obviously much time. And that is the same for every task in OS.
  • saga
    saga over 7 years
    does the app(vlc) runs fine after loading.
  • Colin Ian King
    Colin Ian King over 7 years
    If you run vmstat 1 you can see where the CPU cycles are going. The si and so fields show if you have any swap in and swap out activity (hence indicating you are low in physical memory). The bi an bo fields show block in and block out I/O activity (showing that you may be just I/O bound and the delays are due to slow media). The us and sy fields show time in userspace or system (kernel) space, showing how much CPU is being used. Refer to the vmstat man page for more details. I use this tool to get a rough idea of why systems look sluggish.
  • Comrade
    Comrade over 7 years
    @saga yes the VLC then runs smoothly.
  • saga
    saga over 7 years
    can you provide the output of free -m
  • Comrade
    Comrade over 7 years
    @saga Question updated, You got everything now.