[Xen-devel] Regarding an error during oprofile installation

2017-07-24 Thread dhara buch
Hello,

Although I have installed Oprofile 1.1.0 in Fedora once, I need to install
it again in another Fedora machine.

During ./configure command, I get the following error:

Unable to find clock_gettime function used in ocount

What may be the solution?

Thank you,

Dhara Buch
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] Operf and Opreport outputs

2017-07-06 Thread dhara buch
Hello,

I tried the perf-hello.c file and found the results as you explained. It is
very helpful to me. Now, for PERF_COUNT_HW_BRANCH_MISSES, I am getting
varying values every time unlike PERF_COUNT_HW_INSTRUCTIONS.

To get count for only defined process, I am trying to set perf_event_attr
structure variables sample_type as PERF_SAMPLE_BRANCH_STACK and
branch_sample_type as PERF_SAMPLE_BRANCH_USER. By doing so, I am getting
error no. 5 by perf_event_open. What may be the problem?

Dhara Buch

On Mon, Jun 19, 2017 at 5:51 PM, Michael Petlan <mpet...@redhat.com> wrote:

> On Mon, 19 Jun 2017, dhara buch wrote:
> > Hello,
> > Thanks a lot for the detailed explanation. I could understand the
> working of operf and opreport.
> > Unlike operf, ocount counts each occurrence of the monitored event. In
> such a case, why ocount also gives varying values of CPU_CLK_UNHALTED even
> when the monitored code doesn't get
> > changed. Is it because of background processes? If so, then can we get
> event count for only monitored command?
>
> Hi Dhara,
>
> it is kind of because of the background processes, but not in the way that
> ocount
> would count also their CPU consumption. If you don't use '-s' option,
> ocount will
> count only what your command does.
>
> However, it counts either kernelspace, userspace or both (default if you
> are root).
> This can be configured by the event's flags:
>
> Both:
> -e CPU_CLK_UNHALTED:0:1:1
>
> Only kernelspace (used by the command, i.e. syscalls, etc):
> -e CPU_CLK_UNHALTED:0:1:0
>
> Only userspace (i.e. syscalls are excluded):
> -e CPU_CLK_UNHALTED:0:0:1
>
> (the format is (ocount): event:umask:kernelspace:userspace,
> for operf it is: event:umask:sample_rate:kernelspace:userspace)
>
> The numbers are slightly different each run because the process does not
> live in
> vacuum. It is usually dynamically linked, it calls libraries, kernel
> switches
> contexts, etc. All these things cause the differences. Also, the CPU
> optimizes
> the execution with floating success, depending on what else runs there
> with it.
> If the process is interrupted many times, the CPU consumption will be
> higher.
>
> I have a sample code which I linked dynamically and statically. While the
> dyn.
> linked executable always takes around 670,260 cycles, the statically
> linked one
> takes around 380,202 and seems to be more steady. Since it is very simple
> code,
> you can see that the linker-related stuff took more than 40% of the CPU
> cycles).
>
> Executing a binary is so complex problem that there is no surprise that
> those
> measurements give different values every time.
>
> 
>
> TIP:
>
> You can use either papi library or the built-in kernel support for counting
> just a particular part of code, e.g. a function. I have attached one
> example
> which uses perfevents kernel background. I have two functions for factorial
> counting, one is slightly less effective than the other. I count cycles and
> instructions for both. When executing repeatedly, you can see, that the
> inst.
> count is the same all the time (at least on my laptop), but the cycles
> count
> differs even for just the stuff in the functions which are very simple.
>
> cc -o perf-hello perf-hello.c myperf.c
> ./perf-hello
>
> Ineffective method:
> PERF_COUNT_HW_CPU_CYCLES = 32192
> PERF_COUNT_HW_INSTRUCTIONS = 20681
>
> More effective method:
>     PERF_COUNT_HW_CPU_CYCLES = 15931
> PERF_COUNT_HW_INSTRUCTIONS = 19103
>
> 
>
> Cheers,
> Michael
>
>
> >
> > Thank you,
> >
> > On Fri, Jun 16, 2017 at 4:52 PM, Michael Petlan <mpet...@redhat.com>
> wrote:
> >   On Fri, 16 Jun 2017, dhara buch wrote:
> >   > Hello,
> >   >
> >   > Many days ago you had helped me a lot in using Oprofile in
> Virtual Machine. That time, I also had a query regarding
> >   > getting information from 'opreport --symbols --debuginfo'
> command.
> >
> >   Hello,
> >
> >   yeah, I remember...
> >
> >   >
> >   > Actually, I am profiling a file1.c file with the following
> commands...
> >   >
> >   > 1. gcc -g file1.c -o file1
> >   >
> >   > 2. operf ./file1 --events=CPU_CLK_UNHALTED
> >   >
> >   > 3. opreport --symbols --debuginfo
> >   >
> >   > the output contains various lines where one line look follows:
> >   >
> >   > samples  %linenr info image
> name   symbol name
> >   >
> >

