Re: [RFC PATCHSET] perf ui: Small preparation on further UI work

From: Arnaldo Carvalho de Melo
Date: Wed Mar 28 2012 - 10:28:10 EST


Em Wed, Mar 28, 2012 at 11:14:25AM +0900, Namhyung Kim escreveu:
> Em Tue, Mar 27, 2012 at 01:44:42PM +0300, Pekka Enberg escreveu:
> > Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx> wrote:

> > So I would just leave things in tools/perf/util/ui/ and do what you did
> > in moving the TUI specific bits to a separate function, even ui__init()
> > would be ok for now, and then at setup_browser() check what kind of
> > interface is being used and call ui__init() if it is the TUI and the
> > gtk init one if GTK+ was chosen.
>
> I think it'd be better moving the TUI specific codes to a separate file
> (under a separate directory, like tools/perf/util/ui/tui - but it looks
> like so deep nesting) rather than a function since the generic

What do you have against directory trees? :P We need to chop off the
/util/ part, but apart from that...

> code (setup_browser) should be compiled without the TUI support.
> Otherwise we'll see some #ifdef's in the source file(s).
>
> Or, we can put those codes under the same directory (tools/perf/util/ui)
> and have different suffixes - say, if generic code were XXX.c, TUI one
> would be XXX-tui.c and GTK+ one would be XXX-gtk.c.

... what is the difference of using:

tools/perf/util/ui/tui/init.c

instead of:

tools/perf/util/ui/tui-init.c

?

Since we'll be introducing new files, it seems the first step would be
to just do a simple, no changes in the files, move of
tools/perf/util/ui/ to tools/perf/ui/ and then introduce
tools/perf/ui/tui/{init,etc}.c

Gtk would as well be moved to tools/perf/ui/gtk/.

At some point we would then introduce some sort of plugin mechanism
where files found in /usr/lib/perf/ui/ or some other suitable directory
would be loaded in a modprobe like way, i.e. if the user asks for --gtk,
it would try to find /usr/lib/perf/ui/gtk.so and try to load it, etc.

That way we start to reduce the miriad libraries that we have linked in
the main perf binary, making it easier for packaging, etc.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/