- replace old tracing with common GstTrace

Original commit message from CVS:
- replace old tracing with common GstTrace
This commit is contained in:
Wim Taymans 2003-02-02 19:40:10 +00:00
parent 6b44117681
commit fe83917b5c
4 changed files with 49 additions and 67 deletions

View file

@ -31,11 +31,14 @@
#include "gstlog.h"
#include "gstbufferpool-default.h"
/* #define GST_WITH_ALLOC_TRACE */
#include "gsttrace.h"
GType _gst_buffer_type;
GType _gst_buffer_pool_type;
static gint _gst_buffer_live;
static gint _gst_buffer_pool_live;
static GstAllocTrace *_gst_buffer_trace;
static GstAllocTrace *_gst_buffer_pool_trace;
static GstMemChunk *chunk;
@ -50,8 +53,8 @@ _gst_buffer_initialize (void)
(GBoxedCopyFunc) gst_data_ref,
(GBoxedFreeFunc) gst_data_unref);
_gst_buffer_live = 0;
_gst_buffer_pool_live = 0;
_gst_buffer_trace = gst_alloc_trace_register (GST_BUFFER_TRACE_NAME);
_gst_buffer_pool_trace = gst_alloc_trace_register (GST_BUFFER_POOL_TRACE_NAME);
chunk = gst_mem_chunk_new ("GstBufferChunk", sizeof (GstBuffer),
sizeof (GstBuffer) * 200, 0);
@ -59,20 +62,6 @@ _gst_buffer_initialize (void)
GST_INFO (GST_CAT_BUFFER, "Buffers are initialized now");
}
/**
* gst_buffer_print_stats:
*
* Logs statistics about live buffers (using g_log).
*/
void
gst_buffer_print_stats (void)
{
g_log (g_log_domain_gstreamer, G_LOG_LEVEL_INFO, "%d live buffer(s)",
_gst_buffer_live);
g_log (g_log_domain_gstreamer, G_LOG_LEVEL_INFO, "%d live bufferpool(s)",
_gst_buffer_pool_live);
}
static void
_gst_buffer_free_to_pool (GstBuffer *buffer)
{
@ -94,7 +83,7 @@ _gst_buffer_sub_free (GstBuffer *buffer)
_GST_DATA_DISPOSE (GST_DATA (buffer));
gst_mem_chunk_free (chunk, GST_DATA (buffer));
_gst_buffer_live--;
gst_alloc_trace_free (_gst_buffer_trace, buffer);
}
/**
@ -121,7 +110,7 @@ gst_buffer_default_free (GstBuffer *buffer)
_GST_DATA_DISPOSE (GST_DATA (buffer));
gst_mem_chunk_free (chunk, GST_DATA (buffer));
_gst_buffer_live--;
gst_alloc_trace_free (_gst_buffer_trace, buffer);
}
static GstBuffer*
@ -170,21 +159,21 @@ gst_buffer_default_copy (GstBuffer *buffer)
GstBuffer*
gst_buffer_new (void)
{
GstBuffer *new;
GstBuffer *buf;
new = gst_mem_chunk_alloc0 (chunk);
_gst_buffer_live++;
buf = gst_mem_chunk_alloc0 (chunk);
gst_alloc_trace_new (_gst_buffer_trace, buf);
_GST_DATA_INIT (GST_DATA (new),
_GST_DATA_INIT (GST_DATA (buf),
_gst_buffer_type,
0,
(GstDataFreeFunction) gst_buffer_default_free,
(GstDataCopyFunction) gst_buffer_default_copy);
GST_BUFFER_BUFFERPOOL (new) = NULL;
GST_BUFFER_POOL_PRIVATE (new) = NULL;
GST_BUFFER_BUFFERPOOL (buf) = NULL;
GST_BUFFER_POOL_PRIVATE (buf) = NULL;
return new;
return buf;
}
/**
@ -281,7 +270,7 @@ gst_buffer_create_sub (GstBuffer *parent, guint offset, guint size)
/* create the new buffer */
buffer = gst_mem_chunk_alloc0 (chunk);
_gst_buffer_live++;
gst_alloc_trace_new (_gst_buffer_trace, buffer);
/* make sure nobody overwrites data in the new buffer
* by setting the READONLY flag */
@ -427,7 +416,7 @@ gst_buffer_pool_default_free (GstBufferPool *pool)
_GST_DATA_DISPOSE (GST_DATA (pool));
g_free (pool);
_gst_buffer_pool_live--;
gst_alloc_trace_free (_gst_buffer_pool_trace, pool);
}
/**
@ -460,7 +449,7 @@ gst_buffer_pool_new (GstDataFreeFunction free,
g_return_val_if_fail (buffer_new != NULL, NULL);
pool = g_new0 (GstBufferPool, 1);
_gst_buffer_pool_live++;
gst_alloc_trace_new (_gst_buffer_pool_trace, pool);
GST_DEBUG (GST_CAT_BUFFER, "allocating new buffer pool %p\n", pool);

View file

@ -31,6 +31,9 @@ G_BEGIN_DECLS
typedef struct _GstBuffer GstBuffer;
typedef struct _GstBufferPool GstBufferPool;
#define GST_BUFFER_TRACE_NAME "GstBuffer"
#define GST_BUFFER_POOL_TRACE_NAME "GstBufferPool"
extern GType _gst_buffer_type;
extern GType _gst_buffer_pool_type;
@ -153,9 +156,6 @@ void _gst_buffer_initialize (void);
void gst_buffer_default_free (GstBuffer *buffer);
GstBuffer* gst_buffer_default_copy (GstBuffer *buffer);
void gst_buffer_print_stats (void);
/* creating a new buffer pools */
GstBufferPool* gst_buffer_pool_new (GstDataFreeFunction free,
GstDataCopyFunction copy,

View file

@ -27,11 +27,14 @@
#include "gstevent.h"
#include "gstlog.h"
/* #define GST_WITH_ALLOC_TRACE */
#include "gsttrace.h"
/* #define MEMPROF */
GType _gst_event_type;
static gint _gst_event_live;
static GstAllocTrace *_event_trace;
void
_gst_event_initialize (void)
@ -40,29 +43,17 @@ _gst_event_initialize (void)
_gst_event_type = g_boxed_type_register_static ("GstEvent",
(GBoxedCopyFunc) gst_data_ref,
(GBoxedFreeFunc) gst_data_unref);
_gst_event_live = 0;
}
/**
* gst_event_print_stats:
*
* Logs statistics about live events (using g_log).
*/
void
gst_event_print_stats (void)
{
g_log (g_log_domain_gstreamer, G_LOG_LEVEL_INFO,
"%d live event(s)", _gst_event_live);
_event_trace = gst_alloc_trace_register (GST_EVENT_TRACE_NAME);
}
static GstEvent*
_gst_event_copy (GstEvent *event)
{
GstEvent *copy;
copy = g_new0(GstEvent, 1);
_gst_event_live++;
gst_alloc_trace_new (_event_trace, copy);
memcpy (copy, event, sizeof (GstEvent));
@ -84,7 +75,8 @@ _gst_event_free (GstEvent* event)
break;
}
_GST_DATA_DISPOSE (GST_DATA (event));
_gst_event_live--;
gst_alloc_trace_free (_event_trace, event);
g_free (event);
}
@ -130,7 +122,8 @@ gst_event_new (GstEventType type)
GstEvent *event;
event = g_new0(GstEvent, 1);
_gst_event_live++;
gst_alloc_trace_new (_event_trace, event);
GST_INFO (GST_CAT_EVENT, "creating new event %p %d", event, type);
_GST_DATA_INIT (GST_DATA (event),

View file

@ -32,25 +32,27 @@
G_BEGIN_DECLS
typedef enum {
GST_EVENT_UNKNOWN,
GST_EVENT_EOS,
GST_EVENT_FLUSH,
GST_EVENT_EMPTY,
GST_EVENT_DISCONTINUOUS,
GST_EVENT_NEW_MEDIA,
GST_EVENT_QOS,
GST_EVENT_SEEK,
GST_EVENT_SEEK_SEGMENT,
GST_EVENT_SEGMENT_DONE,
GST_EVENT_SIZE,
GST_EVENT_RATE,
GST_EVENT_FILLER,
GST_EVENT_TS_OFFSET,
GST_EVENT_INTERRUPT
GST_EVENT_UNKNOWN = 0,
GST_EVENT_EOS = 1,
GST_EVENT_FLUSH = 2,
GST_EVENT_EMPTY = 3,
GST_EVENT_DISCONTINUOUS = 4,
GST_EVENT_NEW_MEDIA = 5,
GST_EVENT_QOS = 6,
GST_EVENT_SEEK = 7,
GST_EVENT_SEEK_SEGMENT = 8,
GST_EVENT_SEGMENT_DONE = 9,
GST_EVENT_SIZE = 10,
GST_EVENT_RATE = 11,
GST_EVENT_FILLER = 12,
GST_EVENT_TS_OFFSET = 13,
GST_EVENT_INTERRUPT = 14
} GstEventType;
extern GType _gst_event_type;
#define GST_EVENT_TRACE_NAME "GstEvent"
#define GST_TYPE_EVENT (_gst_event_type)
#define GST_EVENT(event) ((GstEvent*)(event))
#define GST_IS_EVENT(event) (GST_DATA_TYPE(event) == GST_TYPE_EVENT)
@ -180,8 +182,6 @@ struct _GstEvent {
};
void _gst_event_initialize (void);
void gst_event_print_stats (void);
GstEvent* gst_event_new (GstEventType type);