From mboxrd@z Thu Jan 1 00:00:00 1970 From: dhara buch Subject: Re: Oprofile Report Date: Fri, 24 Mar 2017 16:32:02 +0530 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0536853553265077627==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Michael Petlan Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============0536853553265077627== Content-Type: multipart/alternative; boundary=001a114fa888693aa2054b77ec38 --001a114fa888693aa2054b77ec38 Content-Type: text/plain; charset=UTF-8 Actually, I am compiling a very simple c program test.c with gcc -g test.c -o test but it is not affecting output. Is there any way by which I can check whether the binary image generates debug info or not? On Fri, Mar 24, 2017 at 3:26 PM, Michael Petlan wrote: > Please read my previous message once more: > > Hi, I think you need to rebuild the test with '-g' switch. > If the test binary does not have debuginfo, opreport cannot > resolve that. > > On Fri, 24 Mar 2017, dhara buch wrote: > >> Hi, >> Yes, when I try to execute 'opreport --symbols --debug-info' command >> after doing profiling for a .c file (let operf ./test), >> >> I am expecting 'test.c:line_no' in linear info field as you are getting >> 'exact_counts.c:13' in the following: >> >> samples % linenr info image name >> symbol name >> 10 66.6667 (no location information) no-vmlinux >> /no-vmlinux >> 2 13.3333 exact_counts.c:13 exact_counts >> main >> 1 6.6667 exact_counts.c:10 exact_counts >> f_65535x >> 1 6.6667 exact_counts.c:9 exact_counts >> f_997x >> 1 6.6667 (no location information) ld-2.17.so >> _dl_fini >> I tried to install debuginfo using >> #debuginfo-install kernel command. >> >> But when I execute 'opreport --symbols --debug-info', I get only (no >> location information) in all of my samples. >> >> What may be the reason? >> > > The reason is that OProfile cannot find debuginfo of your test app. > Probably because it does not contain any ;-) > > Recompile your test application with the '-g' gcc switch. > > > FURTHER INFO: > > If you are profiling an application installed from packages, you > need to have the corresponding debuginfo package. For example, > for profiling firefox, you need firefox-debuginfo (RHEL, Fedora, > CentOS) or (probably) firefox-dbg packages (Ubuntu). It's also > good to have the debuginfos of all the required libraries. > > On RHEL/CentOS/Fedora, you can install that easily by: > debuginfo-install > > Cheers, > Michael > > > >> On Thu, Mar 23, 2017 at 8:08 PM, Michael Petlan >> wrote: >> On Thu, 23 Mar 2017, dhara buch wrote: >> Hello, >> I am doing profiling with command, >> >> operf ./test --events=BR_INST_RETIRED >> where test.c is a simple c language file. >> >> then, I am trying to collect information with command >> >> opreport --symbols --debug-info >> >> From the documents of Oprofile, I assume that the above >> command lists profiling result as per the symbols i.e. I can get result >> showing samples, linear info, image >> name and symbol name. >> >> As per my command I expect my file name (test.c) to be in the >> linear info and image name, but shows [no location information] in linear >> info. The filename does not >> get listed in image >> name also. >> >> What is lacking? >> >> >> Hi, I think you need to rebuild the test with '-g' switch. >> If the test binary does not have debuginfo, opreport cannot >> resolve that. >> >> Me trying with debuginfo: >> >> samples % linenr info image name >> symbol name >> 10 66.6667 (no location information) no-vmlinux >> /no-vmlinux >> 2 13.3333 exact_counts.c:13 exact_counts >> main >> 1 6.6667 exact_counts.c:10 exact_counts >> f_65535x >> 1 6.6667 exact_counts.c:9 exact_counts >> f_997x >> 1 6.6667 (no location information) ld-2.17.so >> _dl_fini >> >> And without: >> >> samples % linenr info image name >> symbol name >> 10 55.5556 (no location information) no-vmlinux >> /no-vmlinux >> 3 16.6667 (no location information) exact_counts >> f_65535x >> 2 11.1111 (no location information) exact_counts >> main >> 1 5.5556 (no location information) ld-2.17.so >> _dl_add_to_slotinfo >> 1 5.5556 (no location information) ld-2.17.so >> _dl_next_tls_modid >> 1 5.5556 (no location information) ld-2.17.so >> _dl_relocate_object >> >> Is this the problem you are asking about? >> >> >> I tried to set vmlinux with operf --vmlinux option also where >> vmlinux file in in /usr/lib/debug/lib/4*/vmlinux, still the above commands >> do not list test file >> entries. >> >> >> The "--vmlinux" option is there for enabling this for samples >> obtained in kernelspace. >> >> By default (assuming you have no kernel debuginfo available), >> operf marks all the samples taken in kernel (e.g. your program >> called a syscall and the sample was taken when the syscall was >> being executed or you profile systemwide) as "no-vmlinux". >> >> This is sufficient if you care about userspace only and not about >> the "time" spent in kernel. >> >> If you care about kernelspace, you need the '--vmlinux' option >> with correct path specified. >> >> >> What is lacking? >> >> Thank you, >> >> Dhara buch >> >> >> >> Has this helped? >> >> Cheers, >> Michael >> >> >> >> --001a114fa888693aa2054b77ec38 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Actually, I am compiling a very simple c program test.c wi= th

