projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib list
[lttv.git]
/
ltt
/
branches
/
poly
/
ltt
/
event.c
diff --git
a/ltt/branches/poly/ltt/event.c
b/ltt/branches/poly/ltt/event.c
index 52344487c8a48403c0d369fa6a01b41bcbf5c912..a5b046814027e30f74b3f9410518a85284cebdb0 100644
(file)
--- a/
ltt/branches/poly/ltt/event.c
+++ b/
ltt/branches/poly/ltt/event.c
@@
-26,7
+26,7
@@
#include <glib.h>
#include <asm/types.h>
#include <glib.h>
#include <asm/types.h>
-#include <
linux/byteorder/swab
.h>
+#include <
byteswap
.h>
#include "parser.h"
#include <ltt/ltt.h>
#include "parser.h"
#include <ltt/ltt.h>
@@
-204,8
+204,12
@@
unsigned ltt_event_eventtype_id(const LttEvent *e)
LttFacility *ltt_event_facility(const LttEvent *e)
{
LttTrace * trace = e->tracefile->trace;
LttFacility *ltt_event_facility(const LttEvent *e)
{
LttTrace * trace = e->tracefile->trace;
- unsigned id = e->event_id;
- return ltt_trace_facility_by_id(trace,id);
+ unsigned id = e->facility_id;
+ LttFacility *facility = ltt_trace_facility_by_id(trace,id);
+
+ g_assert(facility->exists);
+
+ return facility;
}
/*****************************************************************************
}
/*****************************************************************************
@@
-391,6
+395,12
@@
void ltt_event_position_copy(LttEventPosition *dest,
}
}
+
+LttTracefile *ltt_event_position_tracefile(LttEventPosition *ep)
+{
+ return ep->tracefile;
+}
+
/*****************************************************************************
*Function name
* ltt_event_cpu_i: get the cpu id where the event happens
/*****************************************************************************
*Function name
* ltt_event_cpu_i: get the cpu id where the event happens
@@
-561,7
+571,8
@@
guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f)
LttTypeEnum t = f->field_type->type_class;
LttTypeEnum t = f->field_type->type_class;
- g_assert(t == LTT_UINT || t == LTT_ENUM);
+ g_assert(t == LTT_UINT || t == LTT_ENUM
+ || t == LTT_ULONG || LTT_SIZE_T || LTT_OFF_T || LTT_POINTER);
if(f->field_size == 1){
guint8 x = *(guint8 *)(e->data + f->offset_root);
if(f->field_size == 1){
guint8 x = *(guint8 *)(e->data + f->offset_root);
@@
-583,7
+594,9
@@
gint64 ltt_event_get_long_int(LttEvent *e, LttField *f)
// e->tracefile->trace->system_description->endian ? 0:1;
gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
// e->tracefile->trace->system_description->endian ? 0:1;
gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
- g_assert( f->field_type->type_class == LTT_INT);
+ g_assert( f->field_type->type_class == LTT_INT
+ || f->field_type->type_class == LTT_LONG
+ || f->field_type->type_class == LTT_SSIZE_T);
if(f->field_size == 1){
gint8 x = *(gint8 *)(e->data + f->offset_root);
if(f->field_size == 1){
gint8 x = *(gint8 *)(e->data + f->offset_root);
@@
-601,31
+614,31
@@
gint64 ltt_event_get_long_int(LttEvent *e, LttField *f)
float ltt_event_get_float(LttEvent *e, LttField *f)
{
float ltt_event_get_float(LttEvent *e, LttField *f)
{
- gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
+ g_assert(LTT_HAS_FLOAT(e->tracefile));
+ gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 4);
if(reverse_byte_order == 0) return *(float *)(e->data + f->offset_root);
else{
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 4);
if(reverse_byte_order == 0) return *(float *)(e->data + f->offset_root);
else{
- guint32 aInt;
- memcpy((void*)&aInt, e->data + f->offset_root, 4);
- aInt = ___swab32(aInt);
- return ((float)aInt);
+ void *ptr = e->data + f->offset_root;
+ guint32 value = bswap_32(*(guint32*)ptr);
+ return *(float*)&value;
}
}
double ltt_event_get_double(LttEvent *e, LttField *f)
{
}
}
double ltt_event_get_double(LttEvent *e, LttField *f)
{
- gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
+ g_assert(LTT_HAS_FLOAT(e->tracefile));
+ gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 8);
if(reverse_byte_order == 0) return *(double *)(e->data + f->offset_root);
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 8);
if(reverse_byte_order == 0) return *(double *)(e->data + f->offset_root);
- else{
- guint64 aInt;
- memcpy((void*)&aInt, e->data + f->offset_root, 8);
- aInt = ___swab64(aInt);
- return ((double)aInt);
+ else {
+ void *ptr = e->data + f->offset_root;
+ guint64 value = bswap_64(*(guint64*)ptr);
+ return *(double*)&value;
}
}
}
}
This page took
0.022928 seconds
and
4
git commands to generate.