homework
sysprog2017
contributed by <Jetudie
>
้ก็ฎ๏ผ C02: phonebook
ๅๅบCPU่ณ่จ
$ lscpu
(่ฆๆด่ฉณ็ดฐไบ่งฃไนๅฏไปฅ็จ $ cat /proc/cpuinfo
)
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz
Stepping: 3
CPU MHz: 799.865
CPU max MHz: 3100.0000
CPU min MHz: 800.0000
BogoMIPS: 4988.06
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
ๅๅบ็ณป็ตฑ็ธ้่ณ่จ
$ uname -a
Linux michael-Lenovo-IdeaPad-Z510 4.10.0-35-generic #39-Ubuntu SMP Wed Sep 13 07:46:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
ๆธ
็ฉบ cache, ๆชข่ฆไธไธ่ณๆบ (ๅช้ terminal ็ๆ
ๆณ)
$ echo 1 | sudo tee /proc/sys/vm/drop_caches
$ free
total used free shared buff/cache available
Mem: 8087436 281492 7619884 61484 186060 7543304
Swap: 10000380 0 10000380
$ make plot
$ make cache-test
Performance counter stats for './phonebook_opt' (100 runs):
35,407 cache-misses # 46.277 % of all cache refs ( +- 0.28% )
76,511 cache-references ( +- 0.37% )
88,826,649 instructions # 1.53 insn per cycle ( +- 0.00% )
58,161,375 cycles ( +- 0.19% )
0.128115937 seconds time elapsed ( +- 0.72% )