This is a little bash script to get the CPU cache ratios on Ubuntu.
1 2 3 4 5 6
Cache Level: (1, 2 or 3) Cache Type: (data-, instruction or general cache) Capacity: of the respective cache Associativity: (set size) Block capacity: / capacity of a cache line Number of sets: ((total capacity / block capacity) / associativity)
for DIR0 in /sys/devices/system/cpu/cpu0/cache/* do LEVEL0=$(sudocat$DIR0\/level) TYPE0=$(sudocat$DIR0\/type) SIZE0=$(sudocat$DIR0\/size) ASSOC0=$(sudocat$DIR0\/ways_of_associativity) BLOCK0=$(sudocat$DIR0\/coherency_line_size) SETS0=$(sudocat$DIR0\/number_of_sets)
Comments