linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Performance Events/Hw Cache Miss counting
@ 2011-10-15  2:12 Sujamol James
  0 siblings, 0 replies; 2+ messages in thread
From: Sujamol James @ 2011-10-15  2:12 UTC (permalink / raw)
  To: linux-perf-users

Hi All,

I am trying to query the performance management counters on my box, which is 
based on Kernel 2.6.38 and running Intel processor.  I am trying to do the 
same from my kernel module itself as I need to profile my kernel modules. I 
use the perf_event_create_kernel_counter() api with the following attr/config

The below  attrs/configuration is working and I am getting the counter 
values/overflow_handler is getting called.
static struct perf_event_attr counter_attrs[] = {
{
  	{
	 .type		 = PERF_TYPE_HARDWARE,
	 .config	 	= PERF_COUNT_HW_CACHE_MISSES,
	 .size		 = sizeof(struct perf_event_attr),
	 .pinned	 = 1,
	 .disabled	 = 0,
	 },
 };

But, when I use the following attrs/config, the 
perf_event_create_kernel_counter() API is failing.  Ie,  (IS_ERR
(returned_pevent) is TRUE and the event is not triggered on the CPU.  I even 
used “PERF_TYPE_HARDWARE” type also with the below config.
static struct perf_event_attr counter_attrs[] = {
{
	.type		  =  PERF_TYPE_HW_CACHE,
 .config	  =	 PERF_COUNT_HW_CACHE_L1D 			   <<  
0  |
		   	(PERF_COUNT_HW_CACHE_OP_READ 		   <<  8) |
			(PERF_COUNT_HW_CACHE_RESULT_MISS 	   << 16),
	.size	  = sizeof(struct perf_event_attr),
	.pinned   = 1,
	.disabled = 0,
	},
 };

Does anybody know why?. What “config” value  I should use to query the L1D/ 
L1I cache misses. I think the “PERF_COUNT_HW_CACHE_MISSES” counts only 2nd and 
3rd level caches.

Thanks,
Suja

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Performance Events/Hw Cache Miss counting
@ 2011-10-17 18:32 SUJA JAMES
  0 siblings, 0 replies; 2+ messages in thread
From: SUJA JAMES @ 2011-10-17 18:32 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org; +Cc: linux-perf-users@vger.kernel.org

Message body
Hi All,

I am trying to query the performance management counters on my box,
which is based on Kernel 2.6.38 and running Intel processor.  I am
trying to do the same from my kernel module itself as I need to
profile my kernel modules. I use the
perf_event_create_kernel_counter() api with the following attr/config

The below  attrs/configuration is working and I am getting the counter
values/overflow_handler is getting called.
static struct perf_event_attr counter_attrs[] = {
{
      {
    .type        = PERF_TYPE_HARDWARE,
    .config        = PERF_COUNT_HW_CACHE_MISSES,
    .size        = sizeof(struct perf_event_attr),
    .pinned    = 1,
    .disabled    = 0,
    },
};

But, when I use the following attrs/config, the
perf_event_create_kernel_counter() API is failing.  Ie,
(IS_ERR(returned_pevent) is TRUE and the event is not triggered on the
CPU.  I even tried “PERF_TYPE_HARDWARE” type also with the below
config. Also I used different values for "sample_period" [100 to 1000]

static struct perf_event_attr counter_attrs[] = {
{
    .type          =  PERF_TYPE_HW_CACHE,
.config      =    PERF_COUNT_HW_CACHE_L1D               <<  0  |
              (PERF_COUNT_HW_CACHE_OP_READ           <<  8) |
            (PERF_COUNT_HW_CACHE_RESULT_MISS       << 16),
    .size      = sizeof(struct perf_event_attr),
    .pinned  = 1,
    .disabled = 0,
    },
};

Does anybody know why?. What “config” value  I should use to query the
L1D/ L1I cache misses. I think the “PERF_COUNT_HW_CACHE_MISSES” counts
only 2nd and 3rd level caches.

Thanks,
Suja

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-17 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-15  2:12 Performance Events/Hw Cache Miss counting Sujamol James
  -- strict thread matches above, loose matches on Subject: below --
2011-10-17 18:32 SUJA JAMES

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).