X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fprint.c;h=a8de92df4b286cca517e130637cc56052de01e5f;hb=1f3686cd4d8a0f6c5d9406181b398b6ddd9e0b7e;hp=5707175c3ee92627c5bbe568f42a3bc58fb64cad;hpb=7a4bdb546094fea3343bfc80e3744ea26a08dd22;p=lttv.git diff --git a/lttv/lttv/print.c b/lttv/lttv/print.c index 5707175c..a8de92df 100644 --- a/lttv/lttv/print.c +++ b/lttv/lttv/print.c @@ -264,8 +264,8 @@ void lttv_print_field(LttEvent *e, struct marker_field *f, GString *s, int getProcessInfosFromEvent(LttvEvent *event, GString* processInfos) { int pid=0, tid=0, ppid=0; - char *procname; - struct definition *scope; + const char *procname; + unsigned long timestamp; int ret = 0; @@ -323,7 +323,7 @@ int getProcessInfosFromEvent(LttvEvent *event, GString* processInfos) } #endif if (noError||1) { - g_string_append_printf(processInfos, "%u, %u, %s, %u", pid, tid, procname, ppid); + g_string_append_printf(processInfos, "%u, %u, %s, %u. %s, %s", pid, tid, procname, ppid, g_quark_to_string(process->state->t), g_quark_to_string(process->state->s)); } else { ret = -1; @@ -347,12 +347,12 @@ int getCPUIdFromEvent(LttvEvent *event, GString* cpuId_str) int getFields(struct bt_ctf_event *ctf_event, struct definition const *fields, GString* fieldsStr) { - enum ctf_type_id fieldType = bt_ctf_field_type(fields); + enum ctf_type_id fieldType = bt_ctf_field_type(bt_ctf_get_decl_from_def(fields)); int ret = 0, isSigned = -1, len = 0, i = 0; - struct definition *index_def; + const struct definition *index_def; switch (fieldType) { case CTF_TYPE_INTEGER: - isSigned = bt_ctf_get_int_signedness(fields); + isSigned = bt_ctf_get_int_signedness(bt_ctf_get_decl_from_def(fields)); if (isSigned == 1) { g_string_append_printf(fieldsStr, "%lu", bt_ctf_get_int64(fields)); } @@ -366,15 +366,15 @@ int getFields(struct bt_ctf_event *ctf_event, struct definition const *fields, G case CTF_TYPE_ARRAY: g_string_append_printf(fieldsStr, "[ "); - len = bt_ctf_get_array_len(fields); - if (index_def = bt_ctf_get_index(ctf_event, fields, i)) { + len = bt_ctf_get_array_len(bt_ctf_get_decl_from_def(fields)); + if ((index_def = bt_ctf_get_index(ctf_event, fields, i))) { for (i = 0; i < len; i++) { if (i > 0) { g_string_append_printf(fieldsStr, ", "); } - bt_ctf_field_type(bt_ctf_get_index(ctf_event, fields, i)); + //bt_ctf_field_type( bt_ctf_get_index(ctf_event, fields, i)); g_string_append_printf(fieldsStr, " "); - g_string_append_printf(fieldsStr, "[%d] = "); + g_string_append_printf(fieldsStr, "[%d] = ",i); getFields(ctf_event, bt_ctf_get_index(ctf_event, fields, i), fieldsStr); } } @@ -385,7 +385,9 @@ int getFields(struct bt_ctf_event *ctf_event, struct definition const *fields, G break; case CTF_TYPE_UNKNOWN: + g_string_append_printf(fieldsStr, "TYPE UNKNOWN"); default: + g_string_append_printf(fieldsStr, "TYPE UNIMP %i",fieldType ); break; } return ret; @@ -395,9 +397,9 @@ int getFieldsFromEvent(struct bt_ctf_event *ctf_event, GString* fields, gboolean { struct definition const * const *list = NULL; unsigned int count; - int i = 0, j = 0, ret = 0; + int i = 0, ret = 0; gboolean noError = TRUE; - struct definition *scope; + const struct definition *scope; scope = bt_ctf_get_top_level_scope(ctf_event, BT_EVENT_FIELDS); if (!scope) { @@ -430,7 +432,8 @@ int getFieldsFromEvent(struct bt_ctf_event *ctf_event, GString* fields, gboolean return ret; } -void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_names) +void lttv_event_to_string(LttvEvent *event, GString *a_string, + gboolean field_names, gboolean long_version) { GString* processInfos = g_string_new(""); GString* fields = g_string_new(""); @@ -441,8 +444,13 @@ void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_na getCPUIdFromEvent(event, cpuId_str); g_string_set_size(a_string,0); - - g_string_append_printf(a_string, "%llu %s: { %s }", bt_ctf_get_timestamp(event->bt_event), bt_ctf_event_name(event->bt_event), cpuId_str->str); + if(long_version){ + g_string_append_printf(a_string, "%llu %s: ", + bt_ctf_get_timestamp(event->bt_event), + bt_ctf_event_name(event->bt_event)); + } + g_string_append_printf(a_string, "{ %s }", cpuId_str->str); + if (strcmp("", processInfos->str) < 0) { g_string_append_printf(a_string, ", { %s }", processInfos->str); } @@ -454,7 +462,11 @@ void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_na g_string_free(processInfos, TRUE); g_string_free(cpuId_str, TRUE); } - +void lttv_event_get_name(LttvEvent *event,GString *a_string) +{ + g_string_set_size(a_string,0); + g_string_append_printf(a_string, " %s", bt_ctf_event_name(event->bt_event)); +} #ifdef BABEL_CLEANUP void lttv_event_to_string(LttEvent *e, GString *s, gboolean mandatory_fields, gboolean field_names, LttvTracefileState *tfs)