Analyzers
Community support for Analyzers (Intel VTune™ Profiler, Intel Advisor, Intel Inspector)
4963 Discussions

Measuring cache misses using VTune

arjunharikumar
1,774 Views

I'm a beginner to Intel vTune. I wish to compare the cache performances of two versions of a Java application in an Intel Alderlake-S processor. I am a running my benchmarks on a Linux server which has vTune set up and ready. When I profile information using memory-access action I can't find specific sections relating to L1- cache misses or L2- cache misses in the report summary. I am specifically trying to measure the impact on cache for the applications. Is it the right action to use and is there separate knobs to enable these measurements?

Thanks in advance.

Labels (1)
0 Kudos
1 Solution
ThasneemV_Intel
Moderator
1,604 Views

Hi,

We suggest you run the following commands to perform the analysis in Linux server machine using CLI.

1.To source the environment variables:

source /opt/intel/oneapi/setvars.sh


2.To collect data on memory access analysis:

vtune -collect memory-access -r <path of result directory> -- ./<name of the application>


For reference: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-0/run-memory-access-analysis-command-line.html

3.To get hardware events in CSV format:

vtune -report hw-events -result-dir <dir> -report-output <path/filename.csv> -format csv -csv-delimiter comma
  •  <dir> is the location of the result directory.
  •  <path/filename> is the PATH and filename of the report file to be created.

For reference: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-0/saving-and-formatting-reports.html

The hardware events "CYCLE_ACTIVITY.STALLS_L1D_MISS" and "CYCLE_ACTIVITY.STALLS_L2_MISS" are given as column names in the output CSV file. These features can be used to measure the impact on cache for the application.

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issue. Thank you!

Regards,
Thasneem Vazim

View solution in original post

0 Kudos
7 Replies
ThasneemV_Intel
Moderator
1,687 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Please follow the instructions below to get information regarding L1- cache misses or L2- cache misses while profiling the application using Vtune Profiler.

  1. Run Vtune Profiler as administrator. 
  2. Click on Configure Analysis option in the home page.
  3. Configure the analysis by following the screenshot below: 

ThasneemV_Intel_0-1683134743184.png

 

Once the data collection has ended, you can see the analysis results.

4. Please select “Hardware Events” option in the drop-down box as shown below. 

ThasneemV_Intel_1-1683134955909.png

 

In the Summary pane, you will be provided with a list of Hardware event types.

The hardware event "CYCLE_ACTIVITY.STALLS_L1D_MISS" counts the number of cycles during which the CPU was stalled in response to an L1 data cache miss. The "CYCLE_ACTIVITY.STALLS_L2_MISS" hardware event measures the number of cycles during which the processor was stalled due to an L2 cache miss.

These events may be used to discover cache misses-related performance issues and optimize the application's memory access pattern to reduce cache misses. 

 

5. After you click on the required blue hyperlink in the above step you will be navigated to the Events Count window as follows:

ThasneemV_Intel_2-1683135049515.png

 

 

For more information on hardware events, you can refer the below link.

https://perfmon-events.intel.com/ahybrid.html 

 

We could also see that you’re trying to compare two results. Below are the steps to do the same: 

  1. On Vtune Profiler Welcome page, you can click on the highlighted option: 

ThasneemV_Intel_4-1683135238074.png

 

      2. Your comparison results would look like the screenshot attached below: 

ThasneemV_Intel_3-1683135110074.png

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issue. Thank you!

 

Regards,

Thasneem Vazim

 

 

 

 

 

 

 

 

0 Kudos
arjunharikumar
1,665 Views

Hi Thasneem,

 

Thanks for the detailed solution. The problem I am faced with is that I am running my analysis on a linux server machine as mentioned above (No GUI). So using CLI how do I enable the hardware events to profile?

0 Kudos
ThasneemV_Intel
Moderator
1,605 Views

Hi,

We suggest you run the following commands to perform the analysis in Linux server machine using CLI.

1.To source the environment variables:

source /opt/intel/oneapi/setvars.sh


2.To collect data on memory access analysis:

vtune -collect memory-access -r <path of result directory> -- ./<name of the application>


For reference: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-0/run-memory-access-analysis-command-line.html

3.To get hardware events in CSV format:

vtune -report hw-events -result-dir <dir> -report-output <path/filename.csv> -format csv -csv-delimiter comma
  •  <dir> is the location of the result directory.
  •  <path/filename> is the PATH and filename of the report file to be created.

For reference: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-0/saving-and-formatting-reports.html

The hardware events "CYCLE_ACTIVITY.STALLS_L1D_MISS" and "CYCLE_ACTIVITY.STALLS_L2_MISS" are given as column names in the output CSV file. These features can be used to measure the impact on cache for the application.

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issue. Thank you!

Regards,
Thasneem Vazim

0 Kudos
arjunharikumar
1,563 Views

Thanks Thasneem.

This seems to resolve my issue. Also is there a way I can get a summary of the hw event data rather than function-wise info?

0 Kudos
ThasneemV_Intel
Moderator
1,501 Views

Hi,

The summary of the hardware event data can be obtained using the VTune backend.

Please find the commands below to access VTune backend and view the summary report.

1. To access VTune Profiler Server using specific TCP port, specify it with the --web-port option as given below:

vtune-backend --allow-remote-access --enable-server-profiling --web-port=8080

2. VTune Profiler Server outputs a URL to access the GUI. For the first run, the URL includes a one-time token. The output will look like the screenshot attached below.

ThasneemV_Intel_0-1684126642119.png

3. Open the highlighted URL in a web browser.

4. Set a Passphrase in the Set Passphrase dialog box.

Now you will be redirected to VTune backend similar to GUI in the webpage as shown in the screenshot below:

ThasneemV_Intel_1-1684126676028.png

For reference:https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-0/web-server-ui.html#GUID-82A68996-3964-4F4A-832F-1C3A672583F5

 

5. Once the GUI is obtained, you can get the summary of hardware events by following the steps provided earlier in this thread.

 

As your initial issue is resolved and we have provided steps to view summary of hardware events, please let us know if we can discontinue monitoring this thread.

 

Regards,

Thasneem Vazim

0 Kudos
arjunharikumar
1,406 Views

Thanks Thasneem. This is much helpful.

0 Kudos
ThasneemV_Intel
Moderator
1,384 Views

Hi,


Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Regards,

Thasneem Vazim


0 Kudos
Reply