All of lore.kernel.org
 help / color / mirror / Atom feed
* About use of dlsym()
@ 2014-08-08  6:29 taeung
  2014-08-09 13:39 ` Taeung
  2014-08-11  7:25 ` Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: taeung @ 2014-08-08  6:29 UTC (permalink / raw)
  To: linux-perf-users

Hello, perf hackers :-)

I'm beginner in perf.
I'm analysing the sequence of function call and how it was written to 
update 'report' of gtk view.

This is a thread of a command 'perf report --gtk'

1. run_argv()
(in main of perf.c:534)

2. handle_internal_command()
(in run_argv of perf.c:420 )
So far, I've thought this process is to filter what command and option is

3. cmd_report()
(in run_builtin of perf.c:319) by function pointer

4. setup_browser()
(in cmd_report of builtin-report.c:750)

5. setup_gtk_browser()
(in setup_browser of ui/setup.c:74)

6. perf_gtk__init()
(in setup_gtk_browser of ui/setup.c:32)

about number 6, I have a question.

In setup_gtk_browser of ui/setup.c: 28 ~ 32,

  28         perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init");
  29         if (perf_ui_init == NULL)
  30                 goto out_close;
  31
  32         if (perf_ui_init() == 0)
  33                 return 0;
  34

Why not call directly 'perf_gtk__init()' ?
Why call the function by function pointer(perf_ui_init) after it is 
gotten by 'dlsym()' ?
Why use 'dlsym()' ?
Is it better than calling directly the function ?

- Taeung -

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About use of dlsym()
  2014-08-08  6:29 About use of dlsym() taeung
@ 2014-08-09 13:39 ` Taeung
  2014-08-11  7:25 ` Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Taeung @ 2014-08-09 13:39 UTC (permalink / raw)
  To: linux-perf-users

Sorry for my poor question.

I didn't know that 'dlopen()', 'dlsym()', 'dlclose()' for DL(Dynamic 
Library).
But I know it.

- Taeung -

On 08/08/2014 03:29 PM, taeung wrote:
> Hello, perf hackers :-)
>
> I'm beginner in perf.
> I'm analysing the sequence of function call and how it was written to 
> update 'report' of gtk view.
>
> This is a thread of a command 'perf report --gtk'
>
> 1. run_argv()
> (in main of perf.c:534)
>
> 2. handle_internal_command()
> (in run_argv of perf.c:420 )
> So far, I've thought this process is to filter what command and option is
>
> 3. cmd_report()
> (in run_builtin of perf.c:319) by function pointer
>
> 4. setup_browser()
> (in cmd_report of builtin-report.c:750)
>
> 5. setup_gtk_browser()
> (in setup_browser of ui/setup.c:74)
>
> 6. perf_gtk__init()
> (in setup_gtk_browser of ui/setup.c:32)
>
> about number 6, I have a question.
>
> In setup_gtk_browser of ui/setup.c: 28 ~ 32,
>
>  28         perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init");
>  29         if (perf_ui_init == NULL)
>  30                 goto out_close;
>  31
>  32         if (perf_ui_init() == 0)
>  33                 return 0;
>  34
>
> Why not call directly 'perf_gtk__init()' ?
> Why call the function by function pointer(perf_ui_init) after it is 
> gotten by 'dlsym()' ?
> Why use 'dlsym()' ?
> Is it better than calling directly the function ?
>
> - Taeung -

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About use of dlsym()
  2014-08-08  6:29 About use of dlsym() taeung
  2014-08-09 13:39 ` Taeung
@ 2014-08-11  7:25 ` Namhyung Kim
  2014-08-12  5:51   ` taeung
  1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2014-08-11  7:25 UTC (permalink / raw)
  To: taeung; +Cc: linux-perf-users

Hi taeung,

On Fri, 08 Aug 2014 15:29:26 +0900, taeung wrote:
> Hello, perf hackers :-)
>
> I'm beginner in perf.
> I'm analysing the sequence of function call and how it was written to
> update 'report' of gtk view.
>
> This is a thread of a command 'perf report --gtk'
>
> 1. run_argv()
> (in main of perf.c:534)
>
> 2. handle_internal_command()
> (in run_argv of perf.c:420 )
> So far, I've thought this process is to filter what command and option is
>
> 3. cmd_report()
> (in run_builtin of perf.c:319) by function pointer
>
> 4. setup_browser()
> (in cmd_report of builtin-report.c:750)
>
> 5. setup_gtk_browser()
> (in setup_browser of ui/setup.c:74)
>
> 6. perf_gtk__init()
> (in setup_gtk_browser of ui/setup.c:32)
>
> about number 6, I have a question.
>
> In setup_gtk_browser of ui/setup.c: 28 ~ 32,
>
>  28         perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init");
>  29         if (perf_ui_init == NULL)
>  30                 goto out_close;
>  31
>  32         if (perf_ui_init() == 0)
>  33                 return 0;
>  34
>
> Why not call directly 'perf_gtk__init()' ?
> Why call the function by function pointer(perf_ui_init) after it is
> gotten by 'dlsym()' ?
> Why use 'dlsym()' ?
> Is it better than calling directly the function ?

It was because many perf users wanted to reduce dependency in the main
perf binary as they hardly/never use the GTK ui.  Although it can be
disabled with NO_GTK2=1 when invoking make, they're just too lazy to do
that. :)

Please see https://lkml.org/lkml/2013/8/4/154 .

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About use of dlsym()
  2014-08-11  7:25 ` Namhyung Kim
