2005-02-16 17:19:06 +00:00
|
|
|
$Id$
|
|
|
|
|
2006-10-16 13:53:55 +00:00
|
|
|
= profiling =
|
2005-02-16 17:19:06 +00:00
|
|
|
|
2006-10-16 13:53:55 +00:00
|
|
|
== what information is interesting? ==
|
2007-11-22 15:59:01 +00:00
|
|
|
* pipeline throughput
|
2006-10-16 13:53:55 +00:00
|
|
|
if we know the cpu-load for a given datastream, we could extrapolate what the
|
|
|
|
system can handle
|
|
|
|
-> qos profiling
|
|
|
|
* load distribution
|
|
|
|
which element causes which cpu load/memory usage
|
2005-02-16 17:19:06 +00:00
|
|
|
|
|
|
|
|
2006-08-30 12:28:55 +00:00
|
|
|
= qos profiling =
|
|
|
|
* what data is needed ?
|
2018-04-27 16:40:31 +00:00
|
|
|
* (streamtime,proportion) pairs from sinks
|
2006-08-30 12:28:55 +00:00
|
|
|
draw a graph with gnuplot or similar
|
|
|
|
* number of frames in total
|
2007-07-20 07:26:39 +00:00
|
|
|
* number of audio/video frames dropped from each element that support QOS
|
|
|
|
* could be expressed as percent in relation to total-frames
|
2006-08-30 12:28:55 +00:00
|
|
|
|
2007-07-20 07:26:39 +00:00
|
|
|
* query data (e.g. via. gst-launch)
|
2006-08-30 12:28:55 +00:00
|
|
|
* add -r, --report option to gst-launch
|
2007-07-20 07:26:39 +00:00
|
|
|
* during playing we capture QOS-events to record 'streamtime,proportion' pairs
|
2006-10-16 13:53:55 +00:00
|
|
|
gst_pad_add_event_probe(video_sink->sink_pad,handler,data)
|
2018-04-27 16:40:31 +00:00
|
|
|
* during playback we like to know when an element drops frames
|
2006-10-16 13:53:55 +00:00
|
|
|
what about elements sending a qos_action message?
|
2006-08-30 12:28:55 +00:00
|
|
|
* after EOS, send qos-queries to each element in the pipeline
|
|
|
|
* qos-query will return:
|
|
|
|
number of frames rendered
|
|
|
|
number of frames dropped
|
|
|
|
* print a nice table with the results
|
2006-10-16 13:53:55 +00:00
|
|
|
* QOS stats first
|
2007-07-20 07:26:39 +00:00
|
|
|
* writes a gnuplot data file
|
|
|
|
* list of 'streamtime,proportion,<drop>' tuples
|
|
|
|
|
2006-08-30 12:28:55 +00:00
|
|
|
|
2006-10-16 13:53:55 +00:00
|
|
|
= core profiling =
|
|
|
|
* scheduler keeps a list of usecs the process function of each element was
|
|
|
|
running
|
|
|
|
* process functions are: loop, chain, get, they are driven by gst_pad_push() and
|
|
|
|
gst_pad_pull_range()
|
|
|
|
* scheduler keeps a sum of all times
|
|
|
|
* each gst-element has a profile_percentage field
|
|
|
|
|
|
|
|
* when going to play
|
|
|
|
* scheduler sets sum and all usecs in the list to 0
|
|
|
|
* when handling an element
|
|
|
|
* remember old usecs t_old
|
|
|
|
* take time t1
|
|
|
|
* call elements processing function
|
|
|
|
* take time t2
|
|
|
|
* t_new=t2-t1
|
|
|
|
* sum+=(t_new-t_old)
|
|
|
|
* profile_percentage=t_new/sum;
|
|
|
|
* should the percentage be averaged?
|
|
|
|
* profile_percentage=(profile_percentage+(t_new/sum))/2.0;
|
|
|
|
|
|
|
|
* the profile_percentage shows how much CPU time the element uses in relation
|
|
|
|
to the whole pipeline
|
|
|
|
|
2007-11-13 11:30:09 +00:00
|
|
|
= rusage + pad-probes =
|
2006-10-16 13:53:55 +00:00
|
|
|
* check get_rusage() based cpu usage detection in buzztard
|
2006-10-20 11:36:56 +00:00
|
|
|
this together with pad_probes could gives us decent application level profiles
|
2006-11-15 13:00:16 +00:00
|
|
|
* different elements
|
|
|
|
* 1:1 elements are easy to handle
|
|
|
|
* 0:1 elements need a start timer
|
|
|
|
* 1:0 elements need a end timer
|
2018-04-27 16:40:31 +00:00
|
|
|
* n:1, 1:m and n:m type elements are tricky
|
2006-11-15 13:00:16 +00:00
|
|
|
adapter based elements might have a fluctuating usage in addition
|
2006-11-06 15:17:35 +00:00
|
|
|
|
|
|
|
// result data
|
|
|
|
struct {
|
|
|
|
beg_min,beg_max;
|
|
|
|
end_min,end_max;
|
|
|
|
} profile_data;
|
|
|
|
|
|
|
|
// install probes
|
|
|
|
gst_bin_iterate_elements(pipeline)
|
|
|
|
gst_element_iterate_pads(element)
|
|
|
|
if (gst_pad_get_direction(pad)==GST_PAD_SRC)
|
|
|
|
gst_pad_add_buffer_probe(pad,end_timer,profile_data)
|
|
|
|
else
|
|
|
|
gst_pad_add_buffer_probe(pad,beg_timer,profile_data)
|
|
|
|
|
|
|
|
// listen to bus state-change messages to
|
|
|
|
// * reset counters on NULL_TO_READY
|
|
|
|
// * print results on READY_TO_NULL
|
2006-10-16 13:53:55 +00:00
|
|
|
|
2007-11-13 11:30:09 +00:00
|
|
|
= PerformanceMonitor =
|
|
|
|
Write a ld-preload lib that can gather data from gstreamer and logs it to files.
|
2011-09-07 11:14:38 +00:00
|
|
|
The idea is not avoid adding API for performance measurement to gstreamer.
|
2007-11-13 11:30:09 +00:00
|
|
|
|
|
|
|
== Services ==
|
|
|
|
library provides some common services used by the sensor modules.
|
|
|
|
* logging
|
|
|
|
* timestamps
|
|
|
|
|
|
|
|
== Sensors ==
|
2011-09-07 11:14:38 +00:00
|
|
|
Sensors do measurements and deliver timestampe performance data.
|
2007-11-13 11:30:09 +00:00
|
|
|
* bitrates and latency via gst_pad_push/pull per link
|
|
|
|
* qos ratio via gst_event_new_qos(), gst_pad_send_event()
|
|
|
|
* cpu/mem via get_rusage
|
|
|
|
* when (gst_clock_get_time) ?
|
|
|
|
* we want it per thread
|
|
|
|
* queue fill levels
|
2007-11-22 15:59:01 +00:00
|
|
|
* number of
|
|
|
|
* threads
|
|
|
|
* open files
|
2007-11-13 11:30:09 +00:00
|
|
|
|
|
|
|
== Wanted Sensors ==
|
|
|
|
* dropped buffers
|
|
|
|
|
|
|
|
== Log Format ==
|
|
|
|
* we have global data, data per {link,element,thread}
|
|
|
|
|
|
|
|
<timestamp> [<sensor-data>] [<sensor-data>]
|
|
|
|
|
|
|
|
* sample
|
|
|
|
timestamp [qos-ratio] [cpu-load={sum,17284,17285}]
|
|
|
|
00126437 [0.5] [0.7,0.2,0.5]
|
|
|
|
00126437 [0.8] [0.9,0.2,0.7]
|
|
|
|
|
|
|
|
* questions
|
|
|
|
** should we have the log config in the header or in some separate config?
|
|
|
|
- if config, we just specify the config when capturing put that
|
|
|
|
in the first log line
|
2011-09-07 11:14:38 +00:00
|
|
|
- otherwise the analyzer ui has to parse it from the first line
|
2007-11-13 11:30:09 +00:00
|
|
|
|
|
|
|
== Running ==
|
|
|
|
LD_PRELOAD=libgstperfmon.so GST_PERFMON_DETAILS="qos-ratio,cpu-load=all" <application>
|
|
|
|
LD_PRELOAD=libgstperfmon.so GST_PERFMON_DETAILS="qos-ratio,cpu-load=sum" <application>
|
2007-11-22 15:59:01 +00:00
|
|
|
LD_PRELOAD=libgstperfmon.so GST_PERFMON_DETAILS="*" <application>
|
2007-11-13 11:30:09 +00:00
|
|
|
|
|
|
|
== Exploration
|
|
|
|
pygtk ui, mathplotlib
|
|
|
|
|
|
|
|
== Ideas ==
|
|
|
|
* can be used in media test suite as a monitor
|
|
|
|
|