Can somebody provide me tutorial for profiling linux kernel. I am writing an application - part of which is to profile relevant parts of kernel for performance evaluation. I hope oprofile developers can answer my questions. My understanding of profiling is as follows:

1. Enable performance counter profiling in hardware
 (e.g, in Linux kernel we can do this calling with set_in_cr4(X86_CR4_PCE) )
2. Write to machine specific register (wrmsr): For example, wrmsr (MSR_P6_EVNTSEL0,event ,0). Here i have selected performance event selector of pentium 6. here is definition of wrmsr.

#define wrmsr(msr,val1,val2) \
        __asm__ __volatile__("wrmsr" \
                          : /* no outputs */ \
                          : "c" (msr), "a" (val1), "d" (val2))

Googling on "wrmsr", i found "val2" argument ( that is MSR) is mostly zero. Since val1, val2 are both inputs, what is significance of zero ? Also, How can I select event MSRs (val2) ( yes, i know i can do this with intel manual, is there a framework to select events ?)
Consider an example when i am trying to enable TLB counters and read it.
Now i have enabled a TLB counters, how can i read performance parameters (e.g TLB miss). Any tutorial for that ?