tracecontext.h\
traceset.h\
filter.h\
- print.h
+ print.h\
+ event.h
#man_MANS = lttv.1
#EXTRA_DIST = lttv.1
--- /dev/null
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2012 Yannick Brosseau
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ */
+#ifndef LTTV_EVENT_H
+#define LTTV_EVENT_H
+
+/* Forward declaration */
+struct bt_ctf_event;
+/*
+ Basic event container used through LTTV
+*/
+typedef struct
+{
+ struct bt_ctf_event *bt_event;
+ LttvTraceState *state;
+} LttvEvent;
+
+#endif /* LTTV_EVENT_H */
#include <babeltrace/ctf/events.h>
#include <string.h>
#include <inttypes.h>
+#include <lttv/event.h>
static inline void print_enum_events(LttEvent *e, struct marker_field *f,
guint64 value, GString *s, LttvTracefileState *tfs)
return ret;
}
-void lttv_event_to_string(struct bt_ctf_event *event, GString *a_string, gboolean field_names)
+void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_names)
{
GString* processInfos = g_string_new("");
GString* fields = g_string_new("");
GString* cpuId_str = g_string_new("");
- getProcessInfosFromEvent(event, processInfos);
- getFieldsFromEvent(event, fields, field_names);
- getCPUIdFromEvent(event, cpuId_str);
+ getProcessInfosFromEvent(event->bt_event, processInfos);
+ getFieldsFromEvent(event->bt_event, fields, field_names);
+ getCPUIdFromEvent(event->bt_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_ctf_event_name(event), cpuId_str->str);
+ 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 (strcmp("", processInfos->str) < 0) {
g_string_append_printf(a_string, ", { %s }", processInfos->str);
}
* Use these functions to print textually event fields.
*/
-struct bt_ctf_event;
+#include <lttv/event.h>
void lttv_print_field(LttEvent *e, struct marker_field *f, GString *s,
gboolean field_names, LttvTracefileState *tfs);
void lttv_event_to_string(LttEvent *e, GString *s, gboolean mandatory_fields,
gboolean field_names, LttvTracefileState *tfs);
#endif
-void lttv_event_to_string(struct bt_ctf_event *event, GString *a_string, gboolean field_names);
+void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_names);
#include <lttv/filter.h>
#include <errno.h>
#include <ltt/time.h>
+#include <lttv/event.h>
#include <babeltrace/context.h>
#include <babeltrace/iterator.h>
unsigned count = 0;
- struct bt_ctf_event *event;
+ struct bt_ctf_event *bt_event;
+ LttvEvent event;
+ /* TODO ybrosseau 2012-03-16: Put in really in the traceset */
+ LttvTraceState state;
+
while(TRUE) {
if((count >= nb_events) && (nb_events != G_MAXULONG)) {
break;
}
- if((event = bt_ctf_iter_read_event(self->iter)) != NULL) {
+ if((bt_event = bt_ctf_iter_read_event(self->iter)) != NULL) {
count++;
- /* TODO ybrosseau: encapsulate the event into something */
- lttv_hooks_call(self->event_hooks, event);
+ event.bt_event = bt_event;
+ event.state = &state;
+
+ lttv_hooks_call(self->event_hooks, &event);
if(bt_iter_next(bt_ctf_get_iter(self->iter)) < 0) {
printf("ERROR NEXT\n");
#include <stdio.h>
#include <inttypes.h>
-#include <babeltrace/ctf/events.h>
+#include <lttv/event.h>
static gboolean
a_noevent,
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
- struct bt_ctf_event *event = (struct bt_ctf_event *)call_data;
+ LttvEvent *event = (struct bt_ctf_event *)call_data;
#ifdef BABEL_CLEANUP
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;