tracers: fix thread-id casts to 64-bit ints on 32-bit systems

https://bugzilla.gnome.org/show_bug.cgi?id=760762
This commit is contained in:
Tim-Philipp Müller 2016-01-17 23:49:27 +00:00
parent 843d120c2f
commit 8641d7c911
3 changed files with 18 additions and 16 deletions

View file

@ -238,7 +238,7 @@ do_stats (GstTracer * obj, guint64 ts)
update_trace_value (stats->tvs_thread, ts, stats->tthread, &dts, &dtproc);
cur_cpuload = (guint) gst_util_uint64_scale (dtproc,
G_GINT64_CONSTANT (1000), dts);
gst_tracer_record_log (tr_thread, (guint64)thread_id, ts,
gst_tracer_record_log (tr_thread, (guint64) (guintptr) thread_id, ts,
MIN (avg_cpuload, 1000), MIN (cur_cpuload, 1000), stats->tthread);
avg_cpuload = (guint) gst_util_uint64_scale (tproc / num_cpus,

View file

@ -95,7 +95,7 @@ static void
log_new_element_stats (GstElementStats * stats, GstElement * element,
GstClockTime elapsed)
{
gst_tracer_record_log (tr_new_element, (guint64) g_thread_self (),
gst_tracer_record_log (tr_new_element, (guint64) (guintptr) g_thread_self (),
elapsed, stats->index, stats->parent_ix, GST_OBJECT_NAME (element),
G_OBJECT_TYPE_NAME (element), GST_IS_BIN (element));
}
@ -197,7 +197,7 @@ fill_pad_stats (GstStatsTracer * self, GstPad * pad)
static void
log_new_pad_stats (GstPadStats * stats, GstPad * pad)
{
gst_tracer_record_log (tr_new_pad, (guint64) g_thread_self (),
gst_tracer_record_log (tr_new_pad, (guint64) (guintptr) g_thread_self (),
stats->index, stats->parent_ix, GST_OBJECT_NAME (pad),
G_OBJECT_TYPE_NAME (pad), GST_IS_GHOST_PAD (pad),
GST_PAD_DIRECTION (pad));
@ -252,10 +252,11 @@ do_buffer_stats (GstStatsTracer * self, GstPad * this_pad,
GstElement *that_elem = get_real_pad_parent (that_pad);
GstElementStats *that_elem_stats = get_element_stats (self, that_elem);
gst_tracer_record_log (tr_buffer, (guint64) g_thread_self (), elapsed,
this_pad_stats->index, this_elem_stats->index, that_pad_stats->index,
that_elem_stats->index, gst_buffer_get_size (buf), GST_BUFFER_PTS (buf),
GST_BUFFER_DTS (buf), GST_BUFFER_DURATION (buf), GST_BUFFER_FLAGS (buf));
gst_tracer_record_log (tr_buffer, (guint64) (guintptr) g_thread_self (),
elapsed, this_pad_stats->index, this_elem_stats->index,
that_pad_stats->index, that_elem_stats->index, gst_buffer_get_size (buf),
GST_BUFFER_PTS (buf), GST_BUFFER_DTS (buf), GST_BUFFER_DURATION (buf),
GST_BUFFER_FLAGS (buf));
}
static void
@ -269,9 +270,9 @@ do_query_stats (GstStatsTracer * self, GstPad * this_pad,
GstElement *that_elem = get_real_pad_parent (that_pad);
GstElementStats *that_elem_stats = get_element_stats (self, that_elem);
gst_tracer_record_log (tr_query, (guint64) g_thread_self (), elapsed,
this_pad_stats->index, this_elem_stats->index, that_pad_stats->index,
that_elem_stats->index, GST_QUERY_TYPE_NAME (qry),
gst_tracer_record_log (tr_query, (guint64) (guintptr) g_thread_self (),
elapsed, this_pad_stats->index, this_elem_stats->index,
that_pad_stats->index, that_elem_stats->index, GST_QUERY_TYPE_NAME (qry),
gst_query_get_structure (qry), have_res, res);
}
@ -448,7 +449,7 @@ do_push_event_pre (GstStatsTracer * self, guint64 ts, GstPad * pad,
GstPadStats *pad_stats = get_pad_stats (self, pad);
elem_stats->last_ts = ts;
gst_tracer_record_log (tr_event, (guint64) g_thread_self (), ts,
gst_tracer_record_log (tr_event, (guint64) (guintptr) g_thread_self (), ts,
pad_stats->index, elem_stats->index, GST_EVENT_TYPE_NAME (ev));
}
@ -460,7 +461,7 @@ do_post_message_pre (GstStatsTracer * self, guint64 ts, GstElement * elem,
const GstStructure *msg_s = gst_message_get_structure (msg);
stats->last_ts = ts;
gst_tracer_record_log (tr_message, (guint64) g_thread_self (), ts,
gst_tracer_record_log (tr_message, (guint64) (guintptr) g_thread_self (), ts,
stats->index, GST_MESSAGE_TYPE_NAME (msg),
(msg_s ? msg_s : gst_structure_new_empty ("dummy")));
}
@ -481,8 +482,9 @@ do_element_query_pre (GstStatsTracer * self, guint64 ts, GstElement * elem,
GstElementStats *stats = get_element_stats (self, elem);
stats->last_ts = ts;
gst_tracer_record_log (tr_element_query, (guint64) g_thread_self (), ts,
stats->index, GST_QUERY_TYPE_NAME (qry));
gst_tracer_record_log (tr_element_query,
(guint64) (guintptr) g_thread_self (), ts, stats->index,
GST_QUERY_TYPE_NAME (qry));
}
static void

View file

@ -159,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->thread_id = (gpointer) thread_id;
stats->thread_id = (gpointer) (guintptr) thread_id;
stats->parent_ix = parent_ix;
if (pads->len <= ix)
@ -392,7 +392,7 @@ do_thread_rusage_stats (GstStructure * s)
"thread-id", G_TYPE_UINT64, &thread_id,
"average-cpuload", G_TYPE_UINT, &cpuload, "time", G_TYPE_UINT64, &tthread,
NULL);
thread_stats = get_thread_stats ((gpointer) 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);