【PMC tool】A question

3 views
Skip to first unread message

lifengkai

unread,
Jun 4, 2009, 3:01:32 AM6/4/09
to pmctools...@googlegroups.com, Joseph Koshy
Hi,all
 
I have some questions, and want to make it clear, thanks for your help.
 
1. I can use the pmcstat sampling module process scope to get output result, I can see the the events measured in the fuc level, but can I make it in the instruction level? If I want to figure out the instrutions, or profile a small fraction of the code, what can I do?
 
2.When I use the tool, What kinds of inaccuracy should I expect?
 
3.Even I did some research on PEBS, if I want to added to current PMC tool, I have to somethings to do,such as configuring the DS buffer in the kernel, the DS buffer overflow ISR handling,configuring the pmc register,etc. I find it a lot of work to do. But from your expert point of view, how much work do you think?
 
 
Thanks very much

华为技术有限公司 huawei_logo


地址:深圳市龙岗区坂田华为基地 邮编:518129
http://www.huawei.com
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, which
is intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!
 
outlook_huawei_logo_cn.jpg

Joseph Koshy

unread,
Jun 4, 2009, 6:19:05 AM6/4/09
to lifengkai, pmctools...@googlegroups.com, Joseph Koshy

> 1. I can use the pmcstat sampling module process scope to get output
> result, I can see the the events measured in the fuc level, but can
> I make it in the instruction level? If I want to figure out the
> instrutions, or profile a small fraction of the code, what can I do?

The hwpmc(4) log contains virtual addresses of sampled instructions.

pmcstat(8) aggregates these into per-function counts when generating
gmon.out files for input to gprof(1). If you want an instruction
level listing instead, please use the pmcannotate(8) tool.

At this time you cannot selectively profile portions of the code.
Profiling is done either on a per-process basis, or for the whole
system, depending on the 'mode' of the allocated PMC.

Fine-grained control of PMCs would require (a) that hwpmc(4) grow an
in-kernel API and (b) that this API be used by an in-kernel module
such as dtrace(4).

> 2.When I use the tool, What kinds of inaccuracy should I expect?

The "precision" associated with sampling is dependent on that provided
by the processor. Some hardware events are inherently imprecise,
i.e., the PMC interrupt is taken within a few instructions of the one
that caused the counter overflow. In some processors, some events are
precise when configured on certain counters but are imprecise
otherwise. The manufacturer's documentation usually lists which are
which.

In counting mode, the RDPMC instruction used to read counters also has
a small window of imprecision. See documentation for more details.

> 3.Even I did some research on PEBS, if I want to added to current PMC tool,
> I have to somethings to do,such as configuring the DS buffer in the kernel,
> the DS buffer overflow ISR handling,configuring the pmc register,etc. I find
> it a lot of work to do. But from your expert point of view, how much work do
> you think?

It is a lot of work to do. :)

Note that with PEBS the processor saves its entire register state at
the time of the PMC interrupt to a memory buffer. Even if hwpmc(4)
were augmented to capture this information, we do not have userland
tools that can work with information at that level of granularity.
Further, IIRC, PEBS mode does not walk call chains, so callchain
capture still needs to be done explicitly by hwpmc(4).

HTH,
Koshy

Reply all
Reply to author
Forward
0 new messages