gcc -g test.c -o test =C2=A0 =C2=A0

but it is not affecting output. Is there any way by which I can che= ck whether the binary image generates debug info or not?

On Fri, Mar 24, 2017 at = 3:26 PM, Michael Petlan <mpetlan@redhat.com> wrote:
Please read my previous message once more:

=C2=A0 =C2=A0 =C2=A0 Hi, I think you need to rebuild the test with '-g&= #39; switch.
=C2=A0 =C2=A0 =C2=A0 If the test binary does not have debuginfo, opreport c= annot
=C2=A0 =C2=A0 =C2=A0 resolve that.

On Fri, 24 Mar 2017, dhara buch wrote:
Hi,
Yes, when I try to execute 'opreport --symbols --debug-info' comman= d after doing profiling for a .c file (let operf ./test),

I am expecting 'test.c:line_no' in linear info field as you are get= ting 'exact_counts.c:13' in the following:=C2=A0

samples=C2=A0%=C2=A0 =C2=A0 =C2=A0 =C2=A0 linenr info=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0image name=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0symbol name
10=C2=A0 =C2=A0 =C2=A0 =C2=A066.6667=C2=A0 (no location information)=C2=A0 = =C2=A0no-vmlinux=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/no-= vmlinux
2=C2=A0 =C2=A0 =C2=A0 =C2=A0 13.3333=C2=A0 exact_counts.c:13=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0exact_counts=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0main
1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.6667=C2=A0 exact_counts.c:10=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exact_counts=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0f_65535x
1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.6667=C2=A0 exact_counts.c:9=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 exact_counts=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0f_997x
1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.6667=C2=A0 (no location information)= =C2=A0 =C2=A0ld-2.17.so=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_= dl_fini
I tried to install debuginfo using=C2=A0
#debuginfo-install kernel command.

But when I execute 'opreport --symbols --debug-info', I get only=C2= =A0(no location information) =C2=A0in all of my samples.

What may be the reason?

The reason is that OProfile cannot find debuginfo of your test app.
Probably because it does not contain any ;-)

Recompile your test application with the '-g' gcc switch.


FURTHER INFO:

If you are profiling an application installed from packages, you
need to have the corresponding debuginfo package. For example,
for profiling firefox, you need firefox-debuginfo (RHEL, Fedora,
CentOS) or (probably) firefox-dbg packages (Ubuntu). It's also
good to have the debuginfos of all the required libraries.

On RHEL/CentOS/Fedora, you can install that easily by:
debuginfo-install <your_package>

Cheers,
Michael



On Thu, Mar 23, 2017 at 8:08 PM, Michael Petlan <mpetlan@redhat.com> wrote:
=C2=A0 =C2=A0 =C2=A0 On Thu, 23 Mar 2017, dhara buch wrote:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Hello,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 I am doing profiling with command= ,=C2=A0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 operf ./test --events=3DBR_INST_R= ETIRED
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 where test.c is a simple c langua= ge file.=C2=A0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 then, I am trying to collect info= rmation with command
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 opreport --symbols --debug-info
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 From the documents of Oprofile, I= assume that the above command lists profiling result as per the symbols i.= e. I can get result showing samples, linear info, image
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 name and symbol name.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 As per my command I expect my fil= e name (test.c) to be in the linear info and image name, but shows [no loca= tion information] in linear info. The filename does not
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 get listed in image
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 name also.=C2=A0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 What is lacking?


=C2=A0 =C2=A0 =C2=A0 Hi, I think you need to rebuild the test with '-g&= #39; switch.
=C2=A0 =C2=A0 =C2=A0 If the test binary does not have debuginfo, opreport c= annot
=C2=A0 =C2=A0 =C2=A0 resolve that.

