Update FSF address
[lttv.git] / lttv / modules / text / depanalysis.c
index 0c984711b5fd7203417894b00507b99263b9c370..08cf7da4d7edd7962ab98e008f633ee3408d29da 100644 (file)
  *
  * 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.
  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#define _GNU_SOURCE
+#include <stdio.h>
 
 #include <lttv/lttv.h>
 #include <lttv/option.h>
@@ -32,8 +34,7 @@
 #include <ltt/ltt.h>
 #include <ltt/event.h>
 #include <ltt/trace.h>
-#define _GNU_SOURCE
-#include <stdio.h>
+
 #include <glib.h>
 #include <stdlib.h>
 
 static LttvHooks
   *before_traceset,
   *after_traceset,
-//  *before_trace,
   *event_hook;
 
 static int depanalysis_range_pid = -1;
 static int depanalysis_range_pid_searching = -1;
 static int depanalysis_use_time=0;
 static int depanalysis_event_limit = -1;
+static int a_print_simple_summary = 0;
 static LttTime depanalysis_time1, depanalysis_time2;
 static char *arg_t1_str,*arg_t2_str;
 static int statedump_finished = 0;
@@ -402,7 +403,6 @@ static void prepare_pop_item_commit_nocheck(struct process *p, enum llev_state s
 static void prepare_pop_item_commit(struct process *p, enum llev_state st, LttTime t)
 {
        struct process_with_state *pwstate;
-       struct sstack_item *item = sstack_item_new_pop();
 
        int push_idx;
               
@@ -454,7 +454,7 @@ static int try_pop_blocked_llev_preempted(struct process *p, LttTime t)
                pwstate = g_array_index(p->stack->array, struct sstack_item *, push_idx)->data_val;
 
                if(!(pwstate->state.bstate == LLEV_PREEMPTED && ((struct llev_state_info_preempted *)pwstate->state.private)->prev_state > 0)) {
-                       printf("double try wake up\n");
+                       //printf("double try wake up\n");
                        return 0;
                }
        }
@@ -503,14 +503,8 @@ static GString *a_string;
 
 static gboolean write_traceset_header(void *hook_data, void *call_data)
 {
-  LttvTracesetContext *tc = (LttvTracesetContext *)call_data;
-
   g_info("Traceset header");
-
-  /* Print the trace set header */
-  fprintf(a_file,"Trace set contains %d traces\n\n",
-      lttv_traceset_number(tc->ts));
-
   return FALSE;
 }
 
@@ -532,7 +526,7 @@ static void update_hlev_state(struct process *p, LttTime t)
 {
        int i;
 
-       enum hlev_state new_hlev;
+       enum hlev_state new_hlev = 0;
 
        for(i=p->stack_current; i>=0; i--) {
                enum llev_state st;
@@ -601,13 +595,13 @@ static void update_hlev_state(struct process *p, LttTime t)
                        break;
                case HLEV_BLOCKED: {
                        struct hlev_state_info_blocked *hlev_blocked_private = p->hlev_state->private;
-                       //struct process_state *ps = find_in_stack(LLEV_SYSCALL, p);
                        int syscall_pos = find_pos_in_stack(LLEV_SYSCALL, p);
                        int trap_pos = find_pos_in_stack(LLEV_TRAP, p);
 
                        /* init vals */
                        hlev_blocked_private->syscall_id = 1;
                        hlev_blocked_private->trap = 0;
+                       hlev_blocked_private->pid_exit = 0;
                        hlev_blocked_private->substate = HLEV_BLOCKED__UNDEFINED;
                        hlev_blocked_private->private = NULL;
                        hlev_blocked_private->llev_state_entry = oldstyle_stack_to_garray(p->llev_state_stack, p->stack_current);
@@ -709,7 +703,9 @@ static void print_summary_item(struct summary_tree_node *node, int depth)
        GList *vals;
 
        if(depth >= 0) {
-               printf("\t%*s (", strlen(node->name)+2*depth, node->name);
+               printf("\t%*s (", 
+                       (unsigned int)strlen(node->name)+2*depth, 
+                       node->name);
                print_time(node->duration);
                printf(") <%d>\n", node->id_for_episodes);
        }
@@ -733,19 +729,19 @@ static void print_summary_item(struct summary_tree_node *node, int depth)
 
 static inline void print_irq(int irq)
 {
-       printf("IRQ %d [%s]", irq, g_quark_to_string(g_hash_table_lookup(irq_table, &irq)));
+       printf("IRQ %d [%s]", irq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(irq_table, &irq)));
 }
 
 static inline void print_softirq(int softirq)
 {
-       printf("SoftIRQ %d [%s]", softirq, g_quark_to_string(g_hash_table_lookup(softirq_table, &softirq)));
+       printf("SoftIRQ %d [%s]", softirq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(softirq_table, &softirq)));
 }
 
 static inline void print_pid(int pid)
 {
        struct process *event_process_info = g_hash_table_lookup(process_hash_table, &pid);
 
-       char *pname;
+       const char *pname;
 
        if(event_process_info == NULL)
                pname = "?";
@@ -756,17 +752,19 @@ static inline void print_pid(int pid)
 
 static void modify_path_with_private(GArray *path, struct process_state *pstate)
 {
-       //GString tmps = g_string_new("");
        char *tmps;
+       int res;
 
        // FIXME: fix this leak
        switch(pstate->bstate) {
                case HLEV_INTERRUPTED_IRQ:
-                       asprintf(&tmps, "IRQ %d [%s]", ((struct hlev_state_info_interrupted_irq *)pstate->private)->irq, g_quark_to_string(g_hash_table_lookup(irq_table, &((struct hlev_state_info_interrupted_irq *)pstate->private)->irq)));
+                       res = asprintf(&tmps, "IRQ %d [%s]", ((struct hlev_state_info_interrupted_irq *)pstate->private)->irq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(irq_table, &((struct hlev_state_info_interrupted_irq *)pstate->private)->irq)));
+                       g_assert(res > 0);
                        g_array_append_val(path, tmps);
                        break;
                case HLEV_INTERRUPTED_SOFTIRQ:
-                       asprintf(&tmps, "SoftIRQ %d [%s]", ((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq, g_quark_to_string(g_hash_table_lookup(softirq_table, &((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq)));
+                       res = asprintf(&tmps, "SoftIRQ %d [%s]", ((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(softirq_table, &((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq)));
+                       g_assert(res > 0);
                        g_array_append_val(path, tmps);
                        break;
                case HLEV_BLOCKED: {
@@ -782,24 +780,27 @@ static void modify_path_with_private(GArray *path, struct process_state *pstate)
                                g_array_append_val(path, ptr);
                        }
                        else {
-                               asprintf(&tmps, "Syscall %d [%s]", hlev_blocked_private->syscall_id, g_quark_to_string(g_hash_table_lookup(syscall_table, &hlev_blocked_private->syscall_id)));
+                               res = asprintf(&tmps, "Syscall %d [%s]", hlev_blocked_private->syscall_id, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(syscall_table, &hlev_blocked_private->syscall_id)));
+                               g_assert(res > 0);
                                g_array_append_val(path, tmps);
                        }
 
                        if(((struct hlev_state_info_blocked *)pstate->private)->substate == HLEV_BLOCKED__OPEN) {
-                               char *str = g_quark_to_string(((struct hlev_state_info_blocked__open *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename);
+                               const char *str = g_quark_to_string(((struct hlev_state_info_blocked__open *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename);
                                g_array_append_val(path, str);
                        }
                        else if(((struct hlev_state_info_blocked *)pstate->private)->substate == HLEV_BLOCKED__READ) {
                                char *str;
-                               asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__read *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename));
+                               res = asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__read *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename));
+                               g_assert(res > 0);
                                g_array_append_val(path, str);
                                /* FIXME: this must be freed at some point */
                                //free(str);
                        }
                        else if(((struct hlev_state_info_blocked *)pstate->private)->substate == HLEV_BLOCKED__POLL) {
                                char *str;
-                               asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__poll *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename));
+                               res = asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__poll *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename));
+                               g_assert(res > 0);
                                g_array_append_val(path, str);
                                /* FIXME: this must be freed at some point */
                                //free(str);
@@ -822,7 +823,7 @@ void print_stack_garray_horizontal(GArray *stack)
 
                if(pstate->bstate == LLEV_SYSCALL) {
                        struct llev_state_info_syscall *llev_syscall_private = pstate->private;
-                       printf(" %d [%s]", llev_syscall_private->syscall_id, g_quark_to_string(g_hash_table_lookup(syscall_table, &llev_syscall_private->syscall_id)));
+                       printf(" %d [%s]", llev_syscall_private->syscall_id, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(syscall_table, &llev_syscall_private->syscall_id)));
                }
 
                printf(", ");
@@ -906,6 +907,20 @@ static struct process_state *find_state_ending_after(int pid, LttTime t)
                return g_array_index(p->hlev_history, struct process_state *, result);
 }
 
+static void print_indent(int offset)
+{
+       if (offset > 2) {
+               int i;
+
+               printf("%*s", 8, "");
+               for (i = 3; i < offset; i++) {
+                       printf("|");
+                       printf("%*s", 4, "");
+               }
+       } else
+               printf("%*s", 4*offset, "");
+}
+
 static void print_delay_pid(int pid, LttTime t1, LttTime t2, int offset)
 {
        struct process *p;
@@ -926,8 +941,8 @@ static void print_delay_pid(int pid, LttTime t1, LttTime t2, int offset)
                        state_private_blocked = pstate->private;
                        struct process_state *state_unblocked;
 
-                       printf("%*s", 8*offset, "");
-                       printf("Blocked in ");
+                       print_indent(offset);
+                       printf("--> Blocked in ");
                        print_stack_garray_horizontal(state_private_blocked->llev_state_entry);
 
                        printf("(times: ");
@@ -942,15 +957,15 @@ static void print_delay_pid(int pid, LttTime t1, LttTime t2, int offset)
                                if(state_unblocked->bstate == HLEV_INTERRUPTED_IRQ) {
                                        struct hlev_state_info_interrupted_irq *priv = state_unblocked->private;
                                        /* if in irq or softirq, we don't care what the waking process was doing because they are asynchroneous events */
-                                       printf("%*s", 8*offset, "");
-                                       printf("Woken up by an IRQ: ");
+                                       print_indent(offset);
+                                       printf("--- Woken up by an IRQ: ");
                                        print_irq(priv->irq);
                                        printf("\n");
                                }
                                else if(state_unblocked->bstate == HLEV_INTERRUPTED_SOFTIRQ) {
                                        struct hlev_state_info_interrupted_softirq *priv = state_unblocked->private;
-                                       printf("%*s", 8*offset, "");
-                                       printf("Woken up by a SoftIRQ: ");
+                                       print_indent(offset);
+                                       printf("--- Woken up by a SoftIRQ: ");
                                        print_softirq(priv->softirq);
                                        printf("\n");
                                }
@@ -964,8 +979,8 @@ static void print_delay_pid(int pid, LttTime t1, LttTime t2, int offset)
                                                t2prime = pstate->time_end;
 
                                        print_delay_pid(state_private_blocked->pid_exit, t1prime, t2prime, offset+1);
-                                       printf("%*s", 8*offset, "");
-                                       printf("Woken up in context of ");
+                                       print_indent(offset);
+                                       printf("--- Woken up in context of ");
                                        print_pid(state_private_blocked->pid_exit);
                                        if(state_private_blocked->llev_state_exit) {
                                                print_stack_garray_horizontal(state_private_blocked->llev_state_exit);
@@ -977,7 +992,7 @@ static void print_delay_pid(int pid, LttTime t1, LttTime t2, int offset)
                                }
                        }
                        else {
-                               printf("%*s", 8*offset, "");
+                               print_indent(offset);
                                printf("Weird... cannot find in what state the waker (%d) was\n", state_private_blocked->pid_exit);
                        }
 
@@ -1002,11 +1017,21 @@ static void print_range_critical_path(int process, LttTime t1, LttTime t2)
        print_delay_pid(process, t1, t2, 2);
 }
 
+/*
+ * output legend example:
+ *
+ *           --> Blocked in RUNNING, SYSCALL NNN [syscall_name]
+ *           |      ---> Blocked in RUNNING, SYSCALL NNN [syscall_name]
+ *           |      |        --> Blocked in RUNNING, SYSCALL  [syscall_name]
+ *           |      |        --- Woken up by an IRQ: IRQ 0 [timer]
+ *           |      ---  Woken up in context of PID [appname] in high-level state RUNNING
+ *           --- Woken up in context of PID [appname] in high-level state RUNNING
+ */
+
 static void print_process_critical_path_summary()
 {
        struct process *pinfo;
        GList *pinfos;
-       int i,j;
 
        pinfos = g_hash_table_get_values(process_hash_table);
        if(pinfos == NULL) {
@@ -1017,11 +1042,10 @@ static void print_process_critical_path_summary()
        printf("Process Critical Path Summary:\n");
 
        for(;;) {
-               struct summary_tree_node base_node = { children: NULL };
-
-               struct process_state *hlev_state_cur;
 
                pinfo = (struct process *)pinfos->data;
+               if (depanalysis_range_pid_searching != -1 && pinfo->pid != depanalysis_range_pid_searching)
+                       goto next_iter;
                printf("\tProcess %d [%s]\n", pinfo->pid, g_quark_to_string(pinfo->name));
 
                if(pinfo->hlev_history->len < 1)
@@ -1048,7 +1072,7 @@ gint compare_states_length(gconstpointer a, gconstpointer b)
        return val;
 }
 
-static void print_simple_summary()
+static void print_simple_summary(void)
 {
        struct process *pinfo;
        GList *pinfos;
@@ -1056,6 +1080,9 @@ static void print_simple_summary()
        int i,j;
        int id_for_episodes = 0;
 
+       if (!a_print_simple_summary)
+               return;
+
        /* we save all the nodes here to print the episodes table quickly */
        GArray *all_nodes = g_array_new(FALSE, FALSE, sizeof(struct summary_tree_node *));
 
@@ -1072,8 +1099,6 @@ static void print_simple_summary()
        for(;;) {
                struct summary_tree_node base_node = { children: NULL, name: "Root" };
 
-               struct process_state *hlev_state_cur;
-
                pinfo = (struct process *)pinfos->data;
                printf("\tProcess %d [%s]\n", pinfo->pid, g_quark_to_string(pinfo->name));
 
@@ -1179,8 +1204,6 @@ static void print_simple_summary_pid_range(int pid, LttTime t1, LttTime t2)
        {
                struct summary_tree_node base_node = { children: NULL, name: "Root" };
 
-               struct process_state *hlev_state_cur;
-
                printf("\tProcess %d [%s]\n", pinfo->pid, g_quark_to_string(pinfo->name));
 
                /* For each state in the process history */
@@ -1340,7 +1363,7 @@ void print_range_reports(int pid, LttTime t1, LttTime t2)
                else
                        iter_t2 = g_array_index(family, struct family_item, i-1).creation;
 
-               printf("This section of summary concerns pid %d between ");
+               printf("This section of summary concerns pid %d between ", iter_pid);
                print_time(iter_t1);
                printf(" and ");
                print_time(iter_t2);
@@ -1352,16 +1375,7 @@ void print_range_reports(int pid, LttTime t1, LttTime t2)
 
 static gboolean write_traceset_footer(void *hook_data, void *call_data)
 {
-       LttvTracesetContext *tc = (LttvTracesetContext *)call_data;
-
-       g_info("TextDump traceset footer");
-
-       fprintf(a_file,"End trace set\n\n");
-
-//     if(LTTV_IS_TRACESET_STATS(tc)) {
-//             lttv_stats_sum_traceset((LttvTracesetStats *)tc, ltt_time_infinite);
-//             print_stats(a_file, (LttvTracesetStats *)tc);
-//     }
+       g_info("depanalysis traceset footer");
 
        /* After processing all the events, we need to flush the sstacks
          * because some unfinished states may remain in them. We want them
@@ -1372,8 +1386,8 @@ static gboolean write_traceset_footer(void *hook_data, void *call_data)
        /* print the reports */
        print_simple_summary();
        print_process_critical_path_summary();
-       printf("depanalysis_use_time = %d\n", depanalysis_use_time);
        if(depanalysis_use_time == 3) {
+               printf("depanalysis_use_time = %d\n", depanalysis_use_time);
                if(depanalysis_range_pid == -1 && depanalysis_range_pid_searching >= 0)
                        depanalysis_range_pid = depanalysis_range_pid_searching;
 
@@ -1387,28 +1401,9 @@ static gboolean write_traceset_footer(void *hook_data, void *call_data)
   return FALSE;
 }
 
-#if 0
-static gboolean write_trace_header(void *hook_data, void *call_data)
-{
-  LttvTraceContext *tc = (LttvTraceContext *)call_data;
-#if 0 //FIXME
-  LttSystemDescription *system = ltt_trace_system_description(tc->t);
-
-  fprintf(a_file,"  Trace from %s in %s\n%s\n\n",
-         ltt_trace_system_description_node_name(system),
-         ltt_trace_system_description_domain_name(system),
-         ltt_trace_system_description_description(system));
-#endif //0
-  return FALSE;
-}
-#endif
-
 
 static int write_event_content(void *hook_data, void *call_data)
 {
-  gboolean result;
-
-//  LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
 
@@ -1465,8 +1460,9 @@ static char *field_get_value_string(struct LttEvent *e, struct marker_info *info
        return ltt_event_get_string(e, marker_field);
 }
 
-void process_delayed_stack_action(struct process *pinfo, struct sstack_item *item)
+void process_delayed_stack_action(void *arg, struct sstack_item *item)
 {
+       struct process *pinfo = (struct process *)arg;
        //printf("processing delayed stack action on pid %d at ", pinfo->pid);
        //if(((struct process_with_state *) item->data_val)->state.time_begin.tv_nsec == 987799696)
        //      printf("HERE!!!\n");
@@ -1519,7 +1515,8 @@ void process_delayed_stack_action(struct process *pinfo, struct sstack_item *ite
 
 static struct process *get_or_init_process_info(struct LttEvent *e, GQuark name, int pid, int *new)
 {
-       gconstpointer val;
+       //gconstpointer val;
+       gpointer val;
 
        val = g_hash_table_lookup(process_hash_table, &pid);
        if(val == NULL) {
@@ -1574,12 +1571,12 @@ static int process_event(void *hook_data, void *call_data)
        LttvTracefileState *tfs = (LttvTracefileState *)call_data;
        LttEvent *e;
        struct marker_info *info;
+       int res;
 
        /* Extract data from event structures and state */
        guint cpu = tfs->cpu;
        LttvTraceState *ts = (LttvTraceState*)tfc->t_context;
        LttvProcessState *process = ts->running_process[cpu];
-       LttTrace *trace = ts->parent.t;
        struct process *pinfo;
 
        e = ltt_tracefile_get_event(tfs->parent.tf);
@@ -1618,7 +1615,7 @@ static int process_event(void *hook_data, void *call_data)
 
                *pint = field_get_value_int(e, info, LTT_FIELD_ID);
                q = g_quark_from_string(field_get_value_string(e, info, LTT_FIELD_SYMBOL));
-               g_hash_table_insert(syscall_table, pint, q);
+               g_hash_table_insert(syscall_table, pint, (gpointer)(unsigned long)q);
        }
        else if(tfc->tf->name == LTT_CHANNEL_IRQ_STATE && info->name == LTT_EVENT_LIST_INTERRUPT) {
                GQuark q;
@@ -1626,7 +1623,7 @@ static int process_event(void *hook_data, void *call_data)
 
                *pint = field_get_value_int(e, info, LTT_FIELD_IRQ_ID);
                q = g_quark_from_string(field_get_value_string(e, info, LTT_FIELD_ACTION));
-               g_hash_table_insert(irq_table, pint, q);
+               g_hash_table_insert(irq_table, pint, (gpointer)(unsigned long)q);
        }
        else if(tfc->tf->name == LTT_CHANNEL_SOFTIRQ_STATE && info->name == LTT_EVENT_SOFTIRQ_VEC) {
                GQuark q;
@@ -1634,7 +1631,7 @@ static int process_event(void *hook_data, void *call_data)
 
                *pint = field_get_value_int(e, info, LTT_FIELD_ID);
                q = g_quark_from_string(field_get_value_string(e, info, LTT_FIELD_SYMBOL));
-               g_hash_table_insert(softirq_table, pint, q);
+               g_hash_table_insert(softirq_table, pint, (gpointer)(unsigned long)q);
        }
 
 
@@ -1725,7 +1722,7 @@ static int process_event(void *hook_data, void *call_data)
        }
        else if(tfc->tf->name == LTT_CHANNEL_KERNEL && info->name == LTT_EVENT_PROCESS_FORK) {
                int pid = differentiate_swappers(field_get_value_int(e, info, LTT_FIELD_CHILD_PID), e);
-               struct process *event_process_info = get_or_init_process_info(e, process->name, differentiate_swappers(field_get_value_int(e, info, LTT_FIELD_CHILD_PID), e), NULL);
+               struct process *event_process_info = get_or_init_process_info(e, process->name, pid, NULL);
                struct sstack_item *item;
 
                event_process_info->parent = process->pid;
@@ -1808,13 +1805,14 @@ static int process_event(void *hook_data, void *call_data)
                llev_syscall_read_private = llev_syscall_private->private;
 
                fd = field_get_value_int(e, info, LTT_FIELD_FD);
-               pfileq = g_hash_table_lookup(process->fds, fd);
+               pfileq = (GQuark)(unsigned long)g_hash_table_lookup(process->fds, &fd);
                if(pfileq) {
                        llev_syscall_read_private->filename = pfileq;
                }
                else {
                        char *tmp;
-                       asprintf(&tmp, "Unknown filename, fd %d", fd);
+                       res = asprintf(&tmp, "Unknown filename, fd %d", fd);
+                       g_assert(res > 0);
                        llev_syscall_read_private->filename = g_quark_from_string(tmp);
                        free(tmp);
                }
@@ -1854,13 +1852,14 @@ static int process_event(void *hook_data, void *call_data)
                llev_syscall_poll_private = llev_syscall_private->private;
 
                fd = field_get_value_int(e, info, LTT_FIELD_FD);
-               pfileq = g_hash_table_lookup(process->fds, fd);
+               pfileq = (GQuark)(unsigned long)g_hash_table_lookup(process->fds, &fd);
                if(pfileq) {
                        llev_syscall_poll_private->filename = pfileq;
                }
                else {
                        char *tmp;
-                       asprintf(&tmp, "Unknown filename, fd %d", fd);
+                       res = asprintf(&tmp, "Unknown filename, fd %d", fd);
+                       g_assert(res > 0);
                        llev_syscall_poll_private->filename = g_quark_from_string(tmp);
                        free(tmp);
                }
@@ -1906,7 +1905,6 @@ static int process_event(void *hook_data, void *call_data)
        }
 
        next_iter:
-       skip_state_machine:
        return FALSE;
 }
 
@@ -1965,6 +1963,10 @@ static void arg_limit(void *hook_data)
 {
 }
 
+static void arg_sum(void *hook_data)
+{
+}
+
 static void init()
 {
   gboolean result;
@@ -1985,6 +1987,8 @@ static void init()
       LTTV_OPT_INT, &depanalysis_range_pid_searching, arg_pid, NULL);
   lttv_option_add("limit-events", 0, "dependency limit event count", "count",
       LTTV_OPT_INT, &depanalysis_event_limit, arg_limit, NULL);
+  lttv_option_add("print-summary", 0, "print simple summary", "sum",
+      LTTV_OPT_INT, &a_print_simple_summary, arg_sum, NULL);
 
   process_hash_table = g_hash_table_new(g_int_hash, g_int_equal);
   syscall_table = g_hash_table_new(g_int_hash, g_int_equal);
@@ -2000,13 +2004,6 @@ static void init()
   g_assert(event_hook);
   lttv_hooks_add(event_hook, process_event, NULL, LTTV_PRIO_DEFAULT);
 
-//  result = lttv_iattribute_find_by_path(attributes, "hooks/trace/before",
-//      LTTV_POINTER, &value);
-//  g_assert(result);
-//  before_trace = *(value.v_pointer);
-//  g_assert(before_trace);
-//  lttv_hooks_add(before_trace, write_trace_header, NULL, LTTV_PRIO_DEFAULT);
-//
   result = lttv_iattribute_find_by_path(attributes, "hooks/traceset/before",
       LTTV_POINTER, &value);
   g_assert(result);
@@ -2030,6 +2027,7 @@ static void destroy()
   lttv_option_remove("dep-time-end");
   lttv_option_remove("dep-pid");
   lttv_option_remove("limit-events");
+  lttv_option_remove("print-summary");
 
   g_hash_table_destroy(process_hash_table);
   g_hash_table_destroy(syscall_table);
@@ -2039,7 +2037,7 @@ static void destroy()
   g_string_free(a_string, TRUE);
 
   lttv_hooks_remove_data(event_hook, write_event_content, NULL);
-//  lttv_hooks_remove_data(before_trace, write_trace_header, NULL);
+
   lttv_hooks_remove_data(before_traceset, write_traceset_header, NULL);
   lttv_hooks_remove_data(after_traceset, write_traceset_footer, NULL);
 }
This page took 0.043132 seconds and 4 git commands to generate.