Hi,

I reply to my own post. On the second time using gprof turned to be easy.
In case anybody is interested, the steps are:

1. you need the gimp compiled with debug option [but this I am not sure
about, and can not test right now]
2. Compile your plugin with '-pg' switch. If you are using gimptool-2.0
command to compile, just copy&paste that long command it prints out and put
'-pg' just after gcc, like:
gcc -pg -pthread -I/usr/include/gimp-2.0 -I/usr/include/gtk-2.0
..............
3. run gimp from command line (stop other instances beforehand) and work a
bit with your plugin you are to profile, and quit it. (You might quit gimp
here as well)
4. in the directory where you run the gimp from, you can find file
'gmon.out' and thus run following:
>gprof ~/.gimp-2.8/plug-ins/colorblur
(yes the actual path to plugin binary is needed, also piping to a file or
to 'more' command might be suitable)

The output would look like:

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 97.62      0.41     0.41                             blur_step
  2.38      0.42     0.01        1    10.00    10.00  fill_tmp
  0.00      0.42     0.00   378043     0.00     0.00  basepos
  0.00      0.42     0.00    40000     0.00     0.00  get_bright
[and more lines and sections to follow]

Here in my example I found what I expected (First column is interesting to
me). And in fact the result is not that usefull for me...

So maybe this small howto will be usefull for somebody...

Regards




2013/3/8 Tibor Bamhor <[email protected]>

> Hi,
>
>
> this is my first post in this mailing list ever, I am developer of few
> C-based plugins for gimp, but overall I am not professional developer. Now
> I have a question about profiling of plugins.
>
>
> I have some experiences with debugging a plugin with valgrind, but now I
> would like to get an output like provided by gprof. The purpose is to try
> to speed up a plugin. So I need to identify and measure top functions by
> their CPU time usage.
>
>
> I tried to google but almost to no avail. So what tool should be best for
> it? Is it possible to make gprof work with gimp plugin - this tools seems
> to be very easy to use, so I would be fine with it.
>
>
> Thanks
>
>
>
> PS: this is not a question but right now I found that if I compile plugin
> with limit 1 thread only and then with limit 2 threads, the CPU time goes
> up by about 42 %. Of course real time (that is important from user's
> perspective) goes down by 10%, but it is ONLY 10 %. So this behaviour is
> another reason why I would like to know what is going on during
> processing...
>
_______________________________________________
gimp-developer-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gimp-developer-list

Reply via email to