Re: [Xen-devel] Operf and Opreport outputs

2017-06-19 Thread dhara buch
Hello,

Thanks a lot for the detailed explanation. I could understand the working
of operf and opreport.

Unlike operf, ocount counts each occurrence of the monitored event. In such
a case, why ocount also gives varying values of CPU_CLK_UNHALTED even when
the monitored code doesn't get changed. Is it because of background
processes? If so, then can we get event count for only monitored command?

Thank you,

On Fri, Jun 16, 2017 at 4:52 PM, Michael Petlan <mpet...@redhat.com> wrote:

> On Fri, 16 Jun 2017, dhara buch wrote:
> > Hello,
> >
> > Many days ago you had helped me a lot in using Oprofile in Virtual
> Machine. That time, I also had a query regarding
> > getting information from 'opreport --symbols --debuginfo' command.
>
> Hello,
>
> yeah, I remember...
>
> >
> > Actually, I am profiling a file1.c file with the following commands...
> >
> > 1. gcc -g file1.c -o file1
> >
> > 2. operf ./file1 --events=CPU_CLK_UNHALTED
> >
> > 3. opreport --symbols --debuginfo
> >
> > the output contains various lines where one line look follows:
> >
> > samples  %linenr info image name
> symbol name
> >
> > 2   12.5000  rsaimp.c:16 rsaimp   MM
> > 212.5000  rsaimp.c:34 rsaimp
> main
> >
> > When I execute commands 2 and 3 multiple times, each time I gwt the
> output for symbole name MM (which is UDF in the
> > program) but I don't get output for main every time.
> >
> This is kind of random, see below.
>
> > Additionally,'' the sample % also vary every time I file operf command.
> I do not understand the working of operf that
> > how it gives different outputs for the same program.
> >
>
> How _counting_ works:
>
> Each time an event happens in CPU (in our case -- CPU_CLK_UNHALTED -- one
> CPU tick), its counter is incremented by one. This way, you can get the
> whole number of how many times the event happened:
>
> $ ocount ls
> Events were actively counted for 1863267 nanoseconds.
> Event counts (actual) for /bin/ls:
>   EventCount% time counted
>   CPU_CLK_UNHALTED 2,672,309100.00
>
> This means that there were 2.672 million CPU ticks necessary to execute
> `ls`.
>
> The tool for counting is *ocount*.
>
>
> How _profiling_ works:
>
> For profiling, events are counted the same way as when counting, but only
> once per N event occurrences a "sample" is taken. A sample is a piece of
> information about where in the code it happened, what was the context and
> potentially call-stack, etc. This sample is saved into the oprofile_data
> dir structure. When you finish profiling, opreport generates some overview
> from the samples recorded.
>
> Of course, taking sample causes some overhead. Thus, you cannot take it
> each time the event counter increments. For this purpose, there is "sample
> rate" value which divides the event counter and takes a sample only once
> per "sample rate" occurrences. Thus, it is pretty random, which event
> occurrence is picked for a sample.
>
> Of course, your main() consumes CPU ticks and the counter is incremented,
> but sometimes, one of these incrementations produces sample, sometimes not,
> thus the function is missing.
>
> You have 2 samples on each of the line in the report. That is really a low
> number, so it is very probable that sometimes the samples hit main() and
> sometimes not.
>
> $ operf ls
> Profiling done.
>
> $ opreport
> Using /root/oprofile_data/samples/ for samples directory.
> CPU: Core 2, speed 2267 MHz (estimated)
> Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit
> mask of 0x00 (Unhalted core cycles) count 10
> CPU_CLK_UNHALT...|
>   samples|  %|
> --
>  -->   37 100.000 ls
>CPU_CLK_UNHALT...|
>  samples|  %|
>  --
>   27 72.9730 kallsyms
>5 13.5135 libc-2.19.so
>2  5.4054 ld-2.19.so
>1  2.7027 ls
>1  2.7027 ext4
>1  2.7027 libattr.so.1.1.0
>
> You see that out of (estimated) 2.5-3.5 mil of event occurrences (which is
> the scale `ls` usually needs on my PC), I got only 37 samples.
>
> The sample rate for each event are in `ophelp` as "min count".
>
> Why did I get 37 samples? My default setting of default event is:
>
> $ ophelp -d
> CPU_CLK_UNHALTED:10:0:1:1
> ---^^
>
> This means that there is 1 sample per 10 event occurren

