19 Mar 2006 phkhal   » (Journeyer)

Today I remembered I had a blog. Last entry was exactly 3 months ago! I'm due.

GStreamer Profiler

Last couple of days I have been working on a simple profiler for GStreamer. Basically I wanted to see how much time each packet was spending inside the pipeline and inside the different elements. Specifically for RTP that requires good latency. I wanted something non-intrusive that didn't require any changes to the existing elements, and I wanted something fast so it wouldn't make the collected data useless. It also needed to be thread-safe since elements can run in different threads. After some discussion on irc I came up with a simple profiler that works. Basically it allocates a memory space and uses an atomic pointer to insert structs into that memory space. The structs have some data such as the element name, the buffer size, the time of the log, etc. As for doing the actual logging, I simply override the gst_pad_push() and gst_pad_chain() functions using LD_PRELOAD magic. This will log most buffers when they enter/leave each element in the pipeline. For the moment it simply puts the collected data in a log file, but in the future I want to write some processing code that give me easier to read data.

Here is a screenshot. The yellow and red colors represent the 2 different threads (one for receiving and one for sending). The sinks/sources on each thread are also colored. Other than giving timing information it also allows me to more easily see the flow of packets happening in the pipeline.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!