diff options
author | Stefan Sauer <ensonic@users.sf.net> | 2012-12-17 21:17:41 +0100 |
---|---|---|
committer | Stefan Sauer <ensonic@users.sf.net> | 2012-12-17 21:17:41 +0100 |
commit | 29a34058a9a128532e19a4ee24b32d0528877ba1 (patch) | |
tree | 898f34dfeb82c5d3353ebc4889ba26c4dda0c2f0 | |
parent | c1c19f4bd2e1aa2f51ffc88821bd2b83a1be6385 (diff) |
trace: also track calls to _send_event, but filter nested calls
-rw-r--r-- | src/gsttracelib.c | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/src/gsttracelib.c b/src/gsttracelib.c index 7861a4a..76e8d22 100644 --- a/src/gsttracelib.c +++ b/src/gsttracelib.c | |||
@@ -370,8 +370,7 @@ _log_common (GstClockTimeDiff treal) | |||
370 | //cpuload = (guint) gst_util_uint64_scale (tusersys, G_GINT64_CONSTANT(100), treal); | 370 | //cpuload = (guint) gst_util_uint64_scale (tusersys, G_GINT64_CONSTANT(100), treal); |
371 | aspent+=dspent; | 371 | aspent+=dspent; |
372 | areal+=dreal; | 372 | areal+=dreal; |
373 | if(areal > GST_SECOND) { | 373 | if(areal > GST_MSECOND * 50) { |
374 | //if(areal > (GST_MSECOND*500)) { | ||
375 | cpuload = (guint) gst_util_uint64_scale (aspent, G_GINT64_CONSTANT(100), areal); | 374 | cpuload = (guint) gst_util_uint64_scale (aspent, G_GINT64_CONSTANT(100), areal); |
376 | /* we only want cpu-load in playing, otherwise max is almost always 100 */ | 375 | /* we only want cpu-load in playing, otherwise max is almost always 100 */ |
377 | if (check_cpuload && (cpuload <= 100)) { | 376 | if (check_cpuload && (cpuload <= 100)) { |
@@ -1209,22 +1208,15 @@ gst_pad_pull_range (GstPad * pad, guint64 offset, guint size, GstBuffer ** buffe | |||
1209 | return ret; | 1208 | return ret; |
1210 | } | 1209 | } |
1211 | 1210 | ||
1212 | /* gst_pad_push_event(pad) calls gst_pad_send_event(peer); | 1211 | void |
1213 | * but not in all code-paths' | 1212 | gst_pad_send_or_push_event_common (GstPad *pad, GstEvent *event, GstClockTimeDiff elapsed) |
1214 | */ | ||
1215 | static gboolean (*orig_pad_push_event) (GstPad *, GstEvent *); | ||
1216 | |||
1217 | gboolean | ||
1218 | gst_pad_push_event (GstPad *pad, GstEvent *event) | ||
1219 | { | 1213 | { |
1220 | GstClockTimeDiff elapsed = _get_elapsed(); | ||
1221 | GstObject *parent; | 1214 | GstObject *parent; |
1222 | GstElement *element; | 1215 | GstElement *element; |
1223 | GsttlElementStats *stats, *that_stats; | 1216 | GsttlElementStats *stats, *that_stats; |
1224 | GstPad *real_pad = pad; | 1217 | GstPad *real_pad = pad; |
1225 | GstPad *peer_pad = GST_PAD_PEER (pad); | 1218 | GstPad *peer_pad = GST_PAD_PEER (pad); |
1226 | GsttlPadStats *pad_stats,*peer_pad_stats; | 1219 | GsttlPadStats *pad_stats,*peer_pad_stats; |
1227 | gboolean ret; | ||
1228 | 1220 | ||
1229 | parent = _get_real_pad_parent(real_pad); | 1221 | parent = _get_real_pad_parent(real_pad); |
1230 | if(element = GST_ELEMENT (parent)) { | 1222 | if(element = GST_ELEMENT (parent)) { |
@@ -1285,15 +1277,56 @@ gst_pad_push_event (GstPad *pad, GstEvent *event) | |||
1285 | /* switch cpu-load logging on/off */ | 1277 | /* switch cpu-load logging on/off */ |
1286 | _check_playing (element); | 1278 | _check_playing (element); |
1287 | } | 1279 | } |
1280 | } | ||
1281 | |||
1282 | |||
1283 | /* gst_pad_push_event(pad) calls gst_pad_send_event(peer); | ||
1284 | * but not in all code-paths', we track both, but handle the case where one calls | ||
1285 | * the other */ | ||
1286 | static gboolean (*orig_pad_push_event) (GstPad *, GstEvent *); | ||
1287 | static gboolean _in_push_event = FALSE; | ||
1288 | |||
1289 | gboolean | ||
1290 | gst_pad_push_event (GstPad *pad, GstEvent *event) | ||
1291 | { | ||
1292 | GstClockTimeDiff elapsed = _get_elapsed(); | ||
1293 | gboolean ret; | ||
1294 | |||
1295 | gst_pad_send_or_push_event_common (pad, event, elapsed); | ||
1288 | 1296 | ||
1289 | _log_common(elapsed); | 1297 | _log_common(elapsed); |
1298 | _in_push_event = TRUE; | ||
1290 | ret = orig_pad_push_event (pad, event); | 1299 | ret = orig_pad_push_event (pad, event); |
1291 | elapsed = _get_elapsed(); | 1300 | elapsed = _get_elapsed(); |
1292 | _log_common(elapsed); | 1301 | _log_common(elapsed); |
1302 | _in_push_event = FALSE; | ||
1303 | |||
1304 | return ret; | ||
1305 | } | ||
1306 | |||
1307 | static gboolean (*orig_pad_send_event) (GstPad *, GstEvent *); | ||
1308 | |||
1309 | gboolean | ||
1310 | gst_pad_send_event (GstPad *pad, GstEvent *event) | ||
1311 | { | ||
1312 | GstClockTimeDiff elapsed = _get_elapsed(); | ||
1313 | gboolean ret; | ||
1314 | |||
1315 | if (_in_push_event) { | ||
1316 | return orig_pad_send_event (pad, event); | ||
1317 | } | ||
1318 | |||
1319 | gst_pad_send_or_push_event_common (pad, event, elapsed); | ||
1320 | |||
1321 | _log_common(elapsed); | ||
1322 | ret = orig_pad_send_event (pad, event); | ||
1323 | elapsed = _get_elapsed(); | ||
1324 | _log_common(elapsed); | ||
1293 | 1325 | ||
1294 | return ret; | 1326 | return ret; |
1295 | } | 1327 | } |
1296 | 1328 | ||
1329 | |||
1297 | static gboolean (*orig_element_post_message) (GstElement *, GstMessage *); | 1330 | static gboolean (*orig_element_post_message) (GstElement *, GstMessage *); |
1298 | 1331 | ||
1299 | gboolean | 1332 | gboolean |