[Xen-devel] Operf and Opreport outputs

2017-06-16 Thread dhara buch
Hello,

Many days ago you had helped me a lot in using Oprofile in Virtual Machine.
That time, I also had a query regarding getting information from 'opreport
--symbols --debuginfo' command.

Actually, I am profiling a file1.c file with the following commands...

1. gcc -g file1.c -o file1

2. operf ./file1 --events=CPU_CLK_UNHALTED

3. opreport --symbols --debuginfo

the output contains various lines where one line look follows:

samples  %linenr info image name
symbol name

2   12.5000  rsaimp.c:16 rsaimp   MM
212.5000  rsaimp.c:34 rsaimp   main

When I execute commands 2 and 3 multiple times, each time I gwt the output
for symbole name MM (which is UDF in the program) but I don't get output
for main every time.

Additionally,'' the sample % also vary every time I file operf command. I
do not understand the working of operf that how it gives different outputs
for the same program.

Thanks,

Dhara Buch
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] Oprofile Report

2017-03-24 Thread dhara buch
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 <mpet...@redhat.com> 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
>> 213.  exact_counts.c:13   exact_counts
>>  main
>> 1 6.6667  exact_counts.c:10   exact_counts
>>  f_65535x
>> 1 6.6667  exact_counts.c:9exact_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 <mpet...@redhat.com>
>> 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
>>   213.  exact_counts.c:13   exact_counts
>>main
>>   1 6.6667  exact_counts.c:10   exact_counts
>>f_65535x
>>   1 6.6667  exact_counts.c:9exact_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
>>   316.6667  (no location information)   exact_counts
>>f_65535x
>>   211.  (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 informati

Re: [Xen-devel] Oprofile Report

2017-03-24 Thread dhara buch
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
213.  *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?

On Thu, Mar 23, 2017 at 8:08 PM, Michael Petlan <mpet...@redhat.com> 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
> 213.  exact_counts.c:13   exact_counts main
> 1 6.6667  exact_counts.c:10   exact_counts
>  f_65535x
> 1 6.6667  exact_counts.c:9exact_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
> 316.6667  (no location information)   exact_counts
>  f_65535x
> 211.  (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
>
>
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] Oprofile Report

2017-03-23 Thread dhara buch
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?

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.

What is lacking?

Thank you,

Dhara buch
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] XenOprof not coming out of Timer Mode

2017-02-17 Thread dhara buch
Hello,

I have installed Xen 4.9-unstable with source on Ubuntu 15.10 and uses
4.2.0-42-generic kernel.

Before installing Xen, I used perf to check which events are supported.I
found that hardware event are supported by it. Now, I want to use
performance counters from virtual machine, so after installing Xen,I
installed XenOprof which allows to access performance counter through
virtual layer also.

When I executed the following command, I got the message that OProfile is
in timer mode.


sudo opcontrol --start-daemon --event=GLOBAL_POWER_EVENTS
--vmlinux=/home/dhbuch/vmlinux --xen=/home/dhbuch/xen-4.9-unstable


As per the documentation, timer mode is set automatically when hardware
events are not supported by the kernel, but through perf it was tested that
hardware events are supported.

Kindly help to come out of the timer mode so that performance counter
values can be monitored.

Thank you,

Dhara Buch
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] (no subject)

2017-02-17 Thread dhara buch
Hello,

I have installed Ubuntu 15.10 in which have installed Xen with source.

Booting is done with Xen as well as commands like xl infor, xl list are
also working fine.

For creating Virtual Machine, I have installed Virtual Machine Manager, but
when I try to run it, it gives error as follows:







*Unable to connect to libvirt.internal error: libxenlight state driver is
not activeVerify that: - A Xen host kernel was booted - The Xen service has
been started*

I tried by installing libvirt as
apt-get install libvirt-bin

but, still the same problem is found. Libvirtd service is also not getting
started.

Where am I lacking?

Thank you,

Dhara Buch
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel