# CoreFreq
## Purpose
CoreFreq, a CPU monitoring software with BIOS like functionalities, is designed for the 64-bits Processors of architecture Intel Atom, Core2, Nehalem, SandyBridge and superiors; AMD Families 0Fh, 17h (Zen)
![alt text](http://blog.cyring.free.fr/images/CoreFreq_Top.gif "CoreFreq Top")
CoreFreq provides a framework to retrieve CPU data with a high degree of precision:
* Core frequencies & ratios; SpeedStep (EIST), Turbo Boost, Hyper-Threading (HTT) and Base Clock
* Performance counters including Time Stamp Counter (TSC), Unhalted Core Cycles (UCC), Unhalted Reference Cycles (URC)
* Number of instructions per cycle or second, IPS, IPC, or CPI
* CPU C-States C0 C1 C3 C6 C7 - C1E - Auto/UnDemotion of C1 C3
* DTS Temperature and Tjunction Max, Thermal Monitoring TM1 TM2 state, Vcore
* Topology map including Caches for boostrap & application CPU
* Processor features, brand & architecture strings
* In progress: Uncore, Memory Controller channels & geometry, DIMM timings,
Stress tools, Power & Energy (RAPL, OSPM, HWP, TDP), Overclocking, cpuidle & cpufreq driver, Mitigation Mechanisms
To reach this goal, CoreFreq implements a Linux Kernel module which employs the followings:
* asm code to keep as near as possible the readings of the performance counters;
* per-CPU, implements slab data memory and high-resolution timer;
* compliant with suspend / resume and CPU Hot-Plug;
* a shared memory to protect kernel from the user-space part of the software;
* atomic synchronization of threads to avoid mutexes and deadlock.
## Build & Run
### Prerequisites
**a-** _Intel only_: For a better accuracy, *disable* the Kernel *NMI Watchdog*
Add the below parameter in the kernel boot loader (Grub, SysLinux) ...
```
nmi_watchdog=0
```
... and build with the fixed performance counters
```
make MSR_CORE_PERF_UC=MSR_CORE_PERF_FIXED_CTR1 MSR_CORE_PERF_URC=MSR_CORE_PERF_FIXED_CTR2
```
**b-** _AMD and Intel_: No Virtualization
VMs don't provide access to the registers that the CoreFreq driver employs :
* Fixed Performance Counters
* Model Specific Registers
* PCI Registers
**c-** Rendering
The UI renders best with an ASCII 7-Bit console or Xterm with VT100 and ANSI colors support
### Dependencies
* The Linux Kernel with a minimum version 3.3
* The GNU C Library
### Build
0. Software needed:
* GNU C Compiler with GNU extensions
* GNU Make tool
* Header files for building modules for Linux kernel
1. Clone the source code into a working directory.
:heavy_dollar_sign:`git clone https://github.com/cyring/CoreFreq.git`
2. Build the programs.
:heavy_dollar_sign:`cd CoreFreq`
:heavy_dollar_sign:`make`
```
cc -Wall -pthread -c corefreqd.c -o corefreqd.o
cc -Wall -c corefreqm.c -o corefreqm.o
cc corefreqd.c corefreqm.c -o corefreqd -lpthread -lm -lrt
cc -Wall -c corefreq-cli.c -o corefreq-cli.o
cc -Wall -c corefreq-ui.c -o corefreq-ui.o
cc corefreq-cli.c corefreq-ui.c -o corefreq-cli -lm -lrt
make -C /lib/modules/x.y.z/build M=/workdir/CoreFreq modules
make[1]: Entering directory '/usr/lib/modules/x.y.z/build'
CC [M] /workdir/CoreFreq/corefreqk.o
Building modules, stage 2.
MODPOST 1 modules
CC /workdir/CoreFreq/corefreqk.mod.o
LD [M] /workdir/CoreFreq/corefreqk.ko
make[1]: Leaving directory '/usr/lib/modules/x.y.z/build'
```
### Install
### Start
When installed:
3. Load the kernel module, as root.
:hash:`modprobe corefreqk`
4. Start the daemon, as root.
:hash:`systemctl start corefreqd`
5. Start the client, as a user.
:heavy_dollar_sign:`corefreq-cli`
When built from source:
3. Load the kernel module, as root.
:hash:`insmod corefreqk.ko`
4. Start the daemon, as root.
:hash:`corefreqd`
5. Start the client, as a user (_in another terminal or console_).
:heavy_dollar_sign:`corefreq-cli`
### Stop
6. Press [CTRL]+[C] to stop the client.
7. Press [CTRL]+[C] to stop the daemon (in foreground) or kill its background job.
8. Unload the kernel module
:hash:`rmmod corefreqk.ko`
### Try
Download the CoreFreq Live CD from the [Wiki](http://github.com/cyring/CoreFreq/wiki/Live-CD)
![alt text](http://blog.cyring.free.fr/images/CoreFreq_LiveCD_Step1.png "CoreFreq for ArchLinux")
## Screenshots
### Linux kernel module
Use `lsmod`, `dmesg` or `journalctl -k` to check if the module is started
```
CoreFreq: Processor [06_1A] Architecture [Nehalem/Bloomfield] CPU [8/8]
```
### Daemon
```
CoreFreq Daemon. Copyright (C) 2015-2019 CYRIL INGENIERIE
Processor [Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz]
Architecture [Nehalem/Bloomfield] 8/8 CPU Online.
```
### Client
Without arguments, the corefreq-cli program displays Top Monitoring
![alt text](http://blog.cyring.free.fr/images/CoreFreq_Tour_2017-12-06.gif "CoreFreq UI")
_Remark_: Drawing will stall if the terminal width is lower than 80 columns, or its height is less than required.
* With the option '-c', the client traces counters.
![alt text](http://blog.cyring.free.fr/images/CoreFreq_Counters.gif "CoreFreq Counters")
* Using option '-m' corefreq-cli shows the CPU topology
![alt text](http://blog.cyring.free.fr/images/CoreFreq_Topology.png "CoreFreq CPU & caches topology")
* With the option '-i' corefreq-cli traces the number of instructions per second / cycle
```
CPU IPS IPC CPI
#00 0.000579/s 0.059728/c 16.742698/i
#01 0.000334/s 0.150569/c 6.641471/i
#02 0.000598/s 0.161326/c 6.198641/i
#03 0.000294/s 0.233535/c 4.282013/i
#04 0.000240/s 0.042931/c 23.293141/i
#05 0.000284/s 0.158661/c 6.302765/i
#06 0.000128/s 0.128031/c 7.810631/i
#07 0.000088/s 0.150406/c 6.648674/i
```
* Use the option '-s' to show the Processor information (BSP)
![alt text](http://blog.cyring.free.fr/images/CoreFreq_SysInfo.png "CoreFreq System Info")
## ArchLinux
[corefreq-git](https://aur.archlinux.org/packages/corefreq-git) can be installed from the Arch User Repository.
## Debian, Ubuntu
* Installing the DKMS package will pull the Kernel development packages
:hash:`apt-get install dkms`
* Or, install selectively the development packages prerequisites.
:hash:`apt-get install libpthread-stubs0-dev`
## Red Hat, CentOS
* Development packages prerequisites.
:hash:`yum install kernel-devel`
:hash:`yum group install "Development Tools"`
## Q&A
* Q: Turbo Technology is activated however CPUs don't reach those frequencies ?
* Q: The CPU ratio does not go above its minimum value ?
* Q: The UI shows erratic counters values !
A: In the kernel boot command argument line, *disable the NMI Watchdog*
```
nmi_watchdog=0
```
* Q: The Processor does not enter the C-States ?
A: Check if at least one Idle driver is running.
Accordingly to the Processor specs, provide a max_cstate value in the kernel argument as below.
```
intel_idle.max_cstate=value
```
A: CoreFreq can also register itself as a cpuidle driver.
This time, any idle driver will have to be blacklisted in the kernel command line; such as:
```
modprobe.blacklist=intel_cstate idle=halt intel_idle.max_cstate=0
```
Start the CoreFreq driver with the `Register_CPU_Idle` parameter:
```
insmod corefreqk.ko Register_CPU_Idle=1
```
* Q: The CoreFreq UI refreshes itself slowly, with a delay after the actual CPUs usage ?
A: The sampling time to read the counters can be reduced or increased using a CoreFreq module argument:
:hash:`insmod corefreqk.ko SleepInterval=value`
where `<value>` is supplied in milliseconds between a minimum of 100 ms and a maximum of 4500 ms. 1000 ms is the default value.
* Q: The base clock reports a wrong frequency value ?
A: CoreFreq uses various algorithms to estimate the base clock.
1. The delta of two TimeStamp counters during a defined interval
2. The value provided in the Processor brand string divided by the maximum ratio (without Turbo)
3. A static value advertised by the manufacture
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
CoreFreq, a CPU monitoring software with BIOS like functionalities, is designed for the 64-bits Processors of architecture Intel Atom, Core2, Nehalem, SandyBridge and superiors; AMD Families 0Fh, 17h (Zen)
资源推荐
资源详情
资源评论
收起资源包目录
CoreFreq.zip (30个子文件)
CoreFreq-master
corefreq-ui.h 24KB
corefreq-cli-json.h 175B
dkms.conf 868B
bitasm.h 16KB
coretypes.h 46KB
amdmsr.h 17KB
corefreqm.c 8KB
corefreq-cli-json.c 63KB
LICENSE 18KB
corefreqk.c 245KB
corefreq-cli-rsc.c 70KB
scripter.sh 455B
corefreq-cli.h 10KB
corefreqd.service 291B
corefreq-cli-rsc-en.h 31KB
corefreq.h 8KB
corefreq-cli-extra.h 918B
intelmsr.h 54KB
corefreqd.c 133KB
corefreq-api.h 17KB
corefreqk.h 127KB
Makefile 5KB
corefreq-cli-rsc-fr.h 32KB
README.md 12KB
corefreqm.h 2KB
corefreq-cli.c 307KB
corefreq-cli-extra.c 5KB
CoreFreq.svg 73KB
corefreq-cli-rsc.h 73KB
corefreq-ui.c 32KB
共 30 条
- 1
资源评论
局外狗
- 粉丝: 77
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功