[ltt-dev] [PATCH] lttv: fix compilation warning
Jan Blunck
jblunck at suse.de
Fri Dec 12 14:11:25 EST 2008
Hi Mathieu,
here is a bunch of fixes to let lttv actually build in the openSUSE Build
Service (http://build.opensuse.org). Sorry for this is being a combined patch
but it is only fixing compilation warnings and such breakage. I didn't care
about unused functions and variable warning. The code is quite messy wrt that.
Regards,
Jan
Signed-off-by: Jan Blunck <jblunck at suse.de>
---
ltt/event.c | 8 +-
ltt/event.h | 4 -
ltt/tracefile.c | 55 ++++++++------
lttv/lttv/attribute.c | 26 +++---
lttv/lttv/batchtest.c | 13 +--
lttv/lttv/filter.c | 2
lttv/lttv/print.c | 16 ++--
lttv/lttv/state.c | 20 ++---
lttv/lttv/stats.c | 3
lttv/lttv/tracecontext.c | 3
lttv/modules/gui/controlflow/drawing.c | 4 -
lttv/modules/gui/controlflow/eventhooks.c | 3
lttv/modules/gui/controlflow/lttv_plugin_cfv.c | 1
lttv/modules/gui/controlflow/processlist.c | 6 -
lttv/modules/gui/detailedevents/events.c | 6 +
lttv/modules/gui/histogram/histobuttonwidget.c | 18 ++--
lttv/modules/gui/histogram/histodrawing.c | 11 ++
lttv/modules/gui/histogram/histoeventhooks.c | 8 +-
lttv/modules/gui/interrupts/interrupts.c | 6 -
lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c | 16 ++--
lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c | 4 -
lttv/modules/gui/resourceview/cfv.h | 2
lttv/modules/gui/resourceview/drawing.c | 7 +
lttv/modules/gui/resourceview/eventhooks.c | 11 ++
lttv/modules/gui/resourceview/lttv_plugin_cfv.c | 1
lttv/modules/gui/resourceview/processlist.c | 6 -
lttv/modules/gui/resourceview/processlist.h | 6 +
lttv/modules/text/textDump.c | 11 +-
lttv/modules/text/textFilter.c | 2
29 files changed, 165 insertions(+), 114 deletions(-)
Index: b/ltt/event.c
===================================================================
--- a/ltt/event.c
+++ b/ltt/event.c
@@ -175,7 +175,7 @@ guint32 ltt_event_get_unsigned(LttEvent
break;
case 8:
default:
- g_critical("ltt_event_get_unsigned : field size %i unknown", f->size);
+ g_critical("ltt_event_get_unsigned : field size %li unknown", f->size);
return 0;
break;
}
@@ -205,7 +205,7 @@ gint32 ltt_event_get_int(LttEvent *e, st
break;
case 8:
default:
- g_critical("ltt_event_get_int : field size %i unknown", f->size);
+ g_critical("ltt_event_get_int : field size %li unknown", f->size);
return 0;
break;
}
@@ -237,7 +237,7 @@ guint64 ltt_event_get_long_unsigned(LttE
return ltt_get_uint64(reverse_byte_order, e->data + f->offset);
break;
default:
- g_critical("ltt_event_get_long_unsigned : field size %i unknown", f->size);
+ g_critical("ltt_event_get_long_unsigned : field size %li unknown", f->size);
return 0;
break;
}
@@ -269,7 +269,7 @@ gint64 ltt_event_get_long_int(LttEvent *
return ltt_get_int64(reverse_byte_order, e->data + f->offset);
break;
default:
- g_critical("ltt_event_get_long_int : field size %i unknown", f->size);
+ g_critical("ltt_event_get_long_int : field size %li unknown", f->size);
return 0;
break;
}
Index: b/ltt/event.h
===================================================================
--- a/ltt/event.h
+++ b/ltt/event.h
@@ -47,12 +47,12 @@ struct LttEventPosition {
uint64_t tsc; /* Current timestamp counter */
};
-static inline guint16 ltt_event_id(struct LttEvent *event)
+static inline guint16 ltt_event_id(const struct LttEvent *event)
{
return event->event_id;
}
-static inline LttTime ltt_event_time(struct LttEvent *event)
+static inline LttTime ltt_event_time(const struct LttEvent *event)
{
return event->event_time;
}
Index: b/ltt/tracefile.c
===================================================================
--- a/ltt/tracefile.c
+++ b/ltt/tracefile.c
@@ -32,9 +32,12 @@
#include <unistd.h>
#include <math.h>
#include <glib.h>
+#include <glib/gprintf.h>
#include <malloc.h>
#include <sys/mman.h>
#include <string.h>
+#include <ctype.h>
+#include <inttypes.h>
// For realpath
#include <limits.h>
@@ -48,6 +51,9 @@
#include <ltt/ltt-types.h>
#include <ltt/marker.h>
+/* from marker.c */
+extern long marker_update_fields_offsets(struct marker_info *info, const char *data);
+
/* Tracefile names used in this file */
GQuark LTT_TRACEFILE_NAME_METADATA;
@@ -270,7 +276,7 @@ static gint ltt_tracefile_open(LttTrace
if(munmap(tf->buffer.head,
PAGE_ALIGN(ltt_subbuffer_header_size()))) {
- g_warning("unmap size : %u\n",
+ g_warning("unmap size : %zu\n",
PAGE_ALIGN(ltt_subbuffer_header_size()));
perror("munmap error");
g_assert(0);
@@ -289,7 +295,7 @@ static gint ltt_tracefile_open(LttTrace
unmap_file:
if(munmap(tf->buffer.head,
PAGE_ALIGN(ltt_subbuffer_header_size()))) {
- g_warning("unmap size : %u\n",
+ g_warning("unmap size : %zu\n",
PAGE_ALIGN(ltt_subbuffer_header_size()));
perror("munmap error");
g_assert(0);
@@ -361,7 +367,7 @@ static int get_tracefile_name_number(gch
{
guint raw_name_len = strlen(raw_name);
gchar char_name[PATH_MAX];
- int i;
+ unsigned int i;
int underscore_pos;
long int cpu_num;
gchar *endptr;
@@ -459,7 +465,7 @@ void compute_tracefile_group(GQuark key_
GArray *group,
struct compute_tracefile_group_args *args)
{
- int i;
+ unsigned int i;
LttTracefile *tf;
for(i=0; i<group->len; i++) {
@@ -473,7 +479,7 @@ void compute_tracefile_group(GQuark key_
static void ltt_tracefile_group_destroy(gpointer data)
{
GArray *group = (GArray *)data;
- int i;
+ unsigned int i;
LttTracefile *tf;
for(i=0; i<group->len; i++) {
@@ -484,10 +490,10 @@ static void ltt_tracefile_group_destroy(
g_array_free(group, TRUE);
}
-static gboolean ltt_tracefile_group_has_cpu_online(gpointer data)
+static __attribute__ ((__unused__)) gboolean ltt_tracefile_group_has_cpu_online(gpointer data)
{
GArray *group = (GArray *)data;
- int i;
+ unsigned int i;
LttTracefile *tf;
for(i=0; i<group->len; i++) {
@@ -624,7 +630,6 @@ static int open_tracefiles(LttTrace *tra
static int ltt_process_metadata_tracefile(LttTracefile *tf)
{
int err;
- guint i;
while(1) {
err = ltt_tracefile_read_seek(tf);
@@ -719,7 +724,8 @@ LttTrace *ltt_trace_open(const gchar *pa
LttTrace * t;
LttTracefile *tf;
GArray *group;
- int i, ret;
+ unsigned int i;
+ int ret;
ltt_subbuffer_header_t *header;
DIR *dir;
struct dirent *entry;
@@ -874,7 +880,7 @@ static void group_time_span_get(GQuark n
(struct tracefile_time_span_get_args*)user_data;
GArray *group = (GArray *)data;
- int i;
+ unsigned int i;
LttTracefile *tf;
LttTime tmp_start;
LttTime tmp_end;
@@ -1197,10 +1203,10 @@ static void print_debug_event_header(Ltt
unsigned int offset = 0;
int i, j;
- g_printf("Event header (tracefile %s offset %llx):\n",
+ g_printf("Event header (tracefile %s offset %" PRIx64 "):\n",
g_quark_to_string(ev->tracefile->long_name),
- ((uint64_t)ev->tracefile->buffer.index * ev->tracefile->buf_size)
- + (long)start_pos - (long)ev->tracefile->buffer.head);
+ ((uint64_t)ev->tracefile->buffer.index * ev->tracefile->buf_size)
+ + (long)start_pos - (long)ev->tracefile->buffer.head);
while (offset < (long)end_pos - (long)start_pos) {
g_printf("%8lx", (long)start_pos - (long)ev->tracefile->buffer.head + offset);
@@ -1416,10 +1422,10 @@ static void print_debug_event_data(LttEv
if (!max(ev->event_size, ev->data_size))
return;
- g_printf("Event data (tracefile %s offset %llx):\n",
- g_quark_to_string(ev->tracefile->long_name),
- ((uint64_t)ev->tracefile->buffer.index * ev->tracefile->buf_size)
- + (long)ev->data - (long)ev->tracefile->buffer.head);
+ g_printf("Event data (tracefile %s offset %" PRIx64 "):\n",
+ g_quark_to_string(ev->tracefile->long_name),
+ ((uint64_t)ev->tracefile->buffer.index * ev->tracefile->buf_size)
+ + (long)ev->data - (long)ev->tracefile->buffer.head);
while (offset < max(ev->event_size, ev->data_size)) {
g_printf("%8lx", (long)ev->data + offset
@@ -1460,9 +1466,8 @@ static void print_debug_event_data(LttEv
void ltt_update_event_size(LttTracefile *tf)
{
off_t size = 0;
- char *tscdata;
struct marker_info *info;
-
+
switch((enum marker_id)tf->event.event_id) {
case MARKER_ID_SET_MARKER_ID:
size = strlen((char*)tf->event.data) + 1;
@@ -1480,6 +1485,9 @@ void ltt_update_event_size(LttTracefile
size = strlen((char*)tf->event.data) + 1;
size += strlen((char*)tf->event.data + size) + 1;
break;
+ case MARKER_ID_DYNAMIC:
+ /* Do nothing */
+ break;
}
info = marker_get_info_from_id(tf->trace, tf->event.event_id);
@@ -1522,6 +1530,9 @@ void ltt_update_event_size(LttTracefile
if (tf->name != g_quark_from_string("/control/metadata"))
g_error("Trace inconsistency : metadata event found in data "
"tracefile %s", g_quark_to_string(tf->long_name));
+ case MARKER_ID_DYNAMIC:
+ /* Do nothing */
+ break;
}
if (tf->event.data_size != tf->event.event_size) {
@@ -2510,7 +2521,7 @@ LttTime ltt_trace_start_time_monotonic(L
return t->start_time_from_tsc;
}
-static LttTracefile *ltt_tracefile_new()
+static __attribute__ ((__unused__)) LttTracefile *ltt_tracefile_new()
{
LttTracefile *tf;
tf = g_new(LttTracefile, 1);
@@ -2518,12 +2529,12 @@ static LttTracefile *ltt_tracefile_new()
return tf;
}
-static void ltt_tracefile_destroy(LttTracefile *tf)
+static __attribute__ ((__unused__)) void ltt_tracefile_destroy(LttTracefile *tf)
{
g_free(tf);
}
-static void ltt_tracefile_copy(LttTracefile *dest, const LttTracefile *src)
+static __attribute__ ((__unused__)) void ltt_tracefile_copy(LttTracefile *dest, const LttTracefile *src)
{
*dest = *src;
}
Index: b/lttv/lttv/attribute.c
===================================================================
--- a/lttv/lttv/attribute.c
+++ b/lttv/lttv/attribute.c
@@ -142,11 +142,11 @@ LttvAttributeValue
lttv_attribute_add(LttvAttribute *self, LttvAttributeName name,
LttvAttributeType t)
{
- unsigned i;
+ unsigned int i;
Attribute a, *pa;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(i != 0) g_error("duplicate entry in attribute table");
a.name = name;
@@ -165,11 +165,11 @@ LttvAttributeValue
lttv_attribute_add_unnamed(LttvAttribute *self, LttvAttributeName name,
LttvAttributeType t)
{
- unsigned i;
+ unsigned int i;
Attribute a, *pa;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(i != 0) g_error("duplicate entry in attribute table");
a.name = name;
@@ -215,9 +215,9 @@ lttv_attribute_remove(LttvAttribute *sel
void
lttv_attribute_remove_by_name(LttvAttribute *self, LttvAttributeName name)
{
- unsigned i;
+ unsigned int i;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(unlikely(i == 0)) g_error("remove by name non existent attribute");
lttv_attribute_remove(self, i - 1);
@@ -231,13 +231,13 @@ lttv_attribute_remove_by_name(LttvAttrib
/*CHECK*/LttvAttribute*
lttv_attribute_find_subdir(LttvAttribute *self, LttvAttributeName name)
{
- unsigned i;
+ unsigned int i;
Attribute a;
LttvAttribute *new;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(likely(i != 0)) {
a = g_array_index(self->attributes, Attribute, i - 1);
if(likely(a.type == LTTV_GOBJECT && LTTV_IS_IATTRIBUTE(a.value.dv_gobject))) {
@@ -253,13 +253,13 @@ lttv_attribute_find_subdir(LttvAttribute
/*CHECK*/LttvAttribute*
lttv_attribute_find_subdir_unnamed(LttvAttribute *self, LttvAttributeName name)
{
- unsigned i;
+ unsigned int i;
Attribute a;
LttvAttribute *new;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(likely(i != 0)) {
a = g_array_index(self->attributes, Attribute, i - 1);
if(likely(a.type == LTTV_GOBJECT && LTTV_IS_IATTRIBUTE(a.value.dv_gobject))) {
@@ -277,11 +277,11 @@ gboolean
lttv_attribute_find(LttvAttribute *self, LttvAttributeName name,
LttvAttributeType t, LttvAttributeValue *v)
{
- unsigned i;
+ unsigned int i;
Attribute *a;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(likely(i != 0)) {
a = &g_array_index(self->attributes, Attribute, i - 1);
if(unlikely(a->type != t)) return FALSE;
@@ -301,7 +301,7 @@ lttv_attribute_find_unnamed(LttvAttribut
Attribute *a;
- i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+ i = GPOINTER_TO_UINT(g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)));
if(likely(i != 0)) {
a = &g_array_index(self->attributes, Attribute, i - 1);
if(unlikely(a->type != t)) return FALSE;
Index: b/lttv/lttv/batchtest.c
===================================================================
--- a/lttv/lttv/batchtest.c
+++ b/lttv/lttv/batchtest.c
@@ -25,6 +25,7 @@
#endif
#include <string.h>
+#include <inttypes.h>
#include <lttv/lttv.h>
#include <lttv/attribute.h>
#include <lttv/hook.h>
@@ -170,11 +171,11 @@ gboolean trace_event(void __UNUSED__ *ho
LttEvent *e = ltt_tracefile_get_event(tfs->parent.tf);
ltt_event_position(e, a_event_position);
ltt_event_position_get(a_event_position, &tf, &nb_block, &offset, &tsc);
- fprintf(stderr,"Event %s %lu.%09lu [%u 0x%x tsc %llu]\n",
- g_quark_to_string(marker_get_info_from_id(ltt_tracefile_get_trace(tf),
- ltt_event_id(e))->name),
- tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec,
- nb_block, offset, tsc);
+ fprintf(stderr,"Event %s %lu.%09lu [%u 0x%x tsc %" PRIu64 "]\n",
+ g_quark_to_string(marker_get_info_from_id(ltt_tracefile_get_trace(tf),
+ ltt_event_id(e))->name),
+ tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec,
+ nb_block, offset, tsc);
return FALSE;
}
@@ -336,7 +337,7 @@ static void compute_tracefile(LttTracefi
ltt_event_position(event, a_event_position);
ltt_event_position_get(a_event_position, &tf_pos, &nb_block, &offset, &tsc);
//fprintf(fp,"%s.%s: %llu %lu.%09lu position %u/%u\n",
- fprintf(fp, "%s: %llu %lu.%09lu position %u/%u, tracefile %s\n",
+ fprintf(fp, "%s: %" PRIu64 " %lu.%09lu position %u/%u, tracefile %s\n",
g_quark_to_string(minfo->name),
tsc, (unsigned long)time.tv_sec,
(unsigned long)time.tv_nsec,
Index: b/lttv/lttv/filter.c
===================================================================
--- a/lttv/lttv/filter.c
+++ b/lttv/lttv/filter.c
@@ -1891,7 +1891,7 @@ lttv_filter_tree_parse(
gboolean lresult = FALSE, rresult = FALSE;
- LttvTraceState *ts;
+ LttvTraceState *ts = NULL;
LttvTracefileState *tfs = (LttvTracefileState*)context;
if(tc)
ts = (LttvTraceState*)tc;
Index: b/lttv/lttv/print.c
===================================================================
--- a/lttv/lttv/print.c
+++ b/lttv/lttv/print.c
@@ -42,6 +42,7 @@
#include <ctype.h>
#include <ltt/ltt-private.h>
#include <string.h>
+#include <inttypes.h>
static inline void print_enum_events(LttEvent *e, struct marker_field *f,
guint64 value, GString *s, LttvTracefileState *tfs)
@@ -140,7 +141,7 @@ void lttv_print_field(LttEvent *e, struc
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "0x%llx", ltt_event_get_long_unsigned(e,f));
+ g_string_append_printf(s, "0x%" PRIx64, ltt_event_get_long_unsigned(e,f));
//g_string_append_printf(s, type->fmt, ltt_event_get_long_unsigned(e,f));
break;
@@ -272,12 +273,13 @@ void lttv_event_to_string(LttEvent *e, G
g_quark_to_string(ltt_tracefile_name(tfs->parent.tf)),
cpu);
/* Print the process id and the state/interrupt type of the process */
- g_string_append_printf(s,", %u, %u, %s, %s, %u, 0x%llX, %s", process->pid,
- process->tgid,
- g_quark_to_string(process->name),
- g_quark_to_string(process->brand),
- process->ppid, process->current_function,
- g_quark_to_string(process->state->t));
+ g_string_append_printf(s,", %u, %u, %s, %s, %u, 0x%" PRIx64", %s",
+ process->pid,
+ process->tgid,
+ g_quark_to_string(process->name),
+ g_quark_to_string(process->brand),
+ process->ppid, process->current_function,
+ g_quark_to_string(process->state->t));
}
if(marker_get_num_fields(info) == 0) return;
Index: b/lttv/lttv/state.c
===================================================================
--- a/lttv/lttv/state.c
+++ b/lttv/lttv/state.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <string.h>
#include <ltt/ltt-private.h>
+#include <inttypes.h>
/* Comment :
* Mathieu Desnoyers
@@ -637,12 +638,12 @@ init(LttvTracesetState *self, LttvTraces
/* It's a Usertrace */
guint tid = ltt_tracefile_tid(tfcs->parent.tf);
GTree *usertrace_tree = (GTree*)g_hash_table_lookup(tcs->usertraces,
- (gconstpointer)tid);
+ GUINT_TO_POINTER(tid));
if(!usertrace_tree) {
usertrace_tree = g_tree_new_full(compare_usertraces,
NULL, free_usertrace_key, NULL);
g_hash_table_insert(tcs->usertraces,
- (gpointer)tid, usertrace_tree);
+ GUINT_TO_POINTER(tid), usertrace_tree);
}
LttTime *timestamp = g_new(LttTime, 1);
*timestamp = ltt_interpolate_time_from_tsc(tfcs->parent.tf,
@@ -752,7 +753,7 @@ static void write_process_state(gpointer
for(i = 0 ; i < process->user_stack->len; i++) {
address = g_array_index(process->user_stack, guint64, i);
- fprintf(fp, " <USER_STACK ADDRESS=\"%llu\"/>\n",
+ fprintf(fp, " <USER_STACK ADDRESS=\"%" PRIu64 "\"/>\n",
address);
}
@@ -806,7 +807,7 @@ void lttv_state_write(LttvTraceState *se
else {
ltt_event_position(e, ep);
ltt_event_position_get(ep, &tf, &nb_block, &offset, &tsc);
- fprintf(fp, " BLOCK=%u OFFSET=%u TSC=%llu/>\n", nb_block, offset,
+ fprintf(fp, " BLOCK=%u OFFSET=%u TSC=%" PRIu64 "/>\n", nb_block, offset,
tsc);
}
}
@@ -1527,7 +1528,7 @@ static void state_save(LttvTraceState *s
guint64 tsc;
LttTracefile *tf;
ltt_event_position_get(ep, &tf, &nb_block, &offset, &tsc);
- g_info("Block %u offset %u tsc %llu time %lu.%lu", nb_block, offset,
+ g_info("Block %u offset %u tsc %" PRIu64 " time %lu.%lu", nb_block, offset,
tsc,
tfcs->parent.timestamp.tv_sec, tfcs->parent.timestamp.tv_nsec);
}
@@ -2233,7 +2234,8 @@ static LttvTracefileState *ltt_state_use
* timestamp the lowest, but higher or equal to "timestamp". */
res.time = timestamp;
res.best = NULL;
- GTree *usertrace_tree = g_hash_table_lookup(tcs->usertraces, (gpointer)pid);
+ GTree *usertrace_tree = g_hash_table_lookup(tcs->usertraces,
+ GUINT_TO_POINTER(pid));
if(usertrace_tree) {
g_tree_search(usertrace_tree, search_usertrace, &res);
if(res.best)
@@ -2562,7 +2564,7 @@ static gboolean soft_irq_raise(void *hoo
} else {
/* Fixup an incomplete irq table */
GString *string = g_string_new("");
- g_string_printf(string, "softirq %llu", softirq);
+ g_string_printf(string, "softirq %" PRIu64, softirq);
submode = g_quark_from_string(string->str);
g_string_free(string, TRUE);
}
@@ -2699,7 +2701,7 @@ static void pop_function(LttvTracefileSt
if(process->current_function != funcptr){
g_info("Different functions (%lu.%09lu): ignore it\n",
tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec);
- g_info("process state has %llu when pop_function is %llu\n",
+ g_info("process state has %" PRIu64 " when pop_function is %" PRIu64 "\n",
process->current_function, funcptr);
g_info("{ %u, %u, %s, %s, %s }\n",
process->pid,
@@ -3946,7 +3948,7 @@ void lttv_state_traceset_seek_time_close
gboolean is_named;
- LttvAttribute *saved_states_tree, *saved_state_tree, *closest_tree;
+ LttvAttribute *saved_states_tree, *saved_state_tree, *closest_tree = NULL;
//g_tree_destroy(self->parent.pqueue);
//self->parent.pqueue = g_tree_new(compare_tracefile);
Index: b/lttv/lttv/stats.c
===================================================================
--- a/lttv/lttv/stats.c
+++ b/lttv/lttv/stats.c
@@ -21,6 +21,7 @@
#endif
#include <stdio.h>
+#include <inttypes.h>
#include <lttv/module.h>
#include <lttv/stats.h>
#include <lttv/lttv.h>
@@ -398,7 +399,7 @@ find_event_tree(LttvTracefileStats *tfcs
gint ret;
ret = snprintf(fstring, MAX_64_HEX_STRING_LEN-1,
- "0x%llX", function) > 0;
+ "0x%" PRIX64, function) > 0;
g_assert(ret > 0);
fstring[MAX_64_HEX_STRING_LEN-1] = '\0';
Index: b/lttv/lttv/tracecontext.c
===================================================================
--- a/lttv/lttv/tracecontext.c
+++ b/lttv/lttv/tracecontext.c
@@ -28,8 +28,9 @@
#include <lttv/filter.h>
#include <errno.h>
+#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
-
+#endif
gint compare_tracefile(gconstpointer a, gconstpointer b)
{
Index: b/lttv/modules/gui/controlflow/drawing.c
===================================================================
--- a/lttv/modules/gui/controlflow/drawing.c
+++ b/lttv/modules/gui/controlflow/drawing.c
@@ -430,7 +430,7 @@ static void set_last_start(gpointer key,
{
ProcessInfo *process_info = (ProcessInfo*)key;
HashedProcessData *hashed_process_data = (HashedProcessData*)value;
- guint x = (guint)user_data;
+ guint x = GPOINTER_TO_UINT(user_data);
hashed_process_data->x.over = x;
hashed_process_data->x.over_used = FALSE;
@@ -466,7 +466,7 @@ void drawing_data_request_begin(EventsRe
&x);
g_hash_table_foreach(cfd->process_list->process_hash, set_last_start,
- (gpointer)x);
+ GUINT_TO_POINTER(x));
}
Index: b/lttv/modules/gui/controlflow/eventhooks.c
===================================================================
--- a/lttv/modules/gui/controlflow/eventhooks.c
+++ b/lttv/modules/gui/controlflow/eventhooks.c
@@ -2590,7 +2590,8 @@ int after_chunk(void *hook_data, void *c
guint nb_trace = lttv_traceset_number(traceset);
/* Only execute when called for the first trace's events request */
- if(!process_list->current_hash_data) return;
+ if(!process_list->current_hash_data)
+ return 0;
for(i = 0 ; i < nb_trace ; i++) {
g_free(process_list->current_hash_data[i]);
Index: b/lttv/modules/gui/controlflow/lttv_plugin_cfv.c
===================================================================
--- a/lttv/modules/gui/controlflow/lttv_plugin_cfv.c
+++ b/lttv/modules/gui/controlflow/lttv_plugin_cfv.c
@@ -20,6 +20,7 @@
#include "lttv_plugin_cfv.h"
#include <lttvwindow/lttvwindow.h>
#include "drawing.h"
+#include "eventhooks.h"
/*
* forward definitions
Index: b/lttv/modules/gui/controlflow/processlist.c
===================================================================
--- a/lttv/modules/gui/controlflow/processlist.c
+++ b/lttv/modules/gui/controlflow/processlist.c
@@ -215,9 +215,9 @@ static void update_pixmap_size_each(Proc
void update_pixmap_size(ProcessList *process_list, guint width)
{
- g_hash_table_foreach(process_list->process_hash,
- (GHFunc)update_pixmap_size_each,
- (gpointer)width);
+ g_hash_table_foreach(process_list->process_hash,
+ (GHFunc)update_pixmap_size_each,
+ GUINT_TO_POINTER(width));
}
Index: b/lttv/modules/gui/detailedevents/events.c
===================================================================
--- a/lttv/modules/gui/detailedevents/events.c
+++ b/lttv/modules/gui/detailedevents/events.c
@@ -55,6 +55,7 @@
#include <ltt/ltt.h>
#include <ltt/event.h>
#include <ltt/trace.h>
+#include <lttv/lttv.h>
#include <lttv/module.h>
#include <lttv/hook.h>
#include <lttv/tracecontext.h>
@@ -1226,7 +1227,7 @@ void tree_v_size_allocate_cb (GtkWidget
g_debug("size allocate %p : last_num_visible_events : %d",
event_viewer_data, last_num_visible_events);
- g_debug("num_visible_events : %d, value %lu",
+ g_debug("num_visible_events : %d, value %f",
event_viewer_data->num_visible_events,
event_viewer_data->vadjust_c->value);
@@ -1360,6 +1361,7 @@ static void get_events(double new_value,
break;
case SCROLL_JUMP:
g_debug("get_events : SCROLL_JUMP");
+ relative_position = 0;
seek_by_time = 1;
break;
case SCROLL_NONE:
@@ -1416,7 +1418,7 @@ static void get_events(double new_value,
*/
if(relative_position > 0) {
guint count;
- count += lttv_process_traceset_seek_n_forward(tsc, relative_position,
+ count = lttv_process_traceset_seek_n_forward(tsc, relative_position,
events_check_handler,
&event_viewer_data->tab->stop_foreground,
event_viewer_data->main_win_filter,
Index: b/lttv/modules/gui/histogram/histobuttonwidget.c
===================================================================
--- a/lttv/modules/gui/histogram/histobuttonwidget.c
+++ b/lttv/modules/gui/histogram/histobuttonwidget.c
@@ -29,12 +29,16 @@
#include "histobuttonwidget.h"
#include "histodrawing.h"
#include "histodrawitem.h"
-#include "stock_zoom_in_24.xpm"
-#include "stock_zoom_out_24.xpm"
-#include "stock_zoom_fit_24.xpm"
+extern void histogram_show(HistoControlFlowData *histocontrol_flow_data,
+ guint draw_begin, guint draw_end);
+
+#ifndef g_info
#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#endif
+#ifndef g_debug
#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+#endif
/* Preallocated Size of the index_to_pixmap array */
#define ALLOCATE_PROCESSES 1000
@@ -113,7 +117,7 @@ static GtkWidget *xpm_label_box( gchar*
/* Now on to the image stuff */
- pixbufP = gdk_pixbuf_new_from_xpm_data((const char*)xpm_filename);
+ pixbufP = gdk_pixbuf_new_from_xpm_data((const char **)&xpm_filename);
image = gtk_image_new_from_pixbuf(pixbufP);
/* Create a label for the button */
@@ -148,9 +152,9 @@ ButtonWidget *histo_buttonwidget_constru
buttonwidget ->buttonFit =gtk_button_new ();
/* This calls our box creating function */
- boxPlus = xpm_label_box (stock_zoom_in_24, "vertical");
- boxMinus = xpm_label_box (stock_zoom_out_24, "vertical");
- boxfit = xpm_label_box (stock_zoom_fit_24, "vertical");
+ boxPlus = xpm_label_box ("stock_zoom_in_24.xpm", "vertical");
+ boxMinus = xpm_label_box ("stock_zoom_out_24.xpm", "vertical");
+ boxfit = xpm_label_box ("stock_zoom_fit_24.xpm", "vertical");
/* Pack and show all widgets */
gtk_widget_show (boxPlus);
Index: b/lttv/modules/gui/histogram/histodrawing.c
===================================================================
--- a/lttv/modules/gui/histogram/histodrawing.c
+++ b/lttv/modules/gui/histogram/histodrawing.c
@@ -36,8 +36,12 @@
#include "histoeventhooks.h"
#include "histocfv.h"
+#ifndef g_info
#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#endif
+#ifndef g_debug
#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+#endif
//FIXME
// fixed #define TRACE_NUMBER 0
@@ -168,7 +172,7 @@ void histo_drawing_request_expose(Events
HistoControlFlowData *cfd = events_request->viewer_data;
histoDrawing_t *drawing = cfd->drawing;
- gint x, x_end, width;
+ guint x, x_end, width;
LttvTracesetContext *tsc = (LttvTracesetContext*)tss;
TimeWindow time_window =
@@ -771,6 +775,7 @@ void histo_drawing_clear(histoDrawing_t
TRUE,
0,0,
drawing->drawing_area->allocation.width,drawing->drawing_area->allocation.height );
+*/
/* ask for the buffer to be redrawn */
//enabled again for histogram.
@@ -1073,6 +1078,7 @@ histo_motion_notify_ruler(GtkWidget *wid
{
//g_debug("motion");
//eventually follow mouse and show time here
+ return FALSE;
}
static gboolean
@@ -1080,6 +1086,7 @@ histo_motion_notify_vertical_ruler(GtkWi
{
//g_debug("motion");
//eventually follow mouse and show time here
+ return FALSE;
}
@@ -1141,7 +1148,7 @@ histo_expose_vertical_ruler( GtkWidget *
drawing->vertical_ruler-> allocation.width-7, 1);
- snprintf(text, 255, "%lu",0);
+ snprintf(text, 255, "%d", 0);
pango_layout_set_text(layout, text, -1);
pango_layout_get_pixel_extents(layout, &ink_rect, NULL);
Index: b/lttv/modules/gui/histogram/histoeventhooks.c
===================================================================
--- a/lttv/modules/gui/histogram/histoeventhooks.c
+++ b/lttv/modules/gui/histogram/histoeventhooks.c
@@ -615,7 +615,7 @@ gint histo_update_time_window_hook(void
histo_drawing_update_vertical_ruler(drawing);
-
+#if 0
/*// if( histo_new_time_window->time_width.tv_sec == histo_old_time_window->time_width.tv_sec
&& histo_new_time_window->time_width.tv_nsec == histo_old_time_window->time_width.tv_nsec)
@@ -834,6 +834,8 @@ gint histo_update_time_window_hook(void
histo_drawing_update_vertical_ruler(drawing);
*/
+#endif
+
//disabled for histogram, always redraw whole screen.
return 0;
}
@@ -1111,7 +1113,9 @@ int histo_after_chunk(void *hook_data, v
histoDrawing_t *drawing = histocontrol_flow_data->drawing;
- if(!histocontrol_flow_data->chunk_has_begun) return;
+ if(!histocontrol_flow_data->chunk_has_begun)
+ return 0;
+
histocontrol_flow_data->chunk_has_begun = TRUE;
if(tfc != NULL)
Index: b/lttv/modules/gui/interrupts/interrupts.c
===================================================================
--- a/lttv/modules/gui/interrupts/interrupts.c
+++ b/lttv/modules/gui/interrupts/interrupts.c
@@ -1010,7 +1010,7 @@ static gboolean DisplayViewer(void *hook
guint maxIRQduration;
guint minIRQduration;
double periodInSec;
- int periodInNsec;
+ int periodInNsec = 0;
char maxIrqHandler[80];
char minIrqHandler[80];
InterruptEventData *event_data = (InterruptEventData *)hook_data;
@@ -1030,14 +1030,14 @@ static gboolean DisplayViewer(void *hook
maxIRQduration *= NANOSECONDS_PER_SECOND;
maxIRQduration += element.max_irq_handler.duration.tv_nsec;
- sprintf(maxIrqHandler, "%d [%d.%d - %d.%d]",maxIRQduration, element.max_irq_handler.start_time.tv_sec, \
+ sprintf(maxIrqHandler, "%d [%lu.%lu - %lu.%lu]",maxIRQduration, element.max_irq_handler.start_time.tv_sec, \
element.max_irq_handler.start_time.tv_nsec, element.max_irq_handler.end_time.tv_sec, \
element.max_irq_handler.end_time.tv_nsec) ;
minIRQduration = element.min_irq_handler.duration.tv_sec;
minIRQduration *= NANOSECONDS_PER_SECOND;
minIRQduration += element.min_irq_handler.duration.tv_nsec;
- sprintf(minIrqHandler, "%d [%d.%d - %d.%d]",minIRQduration, element.min_irq_handler.start_time.tv_sec, \
+ sprintf(minIrqHandler, "%d [%lu.%lu - %lu.%lu]",minIRQduration, element.min_irq_handler.start_time.tv_sec, \
element.min_irq_handler.start_time.tv_nsec, element.min_irq_handler.end_time.tv_sec, \
element.min_irq_handler.end_time.tv_nsec) ;
Index: b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
===================================================================
--- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
+++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
@@ -764,7 +764,7 @@ void move_down_viewer(GtkWidget * widget
return;
} else {
LttvPluginTab *ptab;
- ptab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin");
+ ptab = g_object_get_data(G_OBJECT(page), "Tab_Plugin");
tab = ptab->tab;
}
@@ -839,7 +839,7 @@ void delete_viewer(GtkWidget * widget, g
return;
} else {
LttvPluginTab *ptab;
- ptab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin");
+ ptab = g_object_get_data(G_OBJECT(page), "Tab_Plugin");
tab = ptab->tab;
}
@@ -2577,7 +2577,7 @@ void
on_trace_facility_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_info("Trace facility selector: %s\n");
+ g_info("Trace facility selector: %s\n", "");
}
@@ -2895,7 +2895,7 @@ on_unload_module_activate (
GError *error = NULL;
MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
- LttvLibrary *library;
+ LttvLibrary *library = NULL;
{
GPtrArray *name;
guint nb,i;
@@ -4349,10 +4349,10 @@ MainWindow *construct_main_window(MainWi
LttvIAttribute *attributes_global =
LTTV_IATTRIBUTE(lttv_global_attributes());
- g_assert(attribute =
- LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
- LTTV_IATTRIBUTE(attributes_global),
- LTTV_VIEWER_CONSTRUCTORS)));
+ attribute = LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(attributes_global),
+ LTTV_VIEWER_CONSTRUCTORS));
+ g_assert(attribute);
name = g_quark_from_string("guievents");
type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
Index: b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c
===================================================================
--- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c
+++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c
@@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
+#include <inttypes.h>
#include <ltt/time.h>
#include <ltt/trace.h>
@@ -153,7 +154,8 @@ void lttvwindowtraces_add_trace(LttvTrac
g_quark_to_string(ltt_trace_name(lttv_trace(trace))));
return;
}
- result = snprintf(attribute_path, PATH_MAX, "%llu:%llu", buf.st_dev, buf.st_ino);
+ result = snprintf(attribute_path, PATH_MAX, "%" PRIu64 ":%" PRIu64,
+ buf.st_dev, buf.st_ino);
g_assert(result >= 0);
attribute =
Index: b/lttv/modules/gui/resourceview/cfv.h
===================================================================
--- a/lttv/modules/gui/resourceview/cfv.h
+++ b/lttv/modules/gui/resourceview/cfv.h
@@ -93,6 +93,6 @@ static inline ProcessList *guicontrolflo
return control_flow_data->process_list ;
}
-
+ControlFlowData *resourceview(LttvPluginTab *ptab);
#endif // _CFV_H
Index: b/lttv/modules/gui/resourceview/drawing.c
===================================================================
--- a/lttv/modules/gui/resourceview/drawing.c
+++ b/lttv/modules/gui/resourceview/drawing.c
@@ -479,7 +479,7 @@ static void set_last_start(gpointer key,
{
//ResourceInfo *process_info = (ResourceInfo*)key;
HashedResourceData *hashed_process_data = (HashedResourceData*)value;
- guint x = (guint)user_data;
+ guint x = GPOINTER_TO_UINT(user_data);
hashed_process_data->x.over = x;
hashed_process_data->x.over_used = FALSE;
@@ -517,8 +517,9 @@ void drawing_data_request_begin(EventsRe
&x);
for(i=0; i<RV_RESOURCE_COUNT; i++) {
- g_hash_table_foreach(cfd->process_list->restypes[i].hash_table, set_last_start,
- (gpointer)x);
+ g_hash_table_foreach(cfd->process_list->restypes[i].hash_table,
+ set_last_start,
+ GUINT_TO_POINTER(x));
}
}
Index: b/lttv/modules/gui/resourceview/eventhooks.c
===================================================================
--- a/lttv/modules/gui/resourceview/eventhooks.c
+++ b/lttv/modules/gui/resourceview/eventhooks.c
@@ -56,6 +56,7 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
+#include <inttypes.h>
//#include <pango/pango.h>
@@ -92,7 +93,6 @@ extern GSList *g_legend_list;
static gint background_ready(void *hook_data, void *call_data)
{
ControlFlowData *resourceview_data = (ControlFlowData *)hook_data;
- LttvTrace *trace = (LttvTrace*)call_data;
resourceview_data->background_info_waiting--;
@@ -621,6 +621,10 @@ int after_schedchange_hook(void *hook_da
return 0;
}
+int before_execmode_hook_irq(void *hook_data, void *call_data);
+int before_execmode_hook_soft_irq(void *hook_data, void *call_data);
+int before_execmode_hook_trap(void *hook_data, void *call_data);
+
/* before_execmode_hook
*
* This function basically draw lines and icons. Two types of lines are drawn :
@@ -857,7 +861,7 @@ int before_execmode_hook_irq(void *hook_
GQuark name;
{
gchar *str;
- str = g_strdup_printf("IRQ %llu [%s]", irq, (char*)g_quark_to_string(ts->irq_names[irq]));
+ str = g_strdup_printf("IRQ %" PRIu64 " [%s]", irq, (char*)g_quark_to_string(ts->irq_names[irq]));
name = g_quark_from_string(str);
g_free(str);
}
@@ -2102,7 +2106,8 @@ int after_chunk(void *hook_data, void *c
guint nb_trace = lttv_traceset_number(traceset);
/* Only execute when called for the first trace's events request */
- if(!process_list->current_hash_data) return;
+ if(!process_list->current_hash_data)
+ return 0;
for(i = 0 ; i < nb_trace ; i++) {
g_free(process_list->current_hash_data[i]);
Index: b/lttv/modules/gui/resourceview/lttv_plugin_cfv.c
===================================================================
--- a/lttv/modules/gui/resourceview/lttv_plugin_cfv.c
+++ b/lttv/modules/gui/resourceview/lttv_plugin_cfv.c
@@ -20,6 +20,7 @@
#include "lttv_plugin_cfv.h"
#include <lttvwindow/lttvwindow.h>
#include "drawing.h"
+#include "eventhooks.h"
/*
* forward definitions
Index: b/lttv/modules/gui/resourceview/processlist.c
===================================================================
--- a/lttv/modules/gui/resourceview/processlist.c
+++ b/lttv/modules/gui/resourceview/processlist.c
@@ -246,9 +246,9 @@ void update_pixmap_size(ProcessList *pro
{
int i;
for(i=0; i<RV_RESOURCE_COUNT; i++) {
- g_hash_table_foreach(process_list->restypes[i].hash_table,
- (GHFunc)update_pixmap_size_each,
- (gpointer)width);
+ g_hash_table_foreach(process_list->restypes[i].hash_table,
+ (GHFunc)update_pixmap_size_each,
+ GUINT_TO_POINTER(width));
}
}
Index: b/lttv/modules/gui/resourceview/processlist.h
===================================================================
--- a/lttv/modules/gui/resourceview/processlist.h
+++ b/lttv/modules/gui/resourceview/processlist.h
@@ -299,6 +299,10 @@ static inline GHashTable *resourcelist_g
return resourceview_data->process_list->restypes[type].hash_table;
}
-
+HashedResourceData *resourcelist_obtain_cpu(ControlFlowData *resourceview_data, guint trace_num, guint id);
+HashedResourceData *resourcelist_obtain_irq(ControlFlowData *resourceview_data, guint trace_num, guint id);
+HashedResourceData *resourcelist_obtain_soft_irq(ControlFlowData *resourceview_data, guint trace_num, guint id);
+HashedResourceData *resourcelist_obtain_trap(ControlFlowData *resourceview_data, guint trace_num, guint id);
+HashedResourceData *resourcelist_obtain_bdev(ControlFlowData *resourceview_data, guint trace_num, guint id);
#endif // _PROCESS_LIST_H
Index: b/lttv/modules/text/textDump.c
===================================================================
--- a/lttv/modules/text/textDump.c
+++ b/lttv/modules/text/textDump.c
@@ -38,6 +38,7 @@
#include <ltt/event.h>
#include <ltt/trace.h>
#include <stdio.h>
+#include <inttypes.h>
static gboolean
a_noevent,
@@ -79,7 +80,7 @@ print_path_tree(FILE *fp, GString *inden
if(is_named) {
g_string_sprintfa(indent, "/%s", g_quark_to_string(name));
} else {
- g_string_sprintfa(indent, "/%s", name);
+ g_string_sprintfa(indent, "/%" PRIu32, (guint32) name);
}
switch(type) {
@@ -146,7 +147,8 @@ print_tree(FILE *fp, GString *indent, Lt
if(is_named)
fprintf(fp, "%s%s: ", indent->str, g_quark_to_string(name));
else
- fprintf(fp, "%s%lu: ", indent->str, name);
+ fprintf(fp, "%s%" PRIu32 ": ", indent->str,
+ (guint32) name);
switch(type) {
case LTTV_INT:
@@ -205,8 +207,6 @@ print_stats(FILE *fp, LttvTracesetStats
GString *indent;
- LttSystemDescription *desc;
-
if(tscs->stats == NULL) return;
indent = g_string_new("");
fprintf(fp, "Traceset statistics:\n\n");
@@ -222,6 +222,7 @@ print_stats(FILE *fp, LttvTracesetStats
for(i = 0 ; i < nb ; i++) {
tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]);
#if 0 //FIXME
+ LttSystemDescription *desc;
desc = ltt_trace_system_description(tcs->parent.parent.t);
LttTime start_time = ltt_trace_system_description_trace_start_time(desc);
fprintf(fp, "Trace on system %s at time %lu.%09lu :\n",
@@ -289,8 +290,8 @@ static gboolean write_traceset_footer(vo
static gboolean write_trace_header(void *hook_data, void *call_data)
{
- LttvTraceContext *tc = (LttvTraceContext *)call_data;
#if 0 //FIXME
+ LttvTraceContext *tc = (LttvTraceContext *)call_data;
LttSystemDescription *system = ltt_trace_system_description(tc->t);
fprintf(a_file," Trace from %s in %s\n%s\n\n",
Index: b/lttv/modules/text/textFilter.c
===================================================================
--- a/lttv/modules/text/textFilter.c
+++ b/lttv/modules/text/textFilter.c
@@ -54,7 +54,7 @@ static char
*a_file_name = NULL,
*a_string = NULL;
-static LttvHooks
+static LttvHooks __attribute__ ((__unused__))
*before_traceset,
*event_hook;
More information about the lttng-dev
mailing list