=C2=A0 =C2=A0 =C2=A0 Me trying with debuginfo:

=C2=A0 =C2=A0 =C2=A0 samples=C2=A0 %=C2=A0 =C2=A0 =C2=A0 =C2=A0 linenr info= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0image name=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0symbol name
=C2=A0 =C2=A0 =C2=A0 10=C2=A0 =C2=A0 =C2=A0 =C2=A066.6667=C2=A0 (no locatio= n information)=C2=A0 =C2=A0no-vmlinux=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0/no-vmlinux
=C2=A0 =C2=A0 =C2=A0 2=C2=A0 =C2=A0 =C2=A0 =C2=A0 13.3333=C2=A0 exact_count= s.c:13=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exact_counts=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0main
=C2=A0 =C2=A0 =C2=A0 1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.6667=C2=A0 exact_= counts.c:10=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exact_counts=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0f_65535x
=C2=A0 =C2=A0 =C2=A0 1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.6667=C2=A0 exact_= counts.c:9=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 exact_counts=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0f_997x
=C2=A0 =C2=A0 =C2=A0 1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.6667=C2=A0 (no lo= cation information)=C2=A0 =C2=A0ld-2.17.so=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0_dl_fini

=C2=A0 =C2=A0 =C2=A0 And without:

=C2=A0 =C2=A0 =C2=A0 samples=C2=A0 %=C2=A0 =C2=A0 =C2=A0 =C2=A0 linenr info= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0image name=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0symbol name
=C2=A0 =C2=A0 =C2=A0 10=C2=A0 =C2=A0 =C2=A0 =C2=A055.5556=C2=A0 (no locatio= n information)=C2=A0 =C2=A0no-vmlinux=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0/no-vmlinux
=C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A0 =C2=A0 =C2=A0 16.6667=C2=A0 (no locatio= n information)=C2=A0 =C2=A0exact_counts=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0f_65535x
=C2=A0 =C2=A0 =C2=A0 2=C2=A0 =C2=A0 =C2=A0 =C2=A0 11.1111=C2=A0 (no locatio= n information)=C2=A0 =C2=A0exact_counts=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0main
=C2=A0 =C2=A0 =C2=A0 1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A05.5556=C2=A0 (no lo= cation information)=C2=A0 =C2=A0ld-2.17.so=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0_dl_add_to_slotinfo
=C2=A0 =C2=A0 =C2=A0 1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A05.5556=C2=A0 (no lo= cation information)=C2=A0 =C2=A0ld-2.17.so=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0_dl_next_tls_modid
=C2=A0 =C2=A0 =C2=A0 1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A05.5556=C2=A0 (no lo= cation information)=C2=A0 =C2=A0ld-2.17.so=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0_dl_relocate_object

=C2=A0 =C2=A0 =C2=A0 Is this the problem you are asking about?


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 I tried to set vmlinux with operf= --vmlinux option also where vmlinux file in in /usr/lib/debug/lib/4*/vmlin= ux, still the above commands do not list test file
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 entries.


=C2=A0 =C2=A0 =C2=A0 The "--vmlinux" option is there for enabling= this for samples
=C2=A0 =C2=A0 =C2=A0 obtained in kernelspace.

=C2=A0 =C2=A0 =C2=A0 By default (assuming you have no kernel debuginfo avai= lable),
=C2=A0 =C2=A0 =C2=A0 operf marks all the samples taken in kernel (e.g. your= program
=C2=A0 =C2=A0 =C2=A0 called a syscall and the sample was taken when the sys= call was
=C2=A0 =C2=A0 =C2=A0 being executed or you profile systemwide) as "no-= vmlinux".

=C2=A0 =C2=A0 =C2=A0 This is sufficient if you care about userspace only an= d not about
=C2=A0 =C2=A0 =C2=A0 the "time" spent in kernel.

=C2=A0 =C2=A0 =C2=A0 If you care about kernelspace, you need the '--vml= inux' option
=C2=A0 =C2=A0 =C2=A0 with correct path specified.


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 What is lacking?

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Thank you,

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Dhara buch



=C2=A0 =C2=A0 =C2=A0 Has this helped?

=C2=A0 =C2=A0 =C2=A0 Cheers,
=C2=A0 =C2=A0 =C2=A0 Michael




--001a114fa888693aa2054b77ec38-- --===============0536853553265077627== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============0536853553265077627==--