After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757047 - tracer: [API]: add register_hook_for_target.
tracer: [API]: add register_hook_for_target.
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-24 09:31 UTC by Thibault Saunier
Modified: 2018-11-03 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tracer: [API]: add register_hook_for_target. (15.91 KB, patch)
2015-10-24 09:31 UTC, Thibault Saunier
none Details | Review
tracer: [API]: add register_hook_for_target. (15.92 KB, patch)
2015-10-24 09:58 UTC, Thibault Saunier
none Details | Review

Description Thibault Saunier 2015-10-24 09:31:30 UTC
See commit message
Comment 1 Thibault Saunier 2015-10-24 09:31:35 UTC
Created attachment 314005 [details] [review]
tracer: [API]: add register_hook_for_target.

This will allow monitoring specific objects in a generic way.

+ Add a test
+ Update the dispatching routines.
Comment 2 Sebastian Dröge (slomo) 2015-10-24 09:48:53 UTC
Review of attachment 314005 [details] [review]:

Just out of curiosity, do you have a tracer that uses this? What does it do? :)

::: gst/gsttracerutils.c
@@ +286,3 @@
 
+static void
+gst_tracing_register_hook_full (GstTracer * tracer, GQuark detail,

Should this one be public then maybe, and be called gst_tracing_register_hook() without the _full?

@@ -291,3 @@
- * @func: (scope async): the callback
- *
- * Register @func to be called when the trace hook @detail is getting invoked.

Since: 1.8 everywhere
Comment 3 Thibault Saunier 2015-10-24 09:57:44 UTC
(In reply to Sebastian Dröge (slomo) from comment #2)
> Review of attachment 314005 [details] [review] [review]:
> 
> Just out of curiosity, do you have a tracer that uses this? What does it do?
> :)

Yes, we have one tracer per pad as GstValidatePadMonitor (and so on for other components).

> ::: gst/gsttracerutils.c
> @@ +286,3 @@
>  
> +static void
> +gst_tracing_register_hook_full (GstTracer * tracer, GQuark detail,
> 
> Should this one be public then maybe, and be called
> gst_tracing_register_hook() without the _full?

We already have;

void 
gst_tracing_register_hook (GstTracer * tracer, const gchar * detail, 
     GCallback func) 

I do not think that needs to be public.

> @@ -291,3 @@
> - * @func: (scope async): the callback
> - *
> - * Register @func to be called when the trace hook @detail is getting
> invoked.
> 
> Since: 1.8 everywhere

The Tracers are Since 1.8, I thinking adding it once is enough no?
Comment 4 Thibault Saunier 2015-10-24 09:58:25 UTC
Created attachment 314007 [details] [review]
tracer: [API]: add register_hook_for_target.

This will allow monitoring specific objects in a generic way.

+ Add a test
+ Update the dispatching routines.
Comment 5 Sebastian Dröge (slomo) 2015-10-24 10:02:35 UTC
Ok, makes sense then (also for the Since). Let's wait a bit if there are other opinions :)
Comment 6 Tim-Philipp Müller 2015-10-24 11:19:43 UTC
Why is target a gpointer? That's not nice for bindings and in general. Is it not always a GObject or GstObject?
Comment 7 Sebastian Dröge (slomo) 2015-10-24 11:33:24 UTC
We might want to add tracers later for miniobjects
Comment 8 Thibault Saunier 2015-10-24 12:48:53 UTC
(In reply to Tim-Philipp Müller from comment #6)
> Why is target a gpointer? That's not nice for bindings and in general. Is it
> not always a GObject or GstObject?

The tracer API is really not nice for bindings... we discussed that in the bug about that new API and decided optimisation was more important, and we could plug a binding friendly API on top.
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2015-10-25 03:16:27 UTC
I think there is still some misunderstanding how the tracer is supposed to be used. The tracer plugins will collect data and stream then. That's it.
The code that analyzes the data is supposed to read that from the stream. While the app is running or post-mostem.

The fact that the stream is now part of the gst-debug log is interrim. I've posted this bug a loooong time ago for discussion: https://bugzilla.gnome.org/show_bug.cgi?id=733188

If we start filtering in the hooks already, where do we start and where do we stop? I think the filtering should be done in the app. If we want filtering in the hook already we need to rethink the api to be more flexible (e.g. using a callback). Otherwise we're going to add more and more functions here.

So if we want this, what about
gst_tracing_register_filtered_hook (GstTracer * tracer, const gchar * detail, 
     GCallback func,GstTracerFilterFunc filter)

+ the hook_id variant.
Comment 10 Thibault Saunier 2015-10-25 19:34:11 UTC
(In reply to Stefan Sauer (gstreamer, gtkdoc dev) from comment #9)
> I think there is still some misunderstanding how the tracer is supposed to
> be used. The tracer plugins will collect data and stream then. That's it.
> The code that analyzes the data is supposed to read that from the stream.
> While the app is running or post-mostem.

This model does not really work for GstValidate where we do lot of behaviour checks at runtime, doing that post-mortem is gonna be really complex and not bring much. Also doing that with the current API is not gonna look good codewise in GstValidate. Having GstMonitors (which monitor one particular object) subclassing GstTracer makes everything clean and nice.

> The fact that the stream is now part of the gst-debug log is interrim. I've
> posted this bug a loooong time ago for discussion:
> https://bugzilla.gnome.org/show_bug.cgi?id=733188

I do not see how that is related to the subject here.

> If we start filtering in the hooks already, where do we start and where do
> we stop? I think the filtering should be done in the app. If we want
> filtering in the hook already we need to rethink the api to be more flexible
> (e.g. using a callback). Otherwise we're going to add more and more
> functions here.
> 
> So if we want this, what about
> gst_tracing_register_filtered_hook (GstTracer * tracer, const gchar *
> detail, 
>      GCallback func,GstTracerFilterFunc filter)

That only works if we have the 'target' in the GstTracerFilterFunc prototype and we make the function look like:

gst_tracing_register_filtered_hook (GstTracer * tracer, const gchar * detail,
                                    GCallback func, GstTracerFilterFunc filter,
                                    gpointer data)
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2015-10-26 00:06:07 UTC
(In reply to Thibault Saunier from comment #10)
> (In reply to Stefan Sauer (gstreamer, gtkdoc dev) from comment #9)
> > I think there is still some misunderstanding how the tracer is supposed to
> > be used. The tracer plugins will collect data and stream then. That's it.
> > The code that analyzes the data is supposed to read that from the stream.
> > While the app is running or post-mostem.
> 
> This model does not really work for GstValidate where we do lot of behaviour
> checks at runtime, doing that post-mortem is gonna be really complex and not
> bring much. Also doing that with the current API is not gonna look good
> codewise in GstValidate. Having GstMonitors (which monitor one particular
> object) subclassing GstTracer makes everything clean and nice.

I am aware that the post-mosted analysis is not a good fit for you.

> 
> > The fact that the stream is now part of the gst-debug log is interrim. I've
> > posted this bug a loooong time ago for discussion:
> > https://bugzilla.gnome.org/show_bug.cgi?id=733188
> 
> I do not see how that is related to the subject here.

The idea was that e.g. you run the tracers in process and the analysis out-of-process or even on a different device. We want to affect the traced process as little as possible. Right now a trace-consumer that would like to trace a live app, would need to install a GstLogFunction and out-of-process is not yet supported. Due to these issues, people will jump to the conclussion that they need to write their own tracers. This is why I mentioned the ticket. Why I am back in european TZ we should discuss what you actually want to do :) 

> 
> > If we start filtering in the hooks already, where do we start and where do
> > we stop? I think the filtering should be done in the app. If we want
> > filtering in the hook already we need to rethink the api to be more flexible
> > (e.g. using a callback). Otherwise we're going to add more and more
> > functions here.
> > 
> > So if we want this, what about
> > gst_tracing_register_filtered_hook (GstTracer * tracer, const gchar *
> > detail, 
> >      GCallback func,GstTracerFilterFunc filter)
> 
> That only works if we have the 'target' in the GstTracerFilterFunc prototype
> and we make the function look like:
> 
> gst_tracing_register_filtered_hook (GstTracer * tracer, const gchar * detail,
>                                     GCallback func, GstTracerFilterFunc
> filter,
>                                     gpointer data)

Yes, I've forgot the user_data.
Comment 12 GStreamer system administrator 2018-11-03 12:30:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/134.