All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Nan <wangnan0@huawei.com>
To: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
Cc: Xinwei Hu <huxinwei@huawei.com>,
	"diamon-discuss@lists.linuxfoundation.org"
	<diamon-discuss@lists.linuxfoundation.org>,
	"lttng-dev@lists.lttng.org" <lttng-dev@lists.lttng.org>
Subject: Re: [diamon-discuss] My experience on perf, CTF and TraceCompass, and some suggection.
Date: Tue, 27 Jan 2015 08:54:56 +0800	[thread overview]
Message-ID: <54C6E1E0.1050500@huawei.com> (raw)
In-Reply-To: <CA+jJMxt1KWXRNntRwn4Co2zJhY6T=sHZFBkpsWdmwFYGU8pbQg@mail.gmail.com>

On 2015/1/27 0:25, Jérémie Galarneau wrote:
> On Fri, Jan 23, 2015 at 4:35 AM, Wang Nan <wangnan0@huawei.com> wrote:
>> Hi folks,
>>
>> I'd like to share my first tuning experience with perf, ctf and
>> TraceCompass here, and I hope my experience helpful to diamon.org. Most
>> part of this mail is talking about my work. If you don't
>> interest in it, you can directly jump to conclusion part.
>>
>> *My Task*
>>
>> What I'm working on is finding the reason why CPU idle rate is high when
>> we benchmarking a database. I think it should be a very simple task:
>> tracing scheduling and system calls, finding the previous syscall issued
>> before idle, then based on statistics, collecting some user spaces call
>> stack, I can give an answer. I use perf to collect trace,
>> perf-convert-to-ctf to get ctf output and TraceCompass for
>> visualization.
>>
>>
>> *My Experience*
>>
>> First of all I use perf to collect trace:
>>
>>  # perf record -a -e sched:* -e raw_syscalls:* sleep 1
>>
>> then
>>
>>  # perf data convert --to-ctf out.ctf
>>
>> Which is simple. However, raw_syscalls:* tracepoints export less
>> information than syscalls:* tracepoints. Without them I have to manually
>> find syscall name from syscall id. I prefer to use:
>>
>>  # perf record -a -e sched:* -e syscalls:* sleep 1
>>
>> However there are some bugs and I have to make some patches. They are
>> posted and being disscussed currently, those bugs are still exist
>> upstream.
>>
>> Then I need to convert perf.data to ctf. It tooks 140.57s to convert
>> 2598513 samples, which are collected during only 1 second execution. My
>> working server has 64 2.0GHz Intel Xeon cores, but perf conversion
>> utilizes only 1 of them. I think this is another thing can be improved.
> 
> Thanks for taking the time to do this write-up!
> 
> Would it be possible to profile perf-to-ctf so we can spot the bottleneck?
> 
> Regards,
> Jérémie
> 

We should, but I don't have enough time to do this. In addition, I think perf-to-ctf
conversion is possible to be parallelized without too much work. I suggest to consider
code tuning after we done that at perf side. What do you think?

