#include <lttv/stats.h>
#include <lttv/lttv.h>
#include <lttv/attribute.h>
-#include <ltt/facility.h>
#include <ltt/trace.h>
#include <ltt/event.h>
-#include <ltt/type.h>
#define BUF_SIZE 256
#define MAX_64_HEX_STRING_LEN 19
LttvTraceStats *tcs;
- LttvTracefileContext *tfc;
-
LttvTracefileContext **tfs;
LttvTracefileStats *tfcs;
- LttTime timestamp = {0,0};
-
LttvAttributeValue v;
- LttvAttribute
- *stats_tree,
- *tracefiles_stats;
+ LttvAttribute *tracefiles_stats;
LttvTraceset *ts = self->parent.parent.ts;
LttvTracefileStats *tfcs;
- LttTime timestamp = {0,0};
-
LttvAttributeValue v;
LttvAttribute *tracefiles_stats;
return type;
}
-
static void
find_event_tree(LttvTracefileStats *tfcs,
GQuark pid_time,
LttvAttribute **events_tree,
LttvAttribute **event_types_tree)
{
- LttvAttribute *a, *prev_a;
+ LttvAttribute *a;
gchar fstring[MAX_64_HEX_STRING_LEN];
gint ret;
*event_types_tree = a;
}
-
-/* Update the trace event tree for the specified cpu */
-static void update_trace_event_tree(LttvTracefileStats *tfcs, guint cpu)
+static void update_event_tree(LttvTracefileStats *tfcs)
{
+ guint cpu = tfcs->parent.cpu;
LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context;
LttvProcessState *process = ts->running_process[cpu];
LttvExecutionState *es = process->state;
&(tfcs->current_event_types_tree));
}
-static void update_event_tree(LttvTracefileStats *tfcs)
+
+/* Update the trace event tree for the specified cpu */
+static void update_trace_event_tree(LttvTraceStats *tcs)
{
- update_trace_event_tree(tfcs, tfcs->parent.cpu);
+ LttvTracefileStats *tfcs;
+ LttvTraceContext *tc = (LttvTraceContext*)tcs;
+ guint j, nb_tracefile;
+
+ /* For each tracefile, update the event tree */
+ nb_tracefile = tc->tracefiles->len;
+ for(j = 0; j < nb_tracefile; j++) {
+ tfcs = LTTV_TRACEFILE_STATS(g_array_index(tc->tracefiles,
+ LttvTracefileContext*, j));
+ update_event_tree(tfcs);
+ }
}
static void mode_change(LttvTracefileStats *tfcs)
LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context;
guint cpu = tfcs->parent.cpu;
LttvProcessState *process = ts->running_process[cpu];
- LttvAttributeValue cpu_time, cum_cpu_time;
+ LttvAttributeValue cpu_time;
LttTime delta;
LttTime delta;
/* FIXME put there in case of a missing update after a state modification */
+ //void *lasttree = tfcs->current_events_tree;
//update_event_tree(tfcs);
-
+ //g_assert (lasttree == tfcs->current_events_tree);
lttv_attribute_find(tfcs->current_events_tree, LTTV_STATS_ELAPSED_TIME,
LTTV_TIME, &elapsed_time);
- if(process->state->t != LTTV_STATE_MODE_UNKNOWN)
+ if(process->state->t != LTTV_STATE_MODE_UNKNOWN) {
delta = ltt_time_sub(tfcs->parent.parent.timestamp,
process->state->entry);
- else
+ } else
delta = ltt_time_zero;
*(elapsed_time.v_time) = ltt_time_add(*(elapsed_time.v_time), delta);
- //g_assert(delta.tv_nsec != 14736);
-
lttv_attribute_find(tfcs->current_events_tree, LTTV_STATS_CPU_TIME,
LTTV_TIME, &cpu_time);
LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context;
guint cpu = tfcs->parent.cpu;
LttvProcessState *process = ts->running_process[cpu];
- LttvAttributeValue cum_cpu_time;
LttTime nested_delta;
}
-gboolean before_syscall_exit(void *hook_data, void *call_data)
+static gboolean before_syscall_exit(void *hook_data, void *call_data)
{
mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_trap_entry(void *hook_data, void *call_data)
+static gboolean before_trap_entry(void *hook_data, void *call_data)
{
mode_change((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_trap_exit(void *hook_data, void *call_data)
+static gboolean before_trap_exit(void *hook_data, void *call_data)
{
mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_trap_exit(void *hook_data, void *call_data)
+static gboolean after_trap_exit(void *hook_data, void *call_data)
{
after_mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_irq_entry(void *hook_data, void *call_data)
+static gboolean before_irq_entry(void *hook_data, void *call_data)
{
mode_change((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_irq_entry(void *hook_data, void *call_data)
+static gboolean after_irq_entry(void *hook_data, void *call_data)
{
update_event_tree((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_irq_exit(void *hook_data, void *call_data)
+static gboolean before_irq_exit(void *hook_data, void *call_data)
{
mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_irq_exit(void *hook_data, void *call_data)
+static gboolean after_irq_exit(void *hook_data, void *call_data)
{
after_mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_soft_irq_entry(void *hook_data, void *call_data)
+static gboolean before_soft_irq_entry(void *hook_data, void *call_data)
{
mode_change((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_soft_irq_entry(void *hook_data, void *call_data)
+static gboolean after_soft_irq_entry(void *hook_data, void *call_data)
{
update_event_tree((LttvTracefileStats *)call_data);
return FALSE;
}
-
-gboolean before_soft_irq_exit(void *hook_data, void *call_data)
+static gboolean before_soft_irq_exit(void *hook_data, void *call_data)
{
mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_soft_irq_exit(void *hook_data, void *call_data)
+static gboolean after_soft_irq_exit(void *hook_data, void *call_data)
{
after_mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_function_entry(void *hook_data, void *call_data)
+static gboolean before_function_entry(void *hook_data, void *call_data)
{
mode_change((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_function_entry(void *hook_data, void *call_data)
+static gboolean after_function_entry(void *hook_data, void *call_data)
{
update_event_tree((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_function_exit(void *hook_data, void *call_data)
+static gboolean before_function_exit(void *hook_data, void *call_data)
{
mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean after_function_exit(void *hook_data, void *call_data)
+static gboolean after_function_exit(void *hook_data, void *call_data)
{
after_mode_end((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_schedchange(void *hook_data, void *call_data)
+static gboolean before_schedchange(void *hook_data, void *call_data)
{
LttvTracefileStats *tfcs = (LttvTracefileStats *)call_data;
- LttvTraceState *ts = (LttvTraceState*)tfcs->parent.parent.t_context;
-
LttEvent *e = ltt_tracefile_get_event(tfcs->parent.parent.tf);
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
+ LttvTraceHook *th = (LttvTraceHook *)hook_data;
guint pid_in, pid_out;
- gint state_out;
+ gint64 state_out;
- pid_out = ltt_event_get_unsigned(e, thf->f1);
- pid_in = ltt_event_get_unsigned(e, thf->f2);
- state_out = ltt_event_get_int(e, thf->f3);
+ pid_out = ltt_event_get_unsigned(e, th->f1);
+ pid_in = ltt_event_get_unsigned(e, th->f2);
+ state_out = ltt_event_get_long_int(e, th->f3);
/* compute the time for the process to schedule out */
mode_change(tfcs);
return FALSE;
}
-gboolean after_schedchange(void *hook_data, void *call_data)
+static gboolean after_schedchange(void *hook_data, void *call_data)
{
LttvTracefileStats *tfcs = (LttvTracefileStats *)call_data;
LttEvent *e = ltt_tracefile_get_event(tfcs->parent.parent.tf);
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
+ LttvTraceHook *th = (LttvTraceHook *)hook_data;
guint pid_in, pid_out;
- gint state_out;
+ gint64 state_out;
LttvProcessState *process;
- pid_out = ltt_event_get_unsigned(e, thf->f1);
- pid_in = ltt_event_get_unsigned(e, thf->f2);
- state_out = ltt_event_get_int(e, thf->f3);
+ pid_out = ltt_event_get_unsigned(e, th->f1);
+ pid_in = ltt_event_get_unsigned(e, th->f2);
+ state_out = ltt_event_get_long_int(e, th->f3);
/* get the information for the process scheduled in */
guint cpu = tfcs->parent.cpu;
return FALSE;
}
-gboolean process_fork(void *hook_data, void *call_data)
+static gboolean process_fork(void *hook_data, void *call_data)
{
- /* nothing to do for now */
return FALSE;
}
-
-gboolean process_exit(void *hook_data, void *call_data)
+static gboolean process_exit(void *hook_data, void *call_data)
{
- /* We should probably exit all modes here or we could do that at
- schedule out. */
+ update_event_tree((LttvTracefileStats *)call_data);
return FALSE;
}
-gboolean before_enum_process_state(void *hook_data, void *call_data)
+static gboolean before_enum_process_state(void *hook_data, void *call_data)
{
#if 0
/* Broken : adds up time in the current process doing the dump */
return FALSE;
}
-gboolean after_enum_process_state(void *hook_data, void *call_data)
+static gboolean after_enum_process_state(void *hook_data, void *call_data)
{
- LttvTracefileStats *tfcs = (LttvTracefileStats *)call_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
- LttvTraceState *ts = (LttvTraceState*)tfc->t_context;
- guint nb_cpus, i;
-
- nb_cpus = ltt_trace_get_num_cpu(ts->parent.t);
- for(i=0; i<nb_cpus; i++) {
- update_trace_event_tree(tfcs, i);
- }
+ LttvTraceStats *tcs = (LttvTraceStats*)tfc->t_context;
+ update_trace_event_tree(tcs);
return FALSE;
}
static gboolean after_statedump_end(void *hook_data, void *call_data)
{
- LttvTracefileStats *tfcs = (LttvTracefileStats *)call_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
- LttvTraceState *ts = (LttvTraceState*)tfc->t_context;
- guint nb_cpus, i;
-
- nb_cpus = ltt_trace_get_num_cpu(ts->parent.t);
- for(i=0; i<nb_cpus; i++) {
- update_trace_event_tree(tfcs, i);
- }
+ LttvTraceStats *tcs = (LttvTraceStats*)tfc->t_context;
+ update_trace_event_tree(tcs);
return FALSE;
}
-gboolean process_free(void *hook_data, void *call_data)
+static gboolean process_free(void *hook_data, void *call_data)
{
return FALSE;
}
-gboolean every_event(void *hook_data, void *call_data)
+static gboolean every_event(void *hook_data, void *call_data)
{
LttvTracefileStats *tfcs = (LttvTracefileStats *)call_data;
return FALSE;
}
-static void lttv_stats_cleanup_process_state(LttvTraceState *ts,
- LttvProcessState *process)
+struct cleanup_state_struct {
+ LttvTraceState *ts;
+ LttTime current_time;
+};
+
+//static void lttv_stats_cleanup_process_state(LttvTraceState *ts,
+// LttvProcessState *process, LttTime current_time)
+static void lttv_stats_cleanup_process_state(gpointer key, gpointer value,
+ gpointer user_data)
{
- LttvTraceStats *tcs = (LttvTraceStats *)ts;
- LttvTracesetContext *tsc = ts->parent.ts_context;
- int i;
+ struct cleanup_state_struct *cleanup_closure =
+ (struct cleanup_state_struct *)user_data;
+ LttvTraceState *ts = cleanup_closure->ts;
+ LttvProcessState *process = (LttvProcessState *)value;
+ LttTime current_time = cleanup_closure->current_time;
LttvTracefileStats **tfs = (LttvTracefileStats **)
&g_array_index(ts->parent.tracefiles, LttvTracefileContext*,
process->cpu);
int cleanup_empty = 0;
LttTime nested_delta = ltt_time_zero;
+
/* FIXME : ok, this is a hack. The time is infinite here :( */
- LttTime save_time = (*tfs)->parent.parent.timestamp;
- LttTime start, end;
- ltt_trace_time_span_get(ts->parent.t, &start, &end);
- (*tfs)->parent.parent.timestamp = end;
+ //LttTime save_time = (*tfs)->parent.parent.timestamp;
+ //LttTime start, end;
+ //ltt_trace_time_span_get(ts->parent.t, &start, &end);
+ //(*tfs)->parent.parent.timestamp = end;
do {
if(ltt_time_compare(process->state->cum_cpu_time, ltt_time_zero) != 0) {
process->current_function,
process->state->t, process->state->n, &((*tfs)->current_events_tree),
&((*tfs)->current_event_types_tree));
- mode_end(*tfs);
+ /* Call mode_end only if not at end of trace */
+ if(ltt_time_compare(current_time, ltt_time_infinite) != 0)
+ mode_end(*tfs);
nested_delta = process->state->cum_cpu_time;
}
cleanup_empty = lttv_state_pop_state_cleanup(process,
} while(cleanup_empty != 1);
- (*tfs)->parent.parent.timestamp = save_time;
+ //(*tfs)->parent.parent.timestamp = save_time;
}
/* For each cpu, for each of their stacked states,
* perform sum of needed values. */
-static void lttv_stats_cleanup_state(LttvTraceStats *tcs)
+static void lttv_stats_cleanup_state(LttvTraceStats *tcs, LttTime current_time)
{
LttvTraceState *ts = (LttvTraceState *)tcs;
+ struct cleanup_state_struct cleanup_closure;
+#if 0
guint nb_cpus, i;
nb_cpus = ltt_trace_get_num_cpu(ts->parent.t);
for(i=0; i<nb_cpus; i++) {
- lttv_stats_cleanup_process_state(ts, ts->running_process[i]);
+ lttv_stats_cleanup_process_state(ts, ts->running_process[i], current_time);
}
+#endif //0
+ cleanup_closure.ts = tcs;
+ cleanup_closure.current_time = current_time;
+ g_hash_table_foreach(ts->processes, lttv_stats_cleanup_process_state,
+ &cleanup_closure);
}
void
-lttv_stats_sum_trace(LttvTraceStats *self, LttvAttribute *ts_stats)
+lttv_stats_sum_trace(LttvTraceStats *self, LttvAttribute *ts_stats,
+ LttTime current_time)
{
LttvAttribute *sum_container = self->stats;
/* First cleanup the state : sum all stalled information (never ending
* states). */
if(!trace_is_summed)
- lttv_stats_cleanup_state(self);
+ lttv_stats_cleanup_state(self, current_time);
processes_tree = lttv_attribute_find_subdir(main_tree,
LTTV_STATS_PROCESSES);
gboolean lttv_stats_sum_traceset_hook(void *hook_data, void *call_data)
{
- lttv_stats_sum_traceset((LttvTracesetStats *)call_data);
+ struct sum_traceset_closure *closure =
+ (struct sum_traceset_closure *)call_data;
+ lttv_stats_sum_traceset(closure->tss, closure->current_time);
return 0;
}
void
-lttv_stats_sum_traceset(LttvTracesetStats *self)
+lttv_stats_sum_traceset(LttvTracesetStats *self, LttTime current_time)
{
LttvTraceset *traceset = self->parent.parent.ts;
LttvAttribute *sum_container = self->stats;
int i, nb_trace;
- LttvAttribute *main_tree;
-
LttvAttributeValue value;
lttv_attribute_find(sum_container, LTTV_STATS_SUMMED,
for(i = 0 ; i < nb_trace ; i++) {
tcs = (LttvTraceStats *)(self->parent.parent.traces[i]);
- lttv_stats_sum_trace(tcs, self->stats);
+ lttv_stats_sum_trace(tcs, self->stats, current_time);
// lttv_attribute_recursive_add(sum_container, tcs->stats);
}
}
{
LttvTraceset *traceset = self->parent.parent.ts;
- guint i, j, k, l, nb_trace, nb_tracefile;
+ guint i, j, k, nb_trace, nb_tracefile;
LttvTraceStats *ts;
GArray *hooks, *before_hooks, *after_hooks;
- LttvTraceHook *hook;
-
- LttvTraceHookByFacility *thf;
+ LttvTraceHook *th;
LttvAttributeValue val;
hn=0;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
+ LTT_EVENT_SYSCALL_ENTRY,
LTT_FIELD_SYSCALL_ID, 0, 0,
before_syscall_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
+ LTT_EVENT_SYSCALL_EXIT,
0, 0, 0,
before_syscall_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_ENTRY,
+ LTT_EVENT_TRAP_ENTRY,
LTT_FIELD_TRAP_ID, 0, 0,
before_trap_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_EXIT,
+ LTT_EVENT_TRAP_EXIT,
0, 0, 0,
before_trap_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
+ LTT_EVENT_IRQ_ENTRY,
LTT_FIELD_IRQ_ID, 0, 0,
before_irq_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
+ LTT_EVENT_IRQ_EXIT,
0, 0, 0,
before_irq_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
+ LTT_EVENT_SOFT_IRQ_ENTRY,
LTT_FIELD_SOFT_IRQ_ID, 0, 0,
before_soft_irq_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
+ LTT_EVENT_SOFT_IRQ_EXIT,
0, 0, 0,
before_soft_irq_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_SCHEDCHANGE,
- LTT_FIELD_OUT, LTT_FIELD_IN, LTT_FIELD_OUT_STATE,
+ LTT_EVENT_SCHED_SCHEDULE,
+ LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE,
before_schedchange, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_USER_GENERIC, LTT_EVENT_FUNCTION_ENTRY,
+ LTT_EVENT_FUNCTION_ENTRY,
LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE, 0,
before_function_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_USER_GENERIC, LTT_EVENT_FUNCTION_EXIT,
+ LTT_EVENT_FUNCTION_EXIT,
LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE, 0,
before_function_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
/* statedump-related hooks */
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE,
+ LTT_EVENT_PROCESS_STATE,
LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
before_enum_process_state, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
hn=0;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
+ LTT_EVENT_SYSCALL_ENTRY,
LTT_FIELD_SYSCALL_ID, 0, 0,
after_syscall_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
+ LTT_EVENT_SYSCALL_EXIT,
0, 0, 0,
after_syscall_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_ENTRY,
+ LTT_EVENT_TRAP_ENTRY,
LTT_FIELD_TRAP_ID, 0, 0,
after_trap_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_EXIT,
+ LTT_EVENT_TRAP_EXIT,
0, 0, 0,
after_trap_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
+ LTT_EVENT_IRQ_ENTRY,
LTT_FIELD_IRQ_ID, 0, 0,
after_irq_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
+ LTT_EVENT_IRQ_EXIT,
0, 0, 0,
after_irq_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
+ LTT_EVENT_SOFT_IRQ_ENTRY,
LTT_FIELD_SOFT_IRQ_ID, 0, 0,
after_irq_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
+ LTT_EVENT_SOFT_IRQ_EXIT,
0, 0, 0,
after_soft_irq_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_SCHEDCHANGE,
- LTT_FIELD_OUT, LTT_FIELD_IN, LTT_FIELD_OUT_STATE,
+ LTT_EVENT_SCHED_SCHEDULE,
+ LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE,
after_schedchange, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_FORK,
+ LTT_EVENT_PROCESS_FORK,
LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
process_fork, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_EXIT,
+ LTT_EVENT_PROCESS_EXIT,
LTT_FIELD_PID, 0, 0,
process_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_FREE,
+ LTT_EVENT_PROCESS_FREE,
LTT_FIELD_PID, 0, 0,
process_free, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_USER_GENERIC, LTT_EVENT_FUNCTION_ENTRY,
+ LTT_EVENT_FUNCTION_ENTRY,
LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE, 0,
after_function_entry, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_USER_GENERIC, LTT_EVENT_FUNCTION_EXIT,
+ LTT_EVENT_FUNCTION_EXIT,
LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE, 0,
after_function_exit, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
/* statedump-related hooks */
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE,
+ LTT_EVENT_PROCESS_STATE,
LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
after_enum_process_state, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
if(ret) hn--;
ret = lttv_trace_find_hook(ts->parent.parent.t,
- LTT_FACILITY_STATEDUMP, LTT_EVENT_STATEDUMP_END,
+ LTT_EVENT_STATEDUMP_END,
0, 0, 0,
after_statedump_end, NULL,
&g_array_index(hooks, LttvTraceHook, hn++));
LTTV_PRIO_DEFAULT);
for(k = 0 ; k < before_hooks->len ; k++) {
- hook = &g_array_index(before_hooks, LttvTraceHook, k);
- for(l = 0; l<hook->fac_list->len;l++) {
- thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
- lttv_hooks_add(
- lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
- thf->h,
- thf,
- LTTV_PRIO_STATS_BEFORE_STATE);
- }
+ th = &g_array_index(before_hooks, LttvTraceHook, k);
+ lttv_hooks_add(
+ lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+ th->h,
+ th,
+ LTTV_PRIO_STATS_BEFORE_STATE);
}
for(k = 0 ; k < after_hooks->len ; k++) {
- hook = &g_array_index(after_hooks, LttvTraceHook, k);
- for(l = 0; l<hook->fac_list->len;l++) {
- thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
- lttv_hooks_add(
- lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
- thf->h,
- thf,
- LTTV_PRIO_STATS_AFTER_STATE);
- }
+ th = &g_array_index(after_hooks, LttvTraceHook, k);
+ lttv_hooks_add(
+ lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+ th->h,
+ th,
+ LTTV_PRIO_STATS_AFTER_STATE);
}
}
lttv_attribute_find(self->parent.parent.a, LTTV_STATS_BEFORE_HOOKS,
{
LttvTraceset *traceset = self->parent.parent.ts;
- guint i, j, k, l, nb_trace, nb_tracefile;
+ guint i, j, k, nb_trace, nb_tracefile;
LttvTraceStats *ts;
LttvTracefileStats *tfs;
- void *hook_data;
-
GArray *before_hooks, *after_hooks;
- LttvTraceHook *hook;
-
- LttvTraceHookByFacility *thf;
+ LttvTraceHook *th;
LttvAttributeValue val;
NULL);
for(k = 0 ; k < before_hooks->len ; k++) {
- hook = &g_array_index(before_hooks, LttvTraceHook, k);
- for(l = 0 ; l < hook->fac_list->len ; l++) {
- thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
- lttv_hooks_remove_data(
- lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
- thf->h,
- thf);
- }
+ th = &g_array_index(before_hooks, LttvTraceHook, k);
+ lttv_hooks_remove_data(
+ lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+ th->h,
+ th);
}
for(k = 0 ; k < after_hooks->len ; k++) {
- hook = &g_array_index(after_hooks, LttvTraceHook, k);
- for(l = 0 ; l < hook->fac_list->len ; l++) {
- thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
- lttv_hooks_remove_data(
- lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
- thf->h,
- thf);
- }
+ th = &g_array_index(after_hooks, LttvTraceHook, k);
+ lttv_hooks_remove_data(
+ lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+ th->h,
+ th);
+
}
}
g_debug("lttv_stats_remove_event_hooks()");