Model-Specific Register
Jason Yeh
jason.yeh@amd.com
Fri Oct 13 16:03:00 GMT 2006
William Cohen wrote:
> Lorenzo Cavallaro wrote:
>> Hi,
>>
>> On Tue, Oct 10, 2006 at 03:46:29PM -0400, Frank Ch. Eigler wrote:
>>
>>>> Beside that, I would like to measure (count) the number of
>>>> branches (call,
>>>> jmp, jcc, loop) executed so far by a given process while it's
>>>> executing in
>>>> user space. Do you think MSR (in particular) branch_retired
>>>> register could
>>>> be useful for what I'm trying to do?
>>>
>>> Certainly. Systemtap proper does not expose those registers yet, but
>>> using e.g. inline C code, it should be able to pull out such
>>> information.
>>
>>
>> Cool. Any ideas (all the list, I mean :-)) on how to do it "from
>> scratch"?
>> Never played with MSR at all.
>>
>>
>>>> Moreover, I would like to save this register (or a combo of
>>>> registers) into the process task_struct since I would like to
>>>> keep this counter accross processes' context switch [...]
>>>
>>> Check out the perfmon2 patches for the kernel. Among other things,
>>> they
>>> do this sort of context switch tracking.
>>
>>
>> Fine, thx! I'll check it out ASAP. :-)
>
>
> There is some example code in systemtap bz#909 using perfmon2 to setup
> the registers using Perfmon2. You can also take a look at the patches
> for the runtime to figure out how to access the perfmon hw:
>
> http://sources.redhat.com/bugzilla/show_bug.cgi?id=909
>
> Perfmon2 has support to keep count of events on a per-thread basis. So
> you might not need to do much in the way of modification to accomplish
> what you want.
>
> http://perfmon2.sourceforge.net/
>
> -Will
>
>
>
Does it make sense to have tabset for accessing the hardware performance
counters directly? Perfmon2 is a good and complete framework, but it
seems like an overkill if I just want to collect simple stats using
systemtap. What I have in mind is a tabset to access performance
counters which can be easily called from other stap scripts. The tabset
will have to assume that the user knows the appropriate values for the
event select values and unit masks.
What are the drawbacks of providing a tabset like this?
Jason
More information about the Systemtap
mailing list