Ubuntu – Ubuntu get actual current CPU clock speed

16.04cpu

(Irrelevant) Background

My Dell XPS 15 9550 laptop is slow; typing in text boxes doesn't keep up with me, moving around google maps is undoable, and javascript popups are slow when I browse. The same holds for development websites I run locally.

I noticed that the CPU might be throttled at 800Mhz. So I started investigating CPU reports:

  • Linux /proc/cpuinfo reports ~800MHz on all 8 threads
  • Windows task manager stated 0.8GHz
  • Open Hardware Monitor in windows reports 800MHz on all 8 threads, and 100MHz bus speed.

I called Dell, and they suggested to update the Bios and disable SpeedStep and C-States. I did, afterwards the windows task manager started reporting 2.6GHz and so did the bios, but the Open Hardware Monitor in windows still said 800MHz CPU and 100Mhz bus.

So the numbers in Windows seem inconsistent, but I frankly mostly care about Ubuntu. After the bios changes, Ubuntu still feels slow.

Question

I want to know at which speed my CPU or cores actually run. So made sure the cores had some work to do

for i in `seq 5`; do (echo "i=0"; echo "while True: i=1+1") | python& done

Now 5 threads are full active in the task manager; a reason for the performance governor to scale up the cores. What I see is this:

lshw

$ sudo lshw -c cpu
  *-cpu                   
       description: CPU
       product: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
       vendor: Intel Corp.
       physical id: 3c
       bus info: cpu@0
       version: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
       serial: To Be Filled By O.E.M.
       slot: U3E1
       size: 799MHz    # suggests the current speed is 800MHz
       capacity: 3500MHz
       width: 64 bits
       clock: 100MHz
       capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp cpufreq
       configuration: cores=4 threads=8

/proc/cpuinfo

$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 94
model name  : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
stepping    : 3
microcode   : 0x9e
cpu MHz     : 799.906
cache size  : 6144 KB
physical id : 0
siblings    : 8
core id     : 0
cpu cores   : 4
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs        :
bogomips    : 5183.76
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

# Repeated 8 times for all threads, cpu MHz around 800MHz for all

dmidecode

$ sudo dmidecode -t processor
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.

Handle 0x003C, DMI type 4, 48 bytes
Processor Information
    Socket Designation: U3E1
    Type: Central Processor
    Family: Core i7
    Manufacturer: Intel(R) Corporation
    ID: E3 06 05 00 FF FB EB BF
    Signature: Type 0, Family 6, Model 94, Stepping 3
    Flags:
        FPU (Floating-point unit on-chip)
        VME (Virtual mode extension)
        DE (Debugging extension)
        PSE (Page size extension)
        TSC (Time stamp counter)
        MSR (Model specific registers)
        PAE (Physical address extension)
        MCE (Machine check exception)
        CX8 (CMPXCHG8 instruction supported)
        APIC (On-chip APIC hardware supported)
        SEP (Fast system call)
        MTRR (Memory type range registers)
        PGE (Page global enable)
        MCA (Machine check architecture)
        CMOV (Conditional move instruction supported)
        PAT (Page attribute table)
        PSE-36 (36-bit page size extension)
        CLFSH (CLFLUSH instruction supported)
        DS (Debug store)
        ACPI (ACPI supported)
        MMX (MMX technology supported)
        FXSR (FXSAVE and FXSTOR instructions supported)
        SSE (Streaming SIMD extensions)
        SSE2 (Streaming SIMD extensions 2)
        SS (Self-snoop)
        HTT (Multi-threading)
        TM (Thermal monitor supported)
        PBE (Pending break enabled)
    Version: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Voltage: 0.6 V
    External Clock: 100 MHz
    Max Speed: 2600 MHz
    Current Speed: 2600 MHz
    Status: Populated, Enabled
    Upgrade: Other
    L1 Cache Handle: 0x0039
    L2 Cache Handle: 0x003A
    L3 Cache Handle: 0x003B
    Serial Number: To Be Filled By O.E.M.
    Asset Tag: To Be Filled By O.E.M.
    Part Number: To Be Filled By O.E.M.
    Core Count: 4
    Thread Count: 8
    Characteristics:
        64-bit capable
        Multi-Core
        Hardware Thread
        Execute Protection
        Enhanced Virtualization
        Power/Performance Control

Here /proc/cpuinfo and lshw suggest the actual CPU speed is 800MHz, this is backed up by how slow my machine is. However, `dmidecode says the Current Speed is 2600MHz, and so does my BIOS. Why are this numbers inconsistent? Is there an empirical way, check how long a CPU needs to calculate something, to guess the CPU speed? (800MHz should be quite distinguishable from 2600MHz)

Moreover, Open Hardware Monitor also reports 800Mhz, while Windows Task Manager reports 2.6GHz.

Obviously, any suggestions on how to to solve the CPU throttling would be well appreciated. I already found the 'open laptop, unmount battery for some minutes' and 'completely drain battery, leave uncharged for some minutes' solutions. Will still need to try those.

Best Answer

To know all your CPU Specs use the command:

lscpu

To get the specific frequency of your CPU use the command with a grep like so:

lscpu | grep MHz

It will give you output like:

CPU MHz:               2723.789

To see realtime CPU speeds fluctuation use :

watch -n1 "lscpu | grep MHz | awk '{print $1}'";
Related Question