X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fhook.h;h=197184a6d4ce9333be659c31ecb5a5408b0e0add;hb=d448fce24840c50fbd998d06a7daa595859df2ff;hp=502ac5c8732b4b337fd9f4b6db3e2492fd1e62b7;hpb=88237536a72d70abfc670286eae1cf7c44c1a50b;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/hook.h b/ltt/branches/poly/lttv/lttv/hook.h index 502ac5c8..197184a6 100644 --- a/ltt/branches/poly/lttv/lttv/hook.h +++ b/ltt/branches/poly/lttv/lttv/hook.h @@ -22,6 +22,7 @@ #define HOOK_H #include +#include /* A hook is a function to call with the supplied hook data, and with call site specific data (e.g., hooks for events are called with a @@ -122,8 +123,14 @@ gboolean lttv_hooks_call_check_merge(LttvHooks *h1, void *call_data1, /* Sometimes different hooks need to be called based on the case. The case is represented by an unsigned integer id */ -typedef GPtrArray LttvHooksById; +typedef struct _LttvHooksById { + GPtrArray *index; + GArray *array; +} LttvHooksById; +/* macro to calculate the hook ID of a facility/event pair. */ +#define GET_HOOK_ID(fac_id, ev_id) \ + ( (guint)fac_id | ((guint)ev_id << FACILITIES_BITS) ) /* Create and destroy a hooks by id list */ @@ -144,10 +151,10 @@ unsigned lttv_hooks_by_id_max_id(LttvHooksById *h); /* Get the list of hooks for an id, NULL if none exists */ -inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id) +static inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id) { LttvHooks *ret; - if(id < h->len) ret = h->pdata[id]; + if(likely(id < h->index->len)) ret = h->index->pdata[id]; else ret = NULL; return ret;