@ 2014-08-12  5:51   ` taeung
  0 siblings, 0 replies; 4+ messages in thread
From: taeung @ 2014-08-12  5:51 UTC (permalink / raw)
  To: linux-perf-users

Thanks, Namhyung Kim

I've understood what you mean.
And I've read the patch which you told me.

There are the different between current version and the patch.
In current version, 'perfgtk', gtkstub.c aren't used.
and GUI_OBJS was changed into GTK_OBJS.

I thought about the reason why DL(Dynamic Library) is used instead of  
several ways of the patch.
But I need to look over more..

Thank you, again.

- Taeung -

On 08/11/2014 04:25 PM, Namhyung Kim wrote:
> Hi taeung,
>
> On Fri, 08 Aug 2014 15:29:26 +0900, taeung wrote:
>> Hello, perf hackers :-)
>>
>> I'm beginner in perf.
>> I'm analysing the sequence of function call and how it was written to
>> update 'report' of gtk view.
>>
>> This is a thread of a command 'perf report --gtk'
>>
>> 1. run_argv()
>> (in main of perf.c:534)
>>
>> 2. handle_internal_command()
>> (in run_argv of perf.c:420 )
>> So far, I've thought this process is to filter what command and option is
>>
>> 3. cmd_report()
>> (in run_builtin of perf.c:319) by function pointer
>>
>> 4. setup_browser()
>> (in cmd_report of builtin-report.c:750)
>>
>> 5. setup_gtk_browser()
>> (in setup_browser of ui/setup.c:74)
>>
>> 6. perf_gtk__init()
>> (in setup_gtk_browser of ui/setup.c:32)
>>
>> about number 6, I have a question.
>>
>> In setup_gtk_browser of ui/setup.c: 28 ~ 32,
>>
>>   28         perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init");
>>   29         if (perf_ui_init == NULL)
>>   30                 goto out_close;
>>   31
>>   32         if (perf_ui_init() == 0)
>>   33                 return 0;
>>   34
>>
>> Why not call directly 'perf_gtk__init()' ?
>> Why call the function by function pointer(perf_ui_init) after it is
>> gotten by 'dlsym()' ?
>> Why use 'dlsym()' ?
>> Is it better than calling directly the function ?
> It was because many perf users wanted to reduce dependency in the main
> perf binary as they hardly/never use the GTK ui.  Although it can be
> disabled with NO_GTK2=1 when invoking make, they're just too lazy to do
> that. :)
>
> Please see https://lkml.org/lkml/2013/8/4/154 .
>
> Thanks,
> Namhyung

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-12  5:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08  6:29 About use of dlsym() taeung
2014-08-09 13:39 ` Taeung
2014-08-11  7:25 ` Namhyung Kim
2014-08-12  5:51   ` taeung

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.