All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Feng Tang <feng.tang@intel.com>
Cc: <acme@redhat.com>, <mingo@elte.hu>, <a.p.zijlstra@chello.nl>,
	<andi@firstfloor.org>, <dsahern@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/7] perf ui/browser: Add a browser for perf script
Date: Wed, 05 Sep 2012 09:33:46 +0900	[thread overview]
Message-ID: <87wr09cnpx.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20120904171327.0901e142@feng-i7> (Feng Tang's message of "Tue, 4 Sep 2012 17:13:27 +0800")

On Tue, 4 Sep 2012 17:13:27 +0800, Feng Tang wrote:
> Hi Namhyung,
>
> Thanks for your kind and thorough reviews.
>
> On Tue, 4 Sep 2012 10:57:35 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
>
>> On Mon,  3 Sep 2012 16:14:31 +0800, Feng Tang wrote:
>> > Create a script browser, so that user can check all the available
>> > scripts and run them inside the main perf report or annotation
>> > browsers, for all the perf samples or samples belong to one
>> > thread/symbol.
>> >
>> > The work flow is, users can use function key to list all the available
>> > scripts in system and chose one, which will be executed with
>> > popen("perf script -s xxx.xx",) and all the output lines are put into
>> > one ui browser, pressing 'q' or left arrow key will make it return
>> > to previous browser.
>> 
>> It could be used for TUI interface of perf script itself too (at least
>> for --list option) IMHO.
>
> Do you mean make the "perf script -l" to be shown in a browser, or we
> use the same popen("perf script -l") way to cache and list the all the
> scripts so that we don't need the find_scripts()?

I meant the former.

>
>> 
>> 
>> >
>> > Please be noted, most of the in-tree scripts with name xxxtop are
>> > dynamically run and not supported by this static browser. 
>> 
>> If so, wouldn't it be better adding a filter not to show those
>> unsupported scripts somehow?
>
> Good idea, will simply filter them in next version.
>> 
>> 
[SNIP]
>> > +
>> > +	fp = popen(cmd, "r");
>> > +	if (!fp)
>> > +		goto exit;
>> > +
>> > +	while ((retlen = getline(&line, &len, fp)) != -1) {
>> > +		strcpy(sline[nr_entries].line, line);
>> 
>> What if the len is larger than sline[].line?
>
> That's a problem, how about adding a check for "retlen" and cut that
> line to fit the SCRIPT_FULLPATH_LEN? Or we just wrap the long line
> by using several struct script_line to save it?

The first option looks better for simplicity.

Thanks,
Namhyung

>
>> 
>> 
>> > +		list_add_tail(&sline[nr_entries].node, &script.entries);
>> > +
>> > +		if (script.b.width < retlen)
>> > +			script.b.width = retlen;
>> > +		nr_entries++;
>> 
>> I think you need this too:
>> 
>> 		if (nr_entries >= MAX_LINES)
>> 			break;
>> > +	}
>> > +
>> > +	script.nr_lines = nr_entries;
>> > +	script.b.nr_entries = nr_entries;
>> > +	script.b.entries = &script.entries;
>> > +
>> > +	ret = script_browser__run(&script);
>> > +
>> > +	if (line)
>> > +		free(line);
>> 
>> No pclose(fp) ?
>> 
>> 
>> > +
>> > +exit:
>> > +	free(sline);
>> > +	return ret;
>> > +}
>> > diff --git a/tools/perf/ui/browsers/scripts.h b/tools/perf/ui/browsers/scripts.h
>> > new file mode 100644
>> > index 0000000..011baa8
>> > --- /dev/null
>> > +++ b/tools/perf/ui/browsers/scripts.h
>> > @@ -0,0 +1,5 @@
>> > +#ifndef _PERF_UI_BROWSER_BROWSER_H_
>> > +#define _PERF_UI_BROWSER_BROWSER_H_ 1
>> 
>> I guess you want _PERF_UI_BROWSER_SCRIPT_H_ ?
>
> Exactly. 
>
> I'll address the comments in this email and those in other emails. thanks!
>
> - Feng

  reply	other threads:[~2012-09-05  0:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03  8:14 [PATCH 0/7] perf ui/browser: Add browser for perf script Feng Tang
2012-09-03  8:14 ` [PATCH 1/7] perf symbols: Filter samples with unresolved symbol when "--symbols" option is used Feng Tang
2012-09-03  8:14 ` [PATCH 2/7] perf scripts: Add --symbols option to handle specific symbols Feng Tang
2012-09-03  8:14 ` [PATCH 3/7] perf scripts: Add event_analyzing_sample-record/report Feng Tang
2012-09-03  8:14 ` [PATCH 4/7] perf scripts: Export a find_scripts() function Feng Tang
2012-09-04  1:09   ` Namhyung Kim
2012-09-04  1:34   ` Namhyung Kim
2012-09-03  8:14 ` [PATCH 5/7] perf ui/browser: Add a browser for perf script Feng Tang
2012-09-04  1:57   ` Namhyung Kim
2012-09-04  9:13     ` Feng Tang
2012-09-05  0:33       ` Namhyung Kim [this message]
2012-09-03  8:14 ` [PATCH 6/7] perf ui/browser: Integrate script browser into annotation browser Feng Tang
2012-09-03  8:14 ` [PATCH 7/7] perf ui/browser: Integrate script browser into main hists browser Feng Tang
2012-09-04  0:50 ` [PATCH 0/7] perf ui/browser: Add browser for perf script Namhyung Kim

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=87wr09cnpx.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=feng.tang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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.