≡ Menu

How to use CoreFreq CPU monitoring software on Linux

Recently I came across an excellent software called CoreFreq. It is a CPU monitoring software designed for 64-bits Processors w/ architectures Intel Atom, Core2, Nehalem, SandyBridge and superior, and AMD Family 0F. It runs on 64 bit Linux system. CoreFreq provides a framework to retrieve CPU data with a high degree of precision:

  1. Core frequencies & ratios; SpeedStep (EIST), Turbo Boost, Hyper-Threading (HTT) and Base Clock
  2. Performance counters including Time Stamp Counter (TSC), Unhalted Core Cycles (UCC), Unhalted Reference Cycles (URC)
  3. Number of instructions per cycle or second, IPS, IPC, or CPI
  4. CPU C-States C0 C1 C3 C6 C7 – C1E – Auto/UnDemotion of C1 C3
  5. DTS Temperature and Tjunction Max, Thermal Monitoring TM1 TM2 state
  6. Topology map including Caches for boostrap & application CPU
  7. Processor features, brand & architecture strings

How to install CoreFreq

You must install the prerequisite packages and compilers. For Debian/Ubuntu Linux, enter:
$ sudo apt-get install build-essential dkms git libpthread-stubs0-dev
For CentOS/RHEL/Scientific Linux, run:
$ sudo yum group install "Development Tools"
Type the following command to clone git repo:
$ git clone https://github.com/cyring/CoreFreq.git
Sample outputs:

Fig.01: Download or clone the source code

Fig.01: Download or clone the source code

Compile the CoreFreq program

Type the following commands:
$ cd CoreFreq/
$ make

Sample outputs:

Fig.02: Build the programs

Fig.02: Build the programs

Load the Linux kernel module

Type the following insmod command to load Linux kernel module from local directory:
$ sudo insmod ./corefreqk.ko

How do I use the corefreqd daemon?

First, start the daemon:
$ sudo ./corefreqd &
Sample outputs:

[1] 11906
 CoreFreq Daemon.  Copyright (C) 2015-2017 CYRIL INGENIERIE

Finally, start the client, run:
$ ./corefreq-cli
Without any arguments, the corefreq-cli program displays Top Monitoring as follows:

Animated gif 01: Client program in action

Animated gif 01: Client program in action

How do show dashboard

Start it as follows:
$ ./corefreq-cli -t

How do I print system information

$ ./corefreq-cli -s
Sample outputs:

Fig.03: Show Processor information (BSP)

Fig.03: Show Processor information (BSP)


To see all other options, type:
$ ./corefreq-cli -h

CoreFreq.  Copyright (C) 2015-2017 CYRIL INGENIERIE

usage:	corefreq-cli [-option ]
	-t	Show Top (default)
	-d	Show Dashboard
		  arguments:    
	-c	Monitor Counters
	-i	Monitor Instructions
	-s	Print System Information
	-M	Print Memory Controller
	-m	Print Topology
	-u	Print CPUID
	-k	Print Kernel
	-h	Print out this message

Exit status:
0	if OK,
1	if problems,
>1	if serious trouble.

Report bugs to labs[at]cyring.fr

See the project page for more options and info.

