poolstress: code cleanups

Add a few comments. Tell in the results, which number are from which test.
This commit is contained in:
Stefan Sauer 2014-01-29 18:21:34 +01:00
parent 826a4e3535
commit 5ad01ab77d

View file

@ -22,6 +22,7 @@
#include <gst/gst.h>
#include "gst/glib-compat-private.h"
#define BUFFER_SIZE (1400)
gint
main (gint argc, gchar * argv[])
@ -30,6 +31,7 @@ main (gint argc, gchar * argv[])
GstBuffer *tmp;
GstBufferPool *pool;
GstClockTime start, end;
GstClockTimeDiff dur;
guint64 nbuffers;
GstStructure *conf;
@ -54,34 +56,34 @@ main (gint argc, gchar * argv[])
pool = gst_buffer_pool_new ();
conf = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (conf, NULL, 1400, 0, 0);
gst_buffer_pool_config_set_params (conf, NULL, BUFFER_SIZE, 0, 0);
gst_buffer_pool_set_config (pool, conf);
gst_buffer_pool_set_active (pool, TRUE);
/* allocate buffers directly */
start = gst_util_get_timestamp ();
for (i = 0; i < nbuffers; i++) {
tmp = gst_buffer_new_allocate (NULL, 1400, NULL);
tmp = gst_buffer_new_allocate (NULL, BUFFER_SIZE, NULL);
gst_buffer_unref (tmp);
}
end = gst_util_get_timestamp ();
dur = GST_CLOCK_DIFF (start, end);
g_print ("*** total %" GST_TIME_FORMAT " - average %" GST_TIME_FORMAT
" - Done creating %" G_GUINT64_FORMAT " buffers\n",
GST_TIME_ARGS (end - start),
GST_TIME_ARGS ((end - start) / (nbuffers)), nbuffers);
" - Done creating %" G_GUINT64_FORMAT " fresh buffers\n",
GST_TIME_ARGS (dur), GST_TIME_ARGS (dur / nbuffers), nbuffers);
/* allocate buffers from the pool */
start = gst_util_get_timestamp ();
for (i = 0; i < nbuffers; i++) {
gst_buffer_pool_acquire_buffer (pool, &tmp, NULL);
gst_buffer_unref (tmp);
}
end = gst_util_get_timestamp ();
dur = GST_CLOCK_DIFF (start, end);
g_print ("*** total %" GST_TIME_FORMAT " - average %" GST_TIME_FORMAT
" - Done creating %" G_GUINT64_FORMAT " buffers\n",
GST_TIME_ARGS (end - start),
GST_TIME_ARGS ((end - start) / (nbuffers)), nbuffers);
" - Done creating %" G_GUINT64_FORMAT " pooled buffers\n",
GST_TIME_ARGS (dur), GST_TIME_ARGS (dur / nbuffers), nbuffers);
gst_buffer_pool_set_active (pool, FALSE);
gst_object_unref (pool);