projects
/
platform
/
upstream
/
gstreamer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tracers: fix thread-id casts to 64-bit ints on 32-bit systems
[platform/upstream/gstreamer.git]
/
tools
/
gst-stats.c
diff --git
a/tools/gst-stats.c
b/tools/gst-stats.c
index
3ee39a5
..
f663a65
100644
(file)
--- a/
tools/gst-stats.c
+++ b/
tools/gst-stats.c
@@
-59,7
+59,7
@@
typedef struct
/* first and last activity on the pad, expected next_ts */
GstClockTime first_ts, last_ts, next_ts;
/* in which thread does it operate */
/* first and last activity on the pad, expected next_ts */
GstClockTime first_ts, last_ts, next_ts;
/* in which thread does it operate */
- g
uint
thread_id;
+ g
pointer
thread_id;
/* hierarchy */
guint parent_ix;
} GstPadStats;
/* hierarchy */
guint parent_ix;
} GstPadStats;
@@
-99,13
+99,15
@@
free_element_stats (gpointer data)
static inline GstElementStats *
get_element_stats (guint ix)
{
static inline GstElementStats *
get_element_stats (guint ix)
{
- return (ix != G_MAXUINT) ? g_ptr_array_index (elements, ix) : NULL;
+ return (ix != G_MAXUINT && ix < elements->len) ?
+ g_ptr_array_index (elements, ix) : NULL;
}
static inline GstPadStats *
get_pad_stats (guint ix)
{
}
static inline GstPadStats *
get_pad_stats (guint ix)
{
- return (ix != G_MAXUINT) ? g_ptr_array_index (pads, ix) : NULL;
+ return (ix != G_MAXUINT && ix < pads->len) ?
+ g_ptr_array_index (pads, ix) : NULL;
}
static void
}
static void
@@
-115,14
+117,14
@@
free_pad_stats (gpointer data)
}
static inline GstThreadStats *
}
static inline GstThreadStats *
-get_thread_stats (g
uint
id)
+get_thread_stats (g
pointer
id)
{
{
- GstThreadStats *stats = g_hash_table_lookup (threads,
GUINT_TO_POINTER (id)
);
+ GstThreadStats *stats = g_hash_table_lookup (threads,
id
);
if (G_UNLIKELY (!stats)) {
stats = g_slice_new0 (GstThreadStats);
stats->tthread = GST_CLOCK_TIME_NONE;
if (G_UNLIKELY (!stats)) {
stats = g_slice_new0 (GstThreadStats);
stats->tthread = GST_CLOCK_TIME_NONE;
- g_hash_table_insert (threads,
GUINT_TO_POINTER (id)
, stats);
+ g_hash_table_insert (threads,
id
, stats);
}
return stats;
}
}
return stats;
}
@@
-135,7
+137,7
@@
new_pad_stats (GstStructure * s)
gchar *type, *name;
gboolean is_ghost_pad;
GstPadDirection dir;
gchar *type, *name;
gboolean is_ghost_pad;
GstPadDirection dir;
- guint thread_id;
+ guint
64
thread_id;
gst_structure_get (s,
"ix", G_TYPE_UINT, &ix,
gst_structure_get (s,
"ix", G_TYPE_UINT, &ix,
@@
-144,7
+146,7
@@
new_pad_stats (GstStructure * s)
"type", G_TYPE_STRING, &type,
"is-ghostpad", G_TYPE_BOOLEAN, &is_ghost_pad,
"pad-direction", GST_TYPE_PAD_DIRECTION, &dir,
"type", G_TYPE_STRING, &type,
"is-ghostpad", G_TYPE_BOOLEAN, &is_ghost_pad,
"pad-direction", GST_TYPE_PAD_DIRECTION, &dir,
- "thread-id", G_TYPE_UINT, &thread_id, NULL);
+ "thread-id", G_TYPE_UINT
64
, &thread_id, NULL);
stats = g_slice_new0 (GstPadStats);
if (is_ghost_pad)
stats = g_slice_new0 (GstPadStats);
if (is_ghost_pad)
@@
-157,7
+159,7
@@
new_pad_stats (GstStructure * s)
stats->dir = dir;
stats->min_size = G_MAXUINT;
stats->first_ts = stats->last_ts = stats->next_ts = GST_CLOCK_TIME_NONE;
stats->dir = dir;
stats->min_size = G_MAXUINT;
stats->first_ts = stats->last_ts = stats->next_ts = GST_CLOCK_TIME_NONE;
- stats->thread_id = thread_id;
+ stats->thread_id =
(gpointer) (guintptr)
thread_id;
stats->parent_ix = parent_ix;
if (pads->len <= ix)
stats->parent_ix = parent_ix;
if (pads->len <= ix)
@@
-288,7
+290,7
@@
do_buffer_stats (GstStructure * s)
num_buffers++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
"pad-ix", G_TYPE_UINT, &pad_ix,
num_buffers++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
"pad-ix", G_TYPE_UINT, &pad_ix,
- "elem-ix", G_TYPE_UINT, &elem_ix,
+ "elem
ent
-ix", G_TYPE_UINT, &elem_ix,
"peer-elem-ix", G_TYPE_UINT, &peer_elem_ix,
"buffer-size", G_TYPE_UINT, &size,
"buffer-pts", G_TYPE_UINT64, &buffer_pts,
"peer-elem-ix", G_TYPE_UINT, &peer_elem_ix,
"buffer-size", G_TYPE_UINT, &size,
"buffer-pts", G_TYPE_UINT64, &buffer_pts,
@@
-328,7
+330,8
@@
do_event_stats (GstStructure * s)
num_events++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
num_events++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
- "pad-ix", G_TYPE_UINT, &pad_ix, "elem-ix", G_TYPE_UINT, &elem_ix, NULL);
+ "pad-ix", G_TYPE_UINT, &pad_ix, "element-ix", G_TYPE_UINT, &elem_ix,
+ NULL);
last_ts = MAX (last_ts, ts);
if (!(pad_stats = get_pad_stats (pad_ix))) {
GST_WARNING ("no pad stats found for ix=%u", pad_ix);
last_ts = MAX (last_ts, ts);
if (!(pad_stats = get_pad_stats (pad_ix))) {
GST_WARNING ("no pad stats found for ix=%u", pad_ix);
@@
-351,7
+354,7
@@
do_message_stats (GstStructure * s)
num_messages++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
num_messages++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
- "elem-ix", G_TYPE_UINT, &elem_ix, NULL);
+ "elem
ent
-ix", G_TYPE_UINT, &elem_ix, NULL);
last_ts = MAX (last_ts, ts);
if (!(elem_stats = get_element_stats (elem_ix))) {
GST_WARNING ("no element stats found for ix=%u", elem_ix);
last_ts = MAX (last_ts, ts);
if (!(elem_stats = get_element_stats (elem_ix))) {
GST_WARNING ("no element stats found for ix=%u", elem_ix);
@@
-369,7
+372,7
@@
do_query_stats (GstStructure * s)
num_queries++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
num_queries++;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
- "elem-ix", G_TYPE_UINT, &elem_ix, NULL);
+ "elem
ent
-ix", G_TYPE_UINT, &elem_ix, NULL);
last_ts = MAX (last_ts, ts);
if (!(elem_stats = get_element_stats (elem_ix))) {
GST_WARNING ("no element stats found for ix=%u", elem_ix);
last_ts = MAX (last_ts, ts);
if (!(elem_stats = get_element_stats (elem_ix))) {
GST_WARNING ("no element stats found for ix=%u", elem_ix);
@@
-381,15
+384,15
@@
do_query_stats (GstStructure * s)
static void
do_thread_rusage_stats (GstStructure * s)
{
static void
do_thread_rusage_stats (GstStructure * s)
{
- guint64 ts, tthread;
- guint
thread_id,
cpuload;
+ guint64 ts, tthread
, thread_id
;
+ guint cpuload;
GstThreadStats *thread_stats;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
GstThreadStats *thread_stats;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
- "thread-id", G_TYPE_UINT, &thread_id,
+ "thread-id", G_TYPE_UINT
64
, &thread_id,
"average-cpuload", G_TYPE_UINT, &cpuload, "time", G_TYPE_UINT64, &tthread,
NULL);
"average-cpuload", G_TYPE_UINT, &cpuload, "time", G_TYPE_UINT64, &tthread,
NULL);
- thread_stats = get_thread_stats (thread_id);
+ thread_stats = get_thread_stats (
(gpointer) (guintptr)
thread_id);
thread_stats->cpuload = cpuload;
thread_stats->tthread = tthread;
last_ts = MAX (last_ts, ts);
thread_stats->cpuload = cpuload;
thread_stats->tthread = tthread;
last_ts = MAX (last_ts, ts);
@@
-413,8
+416,7
@@
find_pad_stats_for_thread (gconstpointer value, gconstpointer user_data)
{
const GstPadStats *stats = (const GstPadStats *) value;
{
const GstPadStats *stats = (const GstPadStats *) value;
- if ((stats->thread_id == GPOINTER_TO_UINT (user_data)) &&
- (stats->num_buffers)) {
+ if ((stats->thread_id == user_data) && (stats->num_buffers)) {
return 0;
}
return 1;
return 0;
}
return 1;
@@
-425,7
+427,7
@@
print_pad_stats (gpointer value, gpointer user_data)
{
GstPadStats *stats = (GstPadStats *) value;
{
GstPadStats *stats = (GstPadStats *) value;
- if (stats->thread_id ==
GPOINTER_TO_UINT (user_data)
) {
+ if (stats->thread_id ==
user_data
) {
/* there seem to be some temporary pads */
if (stats->num_buffers) {
GstClockTimeDiff running =
/* there seem to be some temporary pads */
if (stats->num_buffers) {
GstClockTimeDiff running =
@@
-634,7
+636,7
@@
init (void)
/* 5: category */
"([a-zA-Z_-]+) +"
/* 6: file:line:func: */
/* 5: category */
"([a-zA-Z_-]+) +"
/* 6: file:line:func: */
- "([^:]
+:[0-9]+:[^:]+:)
"
+ "([^:]
*:[0-9]+:[^:]*:) +
"
/* 7: (obj)? log-text */
"(.*)$", 0, 0, NULL);
if (!raw_log) {
/* 7: (obj)? log-text */
"(.*)$", 0, 0, NULL);
if (!raw_log) {
@@
-654,7
+656,7
@@
init (void)
/* 5: category */
"\\\e\\\[[0-9;]+m +([a-zA-Z_-]+) +"
/* 6: file:line:func: */
/* 5: category */
"\\\e\\\[[0-9;]+m +([a-zA-Z_-]+) +"
/* 6: file:line:func: */
- "([^:]
+:[0-9]+:[^:]+:)(?:\\\e\\\[00m)?
"
+ "([^:]
*:[0-9]+:[^:]*:)(?:\\\e\\\[00m)? +
"
/* 7: (obj)? log-text */
"(.*)$", 0, 0, NULL);
if (!raw_log) {
/* 7: (obj)? log-text */
"(.*)$", 0, 0, NULL);
if (!raw_log) {
@@
-836,10
+838,10
@@
collect_stats (const gchar * filename)
}
}
}
}
}
}
- fclose (log);
} else {
GST_WARNING ("empty log");
}
} else {
GST_WARNING ("empty log");
}
+ fclose (log);
}
}
}
}