X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fprint.c;h=57936e648c89c1ce38e977668a472f872a802d46;hb=b9ce0bad7daf7c0a2333c91fdb1e35d602afe17f;hp=aa21f77bf3c18531515539bdf37d9cfb0e318087;hpb=6db3427f29cace9a1addac5a6277bbc1ce666002;p=lttv.git diff --git a/lttv/lttv/print.c b/lttv/lttv/print.c index aa21f77b..57936e64 100644 --- a/lttv/lttv/print.c +++ b/lttv/lttv/print.c @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. */ /* print.c @@ -37,12 +37,8 @@ #include #endif #include -#include -#include -#include #include #include -#include #include #include #include @@ -264,8 +260,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 +319,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; @@ -345,19 +341,19 @@ int getCPUIdFromEvent(LttvEvent *event, GString* cpuId_str) return 0; } -int getFields(struct bt_ctf_event *ctf_event, struct definition const *fields, GString* fieldsStr) +int getFields(struct bt_ctf_event *ctf_event, struct bt_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 bt_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)); } else if (isSigned == 0) { - g_string_append_printf(fieldsStr, "%llu", bt_ctf_get_uint64(fields)); + g_string_append_printf(fieldsStr, "%" PRIu64 , bt_ctf_get_uint64(fields)); } break; case CTF_TYPE_STRING: @@ -366,15 +362,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 +381,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; @@ -393,11 +391,11 @@ int getFields(struct bt_ctf_event *ctf_event, struct definition const *fields, G int getFieldsFromEvent(struct bt_ctf_event *ctf_event, GString* fields, gboolean field_names) { - struct definition const * const *list = NULL; + struct bt_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 bt_definition *scope; scope = bt_ctf_get_top_level_scope(ctf_event, BT_EVENT_FIELDS); if (!scope) { @@ -443,7 +441,7 @@ void lttv_event_to_string(LttvEvent *event, GString *a_string, g_string_set_size(a_string,0); if(long_version){ - g_string_append_printf(a_string, "%llu %s: ", + g_string_append_printf(a_string,"%" PRIu64 " %s: ", bt_ctf_get_timestamp(event->bt_event), bt_ctf_event_name(event->bt_event)); } @@ -491,11 +489,10 @@ void lttv_event_to_string(LttEvent *e, GString *s, gboolean mandatory_fields, ltt_trace_name(ltt_tracefile_get_trace(tfs->parent.tf))), 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%" PRIx64", %s", + g_string_append_printf(s,", %u, %u, %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));