How to programmatically get the CPU cache page size in C++?

后端 未结 7 1570
渐次进展
渐次进展 2020-12-13 04:49

I\'d like my program to read the cache line size of the CPU it\'s running on in C++.

I know that this can\'t be done portably, so I will need a solution for Linux an

7条回答
  •  执笔经年
    2020-12-13 05:29

    Looks like at least SCO unix (http://uw714doc.sco.com/en/man/html.3C/sysconf.3C.html) has _SC_CACHE_LINE for sysconf. Perhaps other platforms have something similar?

提交回复
热议问题