Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the last level cache details using libpfc #24

Open
duttasankha opened this issue Apr 8, 2019 · 1 comment
Open

How to get the last level cache details using libpfc #24

duttasankha opened this issue Apr 8, 2019 · 1 comment

Comments

@duttasankha
Copy link

Hello

I am new to use the performance counter measurement and specially libpfc. I am using a 7th generation intel processor and I was wondering if I can use libpfc to measure the last level cache miss per slice details as mentioned here. I am referring to this uncore performance monitoring for 6th generation processor to get the desired result. I would really appreciate if I could get some help regarding what should I need to do to use the libpfc to measure the per sliced based LLC miss. Thank you.

@obilaniu
Copy link
Owner

obilaniu commented Apr 9, 2019

@duttasankha libpfc certainly can't program the uncore PMU (including its CB0 counters). You might be able to program the llc.miss counter, however. Start from and modify my pfcdemo.c, but use pfcParseCfg("llc.miss") plus anything else you'd like to measure.

I just want to make extra clear here that the pfcPinThread() is critical. libpfc and pfc.ko only program the counters for a single core and can't "move" counters with a process. If the thread moves cores, it will read some entirely unrelated counter values. Also, if another process starts executing on that core, it will increment the counters as well.

This code is quite fragile, and was meant mostly for reading the counters for relatively-uncomplicated CPU-bound loops with absolutely minimal overhead. It's probably not ideal for your task. For something more industry-grade, look at a combination of

  • libpfm, which gives you the event codes (the return value of pfcParseCfg()) but doesn't program the performance counters, and
  • perf_event_open(), which uses the official Linux kernel interface to program the counters properly (without all the dangers in my code), but does not provide the event codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants