由/ sys / device /和dmidecode报告的不同CPU高速缓存大小(different CPU cache size reported by /sys/device/ and dmid

编程入门 行业动态 更新时间:2024-10-26 16:28:53
由/ sys / device /和dmidecode报告的不同CPU高速缓存大小(different CPU cache size reported by /sys/device/ and dmidecode)

我试图在系统中获取不同缓存级别的大小。

我尝试了两种技巧。

a)使用/ sys / device中的信息。 这是输出。

$ cat /sys/devices/system/cpu/cpu0/cache/index1/size 32K $ cat /sys/devices/system/cpu/cpu0/cache/index2/size 256K $ cat /sys/devices/system/cpu/cpu0/cache/index3/size 8192K

b)使用来自dmidecode的信息

$ sudo dmidecode -t cache Cache Information Socket Designation: CPU Internal L1 Configuration: Enabled, Not Socketed, Level 1 Operational Mode: Write Through Location: Internal Installed Size: 256 KB Maximum Size: 256 KB < .... > Cache Information Socket Designation: CPU Internal L2 Configuration: Enabled, Not Socketed, Level 2 Operational Mode: Write Through Location: Internal Installed Size: 1024 KB Maximum Size: 1024 KB < .... > Cache Information Socket Designation: CPU Internal L3 Configuration: Enabled, Not Socketed, Level 3 Operational Mode: Write Back Location: Internal Installed Size: 8192 KB Maximum Size: 8192 KB < .... >

L2和L3高速缓存的报告大小不同。 任何想法a)为什么这种差异? b)哪种方法给出了正确的值?

其他相关信息:

$uname -a Linux 3.0.0-14-generic #23somerville3-Ubuntu SMP Mon Dec 12 09:20:18 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 58 model name : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz stepping : 9 cpu MHz : 2400.000 cache size : 8192 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms bogomips : 6784.23 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: < ... >

I'm trying to get the size of different cache level in my system.

I tried two techniques.

a) Using information from /sys/device. Here is the output.

$ cat /sys/devices/system/cpu/cpu0/cache/index1/size 32K $ cat /sys/devices/system/cpu/cpu0/cache/index2/size 256K $ cat /sys/devices/system/cpu/cpu0/cache/index3/size 8192K

b) Using information from dmidecode

$ sudo dmidecode -t cache Cache Information Socket Designation: CPU Internal L1 Configuration: Enabled, Not Socketed, Level 1 Operational Mode: Write Through Location: Internal Installed Size: 256 KB Maximum Size: 256 KB < .... > Cache Information Socket Designation: CPU Internal L2 Configuration: Enabled, Not Socketed, Level 2 Operational Mode: Write Through Location: Internal Installed Size: 1024 KB Maximum Size: 1024 KB < .... > Cache Information Socket Designation: CPU Internal L3 Configuration: Enabled, Not Socketed, Level 3 Operational Mode: Write Back Location: Internal Installed Size: 8192 KB Maximum Size: 8192 KB < .... >

The size reported for L2 and L3 cache is different. Any ideas as to a) why this discrepancy? b) Which method gives the correct value?

Other related information:

$uname -a Linux 3.0.0-14-generic #23somerville3-Ubuntu SMP Mon Dec 12 09:20:18 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 58 model name : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz stepping : 9 cpu MHz : 2400.000 cache size : 8192 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms bogomips : 6784.23 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: < ... >

最满意答案

一些东西:

你有一个四核CPU /sys/devices/system/cpu/cpu<n>/cache中的index<n>名称不对应于L1 / L2 / L3等。有一个.../index<n>/level文件可以告诉你的缓存级别。 您的一级缓存分为两个缓存(可能是index0和index1 ),一个用于数据,另一个用于指令(请参阅.../index<n>/type ),每个核心。 4核* 2个半* 32K匹配dmidecode报告的256K。 二级缓存按每核心分割。 4核* 256K(来自index2 )= 1024K,与dmidecode的L2编号相匹配。

A few things:

You have a quad-core CPU The index<n> name in /sys/devices/system/cpu/cpu<n>/cache does not correspond to L1/L2/L3 etc. There is a .../index<n>/level file that will tell you the level of the cache. Your L1 cache is split into two caches (likely index0 and index1), one for data, and one for instructions (see .../index<n>/type), per core. 4 cores * 2 halves * 32K matches the 256K that dmidecode reports. The L2 cache is split per-core. 4 cores * 256K (from index2) = 1024K, which matches dmidecodes L2 number.

更多推荐

本文发布于:2023-07-23 00:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1225238.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高速缓存   大小   报告   sys   device

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!