Share this on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 11 comments… add one }
  • JohnKore February 15, 2017, 11:35 am

    Great post!

    A small correction:
    For CentOS installation, it’s “yum groupinstall” (without the space between group and install).

    Reply
  • Bhaskar Chowdhury February 9, 2017, 3:55 pm

    Good find Vivek!

    Reply
    • Bhaskar Chowdhury February 9, 2017, 4:04 pm

      And by the way, you need to press “q” to get the above menu, I am on Gentoo and build it from git .

      Second thing ,when running with -s flag ,it aborted ..like below:

      bhaskar@GentooLinux_21:33:10_Thu Feb 09:~/git-linux/CoreFreq>./corefreq-cli -s
      Processor                             [Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz]
      |- Vendor ID                                                      [GenuineIntel]
      |- Signature                                                             [06_3D]
      |- Stepping                                                                [  4]
      |- Architecture                                               [Broadwell/Mobile]
      |- Online CPU                                                              [4/8]
      |- Base Clock                                                              [ 99]
      |- Ratio Boost:                                                                 
      |                      Min Max  8C  7C  6C  5C  4C  3C  2C  1C                  
      |                        5  22   -   -  25  25  25  25  25  27                  
      Instruction set:                                                                
      |- 3DNow!/Ext [N,N]           AES [Y]      AVX/AVX2 [Y/Y]        BMI1/BMI2 [Y/Y]
      |- CLFSH        [Y]          CMOV [Y]       CMPXCH8   [Y]         CMPXCH16   [Y]
      |- F16C         [Y]           FPU [Y]          FXSR   [Y]        LAHF/SAHF   [Y]
      |- MMX/Ext    [Y/N]       MONITOR [Y]         MOVBE   [Y]         PCLMULDQ   [Y]
      |- POPCNT       [Y]        RDRAND [Y]        RDTSCP   [Y]              SEP   [Y]
      |- SSE          [Y]          SSE2 [Y]          SSE3   [Y]            SSSE3   [Y]
      |- SSE4.1/4A  [Y/N]        SSE4.2 [Y]       SYSCALL   [Y]                       
                                                                                      
      Features:                                                                       
      |- 1 GB Pages Support                                      1GB-PAGES   [Present]
      |- 100 MHz multiplier Control                            100MHzSteps   [Missing]
      |- Advanced Configuration & Power Interface                     ACPI   [Present]
      |- Advanced Programmable Interrupt Controller                   APIC   [Present]
      |- Core Multi-Processing                                  CMP Legacy   [Missing]
      |- L1 Data Cache Context ID                                  CNXT-ID   [Missing]
      |- Direct Cache Access                                           DCA   [Missing]
      |- Debugging Extension                                            DE   [Present]
      |- Debug Store & Precise Event Based Sampling               DS, PEBS   [Present]
      |- CPL Qualified Debug Store                                  DS-CPL   [Present]
      |- 64-Bit Debug Store                                         DTES64   [Present]
      |- Fast-String Operation                                Fast-Strings   [Present]
      |- Fused Multiply Add                                       FMA|FMA4   [Present]
      |- Hardware Lock Elision                                         HLE   [Missing]
      |- Long Mode 64 bits                                         IA64|LM   [Present]
      |- LightWeight Profiling                                         LWP   [Missing]
      |- Machine-Check Architecture                                    MCA   [Present]
      |- Model Specific Registers                                      MSR   [Present]
      |- Memory Type Range Registers                                  MTRR   [Present]
      |- OS-Enabled Ext. State Management                          OSXSAVE   [Present]
      |- Physical Address Extension                                    PAE   [Present]
      |- Page Attribute Table                                          PAT   [Present]
      |- Pending Break Enable                                          PBE   [Present]
      |- Process Context Identifiers                                  PCID   [Present]
      |- Perfmon and Debug Capability                                 PDCM   [Present]
      |- Page Global Enable                                            PGE   [Present]
      |- Page Size Extension                                           PSE   [Present]
      |- 36-bit Page Size Extension                                  PSE36   [Present]
      |- Processor Serial Number                                       PSN   [Missing]
      |- Restricted Transactional Memory                               RTM   [Missing]
      |- Safer Mode Extensions                                         SMX   [Missing]
      |- Self-Snoop                                                     SS   [Present]
      |- Time Stamp Counter                                            TSC [  Variant]
      |- Time Stamp Counter Deadline                          TSC-DEADLINE   [Present]
      |- Virtual Mode Extension                                        VME   [Present]
      |- Virtual Machine Extensions                                    VMX   [Present]
      |- Extended xAPIC Support                                     x2APIC   [  xAPIC]                                                                                                                                    
      *** Error in `./corefreq-cli': free(): invalid next size (fast): 0x0000000000cfe090 ***
      ======= Backtrace: =========
      /lib64/libc.so.6(+0x6f133)[0x7f0ce321b133]
      /lib64/libc.so.6(+0x74796)[0x7f0ce3220796]
      /lib64/libc.so.6(+0x74f9e)[0x7f0ce3220f9e]
      ./corefreq-cli[0x4014c0]
      ./corefreq-cli[0x4039f7]
      ./corefreq-cli[0x424238]
      /lib64/libc.so.6(__libc_start_main+0xf0)[0x7f0ce31cc790]
      ./corefreq-cli[0x401029]
      ======= Memory map: ========
      00400000-00428000 r-xp 00000000 fb:00 65345                              /home/bhaskar/git-linux/CoreFreq/corefreq-cli
      00627000-00628000 r-xp 00027000 fb:00 65345                              /home/bhaskar/git-linux/CoreFreq/corefreq-cli
      00628000-00629000 rwxp 00028000 fb:00 65345                              /home/bhaskar/git-linux/CoreFreq/corefreq-cli
      00cfe000-00d1f000 rwxp 00000000 00:00 0                                  [heap]
      7f0cdc000000-7f0cdc021000 rwxp 00000000 00:00 0 
      7f0cdc021000-7f0ce0000000 ---p 00000000 00:00 0 
      7f0ce2b76000-7f0ce2b8c000 r-xp 00000000 08:07 21666003                   /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.4/libgcc_s.so.1
      7f0ce2b8c000-7f0ce2d8b000 ---p 00016000 08:07 21666003                   /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.4/libgcc_s.so.1
      7f0ce2d8b000-7f0ce2d8c000 r-xp 00015000 08:07 21666003                   /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.4/libgcc_s.so.1
      7f0ce2d8c000-7f0ce2d8d000 rwxp 00016000 08:07 21666003                   /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.4/libgcc_s.so.1
      7f0ce2d8d000-7f0ce2f90000 rw-s 00000000 00:17 80559                      /dev/shm/corefreq-shm
      7f0ce2f90000-7f0ce2fa7000 r-xp 00000000 08:07 54505121                   /lib64/libpthread-2.23.so
      7f0ce2fa7000-7f0ce31a6000 ---p 00017000 08:07 54505121                   /lib64/libpthread-2.23.so
      7f0ce31a6000-7f0ce31a7000 r-xp 00016000 08:07 54505121                   /lib64/libpthread-2.23.so
      7f0ce31a7000-7f0ce31a8000 rwxp 00017000 08:07 54505121                   /lib64/libpthread-2.23.so
      7f0ce31a8000-7f0ce31ac000 rwxp 00000000 00:00 0 
      7f0ce31ac000-7f0ce333c000 r-xp 00000000 08:07 54505142                   /lib64/libc-2.23.so
      7f0ce333c000-7f0ce353b000 ---p 00190000 08:07 54505142                   /lib64/libc-2.23.so
      7f0ce353b000-7f0ce353f000 r-xp 0018f000 08:07 54505142                   /lib64/libc-2.23.so
      7f0ce353f000-7f0ce3541000 rwxp 00193000 08:07 54505142                   /lib64/libc-2.23.so
      7f0ce3541000-7f0ce3545000 rwxp 00000000 00:00 0 
      7f0ce3545000-7f0ce354b000 r-xp 00000000 08:07 54505120                   /lib64/librt-2.23.so
      7f0ce354b000-7f0ce374b000 ---p 00006000 08:07 54505120                   /lib64/librt-2.23.so
      7f0ce374b000-7f0ce374c000 r-xp 00006000 08:07 54505120                   /lib64/librt-2.23.so
      7f0ce374c000-7f0ce374d000 rwxp 00007000 08:07 54505120                   /lib64/librt-2.23.so
      7f0ce374d000-7f0ce3851000 r-xp 00000000 08:07 54505111                   /lib64/libm-2.23.so
      7f0ce3851000-7f0ce3a50000 ---p 00104000 08:07 54505111                   /lib64/libm-2.23.so
      7f0ce3a50000-7f0ce3a51000 r-xp 00103000 08:07 54505111                   /lib64/libm-2.23.so
      7f0ce3a51000-7f0ce3a52000 rwxp 00104000 08:07 54505111                   /lib64/libm-2.23.so
      7f0ce3a52000-7f0ce3a75000 r-xp 00000000 08:07 54459364                   /lib64/ld-2.23.so
      7f0ce3c54000-7f0ce3c58000 rwxp 00000000 00:00 0 
      7f0ce3c73000-7f0ce3c75000 rwxp 00000000 00:00 0 
      7f0ce3c75000-7f0ce3c76000 r-xp 00023000 08:07 54459364                   /lib64/ld-2.23.so
      7f0ce3c76000-7f0ce3c77000 rwxp 00024000 08:07 54459364                   /lib64/ld-2.23.so
      7f0ce3c77000-7f0ce3c78000 rwxp 00000000 00:00 0 
      7ffe754b9000-7ffe754da000 rwxp 00000000 00:00 0                          [stack]
      7ffe75503000-7ffe75505000 r--p 00000000 00:00 0                          [vvar]
      7ffe75505000-7ffe75507000 r-xp 00000000 00:00 0                          [vdso]
      ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
      Aborted
      Reply
  • Jerald February 8, 2017, 3:05 pm

    I’m concerned that an out-of-the-box implementation of this on a clean CentOS7 VM, installed as a “minimal” and then following specifically the above steps does not work. The Makefile says a certain path does not exist, yet I can manually navigate to that path without error.

    Reply
    • CyrIng February 8, 2017, 11:20 pm

      Even in a VM (which is not the way to do w/ CoreFreq), all the building path are relative to the workspace directory : you may check your development environment (kernel, libc, gcc)
      If you need help, feel free to ask @ https://github.com/cyring/CoreFreq/issues

      Reply
  • CyrIng February 8, 2017, 1:02 pm

    To avoid segfault in UI, blacklist or disable nmi_watchdog in your kernel args :
    nmi_watchdog=0

    Reply
  • Nan Xiao February 8, 2017, 12:23 am

    A typo in “Finallym start the client, run:”: should be “Finally”.

    Reply
  • herauthon February 7, 2017, 11:44 pm

    Installed successfully the corefreqd/corefreq-cli on two machines

    i need more time to match results
    but on one of the machines it does segment-fault alot..
    takes less then a minute –
    si:) CPU: Dual core Intel Core2 Duo E8400 (-MCP-) cache: 6144 KB
    Clock Speeds: 1: 2003 MHz 2: 2003 MHz

    pt:)
    Feb 07 15:40:13 mylittlesmurver kernel: [275658.846789] corefreq-cli[26978]: segfault at 637337 ip 00007f6f1633c04e sp 00007ffe7a7854c8 error 4 in libc-2.19.so[7f6f162aa000+1a1000]
    Feb 07 15:40:13 mylittlesmurver kernel: [275658.846789] corefreq-cli[26978]: segfault at 637337 ip 00007f6f1633c04e sp 00007ffe7a7854c8 error 4 in libc-2.19.so[7f6f162aa000+1a1000]
    Feb 07 15:40:31 mylittlesmurver kernel: [275676.838658] corefreq-cli[26979]: segfault at 6371d6 ip 00007f7ebf00704e sp 00007ffe7ce5a6c8 error 4 in libc-2.19.so[7f7ebef75000+1a1000]
    Feb 07 15:40:31 mylittlesmurver kernel: [275676.838658] corefreq-cli[26979]: segfault at 6371d6 ip 00007f7ebf00704e sp 00007ffe7ce5a6c8 error 4 in libc-2.19.so[7f7ebef75000+1a1000]

    Reply
    • CyrIng February 8, 2017, 8:55 am

      Hello,

      To eliminate segmentation faults, be sure to deactivate nmi_watchdog, before starting corefreqk.ko driver : this lets the driver access the cores counters without conflict on msr registers.

      In your kernel boot loader (SysLinux, Grub) add :
      nmi_watchdog=0

      See FAQ @ github.com/cyring/CoreFreq/blob/master/README.md#qa

      Reply
Security: Are you a robot or human?

Leave a Comment