如何使用冷缓存启动程序

时间:2022-03-29 20:49:04

I run a benchmark several times, to note down the mean reading. But I notice that after the first run, the subsequent runs are faster. I guess it has something to do with the Instruction Cache, so when I run the program next time, the benchmark already has instructions in the cache. Is there a way to start a program with both cold instruction and data caches?

我多次运行基准测试,记下平均读数。但我注意到在第一次运行后,后续运行速度更快。我猜它与指令缓存有关,所以当我下次运行程序时,基准测试已经在缓存中有指令。有没有办法用冷指令和数据缓存启动程序?

1 个解决方案

#1


4  

This is a normal behavior. One way to avoid this problem is run few warm up before the main run. These warm up runs will overwrite the cache memory that grown up previously running program. While calculating the mean value, exclude the warm up runs values only take real run. A various bench marking tools out there which takes these approach like. kernbench, lmbench etc. Where a warmup value is available.

这是正常的行为。避免这个问题的一种方法是在主要运行之前进行少量预热。这些预热运行将覆盖之前运行的程序长大的缓存。在计算平均值时,排除预热运行值仅采用实际运行。各种基准标记工具都采用了这些方法。 kernbench,lmbench等。有可用的预热值。

And, if the benchmark you're running depends on data that needs to read from disk then, disk caching has some impact too, one way to avoid is to caching those data onto ram, if possible. This technique is used in kernbench, to avoid, disk cache related issue.

而且,如果您运行的基准测试依赖于需要从磁盘读取的数据,那么磁盘缓存也会产生一些影响,一种方法是尽可能将这些数据缓存到RAM上。此技术用于kernbench,以避免与磁盘缓存相关的问题。

#1


4  

This is a normal behavior. One way to avoid this problem is run few warm up before the main run. These warm up runs will overwrite the cache memory that grown up previously running program. While calculating the mean value, exclude the warm up runs values only take real run. A various bench marking tools out there which takes these approach like. kernbench, lmbench etc. Where a warmup value is available.

这是正常的行为。避免这个问题的一种方法是在主要运行之前进行少量预热。这些预热运行将覆盖之前运行的程序长大的缓存。在计算平均值时,排除预热运行值仅采用实际运行。各种基准标记工具都采用了这些方法。 kernbench,lmbench等。有可用的预热值。

And, if the benchmark you're running depends on data that needs to read from disk then, disk caching has some impact too, one way to avoid is to caching those data onto ram, if possible. This technique is used in kernbench, to avoid, disk cache related issue.

而且,如果您运行的基准测试依赖于需要从磁盘读取的数据,那么磁盘缓存也会产生一些影响,一种方法是尽可能将这些数据缓存到RAM上。此技术用于kernbench,以避免与磁盘缓存相关的问题。