>>
>> The next step is visualization. Output ctf trace can be opened with
>> TraceCompass without problem. The most important views for me should be
>> resources view (I use them to check CPU usage) and control flow view (I
>> use them to check thread activities).
>>
>> The first uncomfortable thing is TraceCompass' slow response time. For
>> the trace I mentioned above, on resource view, after I click on CPU
>> idle area, I have to wait more than 10 seconds for event list updating
>> to get the previous event before the idle area.
>>
>> Then I found through resources view that perf itself tooks lots of CPU
>> time. In my case 33.5% samples are generated by perf itself. One core is
>> dedicated to perf and never idle or taken by others. I think this should
>> be another thing needs to be improved: perf should give a way to
>> blacklist itself when tracing all CPUs.
>>
>> TraceCompass doesn't recognize syscall:* tracepoints as CPU status
>> changing point. I have to also catch raw_syscall:*, and which doubles
>> the number of samples.
>>
>> Finally I found the syscall which cause idle. However I need to write a
>> script to do statistics. TraceCompass itself is lack a mean to count
>> different events in my way.
>>
>> The next thing I should do is to find the calltrace which issue the
>> syscall. This time TraceCompass won't help, mostly because perf
>> convertion now doesn't support converting calltrace.
>>
>> *Conclusion*
>>
>> I suggest perf and TraceCompass to think about following improvements:
>>
>>  1. Reducing the cost of perf recording. There are one third events are
>>     generated by perf itself in my case. Is it possible that perf could
>>     provide an ability that blacklist itself and collect all other
>>     events?
>>
>>  2. Improving perf converting performance. Converting perf.data to CTF is
>>     slow, but it should be offline most of the time. We can utilize the
>>     abilities multi-core server to make it working in parallel.
>>
>>  3. Improving TraceCompass responding performance, especially when
>>     synchronizing different views.
>>
>>  4. Support converting userspace call trace. I think perf side should already
>>     have a plan on it.
>>
>>  5. Ad-Hoc visualization and statistics. Currently TraceCompass only
>>     support dwaring pre-defined events and processes. When I try to
>>     capture syscalls:*, I won't get benefit from TraceCompass because it
>>     doesn't know them. I believe that during system tuning we will
>>     finally get somewhere unable to be pre-defined by TraceCompass
>>     designer. Therefore give users abilities to define their own events
>>     and model should be much helpful.
>>
>> Thank you.
>>
>> _______________________________________________
>> diamon-discuss mailing list
>> diamon-discuss@lists.linuxfoundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/diamon-discuss
> 
> 
> 



  parent reply	other threads:[~2015-01-27  0:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  9:35 [diamon-discuss] My experience on perf, CTF and TraceCompass, and some suggection Wang Nan
2015-01-23 16:30 ` Alexandre Montplaisir
2015-01-23 16:56   ` [diamon-discuss] [lttng-dev] " Geneviève Bastien
2015-01-23 16:56   ` [diamon-discuss] " Geneviève Bastien
2015-01-31  7:14   ` Wang Nan
2015-02-04 20:24     ` Alexandre Montplaisir
2015-02-07  3:13       ` Wang Nan
2015-02-07  5:14         ` Alexandre Montplaisir
2015-02-07  7:25           ` Wang Nan
2015-02-09 20:13             ` Alexandre Montplaisir
2015-02-09 20:13             ` Alexandre Montplaisir
2015-02-10  4:55               ` Wang Nan
2015-02-10  4:55               ` Wang Nan
2015-02-10  8:02                 ` Alexandre Montplaisir
2015-02-10  8:02                 ` Alexandre Montplaisir
2015-02-07  7:25           ` Wang Nan
2015-02-07  5:14         ` Alexandre Montplaisir
2015-02-07  3:13       ` Wang Nan
2015-02-04 20:24     ` Alexandre Montplaisir
2015-02-07 13:22     ` Mathieu Desnoyers
2015-02-07 13:22     ` Mathieu Desnoyers
2015-01-31  7:14   ` Wang Nan
2015-01-23 16:30 ` Alexandre Montplaisir
2015-01-23 20:12 ` Alexandre Montplaisir
2015-01-23 20:12 ` Alexandre Montplaisir
2015-01-26  4:08   ` Wang Nan
2015-01-26  4:08   ` Wang Nan
2015-01-26 16:25 ` Jérémie Galarneau
2015-01-27  0:54   ` Wang Nan
2015-01-27  0:54   ` Wang Nan [this message]
2015-01-27  5:31     ` Jérémie Galarneau
2015-01-27  5:31     ` Jérémie Galarneau
2015-01-27  6:31       ` Wang Nan
2015-01-27  6:31       ` Wang Nan
2015-01-26 16:25 ` Jérémie Galarneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C6E1E0.1050500@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=diamon-discuss@lists.linuxfoundation.org \
    --cc=huxinwei@huawei.com \
    --cc=jeremie.galarneau@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.