有没有办法在Linux系统上禁用CPU缓存(L1 / L2)? [英] Is there a way to disable CPU cache (L1/L2) on a Linux system?
问题描述
我正在分析Linux系统上的一些代码(运行于英特尔酷睿i7 4500U上)以获取执行成本的时间。该应用程序是来自libmpeg2的demo mpeg2dec。我正试图获得mpeg2执行时间的概率分布。但是,我们希望在关闭缓存时查看原始执行成本。
有没有办法通过Linux命令或通过gcc标志禁用系统的cpu缓存?甚至将cpu(L1 / L2)缓存大小设置为0KB?甚至添加一些代码更改为禁用缓存?当然,不需要修改或重建内核。
看到这个2012的线程,有人发布了一个微内核模块源来禁用缓存通过asm。
http://www.linuxquestions.org/questions/linux-kernel-70/disabling-cpu-caches-936077/
I am profiling some code on a Linux system (running on Intel Core i7 4500U) to obtain the time of ONLY the execution costs. The application is the demo mpeg2dec from libmpeg2. I am trying to obtain a probability distribution for the mpeg2 execution times. However we want to see the raw execution cost when cache is switched off.
Is there a way I can disable the cpu cache of my system via a Linux command, or via a gcc flag ? or even set the cpu (L1/L2) cache size to 0KB ? or even add some code changed to disable cache ? Of course, without modifying or rebuilding the kernel.
See this 2012 thread, someone posted a tiny kernel module source to disable cache through asm.
http://www.linuxquestions.org/questions/linux-kernel-70/disabling-cpu-caches-936077/
这篇关于有没有办法在Linux系统上禁用CPU缓存(L1 / L2)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!