Re: [PATCH 2/2 -tip] perf_counter: parse-events.c introduce aliasmember in event_symbol

From: Ingo Molnar
Date: Wed Jun 24 2009 - 04:49:00 EST



* Jaswinder Singh Rajput <jaswinder@xxxxxxxxxx> wrote:

> On Tue, 2009-06-23 at 10:24 +0200, Ingo Molnar wrote:
> > * Jaswinder Singh Rajput <jaswinder@xxxxxxxxxx> wrote:
> >
> > >
> > > perf test also need some command to execute otherwise it will also
> > > show long list of <inactive>
> >
> > I think what it should do is to execute test-cases _internally_. Not
> > just execute some random command on the system and hope for events.
>
> Can you suggest some good test cases where we can get numbers for
> almost all the events on each and every run.

the testcases should be specific to the counter type. Some counters
are easy (such as cycles or instructions - you in fact cannot even
get zero out of them even if you tried) - some are harder - such as
migrations, or cache-misses or page-faults.

Small functions that trigger them for sure would do the trick. For
example, to provoke a minor page fault:

static void trigger_minor_page_fault(void)
{
void *page;

page = mmap(0, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, -1, 0);

/* Clearing the page will trigger a minor fault: */
memset(page, 0, PAGE_SIZE);

munmap(page, PAGE_SIZE);
}

These small test-functions should be attached to the event array as
function pointers - hence the generic testing code would just do a
->event.trigger_event() callback, it wouldnt need to know much about
the event itself.

> > > context-switches 7956
> > > CPU-migrations 7
> >
> > this needs to be provoked intentionally via sched_setaffinity():
> > first migrate to cpu0, then to cpu1.
>
> There should be some option from user or we test it each time.

If this is builtin-test.c - then yes, testing it all the time would
be a good default. (there might be other aspects of testing that
would require options to this command in the future.)

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/