bugfix pretty-printing and begin kprobes
authorJulien Desfossez <jdesfossez@efficios.com>
Mon, 27 Aug 2012 21:30:22 +0000 (17:30 -0400)
committerJulien Desfossez <jdesfossez@efficios.com>
Sat, 19 Oct 2013 16:02:38 +0000 (12:02 -0400)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/cursesdisplay.c
src/cursesdisplay.h
src/lttngtop.c

index 5ef175248e781ad11a749cfa13a6086744f94512..97069fe10299347334db8104ca36a45dc233112e 100644 (file)
@@ -520,6 +520,30 @@ gint sort_by_cpu_group_by_threads_desc(gconstpointer p1, gconstpointer p2)
        return -1;
 }
 
+void update_kprobes_display()
+{
+       int i, column;
+
+       set_window_title(center, "Kprobes Top");
+       /*
+       wattron(center, A_BOLD);
+       column = 1;
+       for (i = 0; i < 6; i++) {
+               if (toggle_virt < 0 && (i == 3 || i == 4)) {
+                       continue;
+               }
+               if (cputopview[i].sort) {
+                       wattron(center, A_UNDERLINE);
+                       pref_current_sort = i;
+               }
+               mvwprintw(center, 1, column, cputopview[i].title);
+               wattroff(center, A_UNDERLINE);
+               column += 10;
+       }
+       wattroff(center, A_BOLD);
+       */
+}
+
 void update_cputop_display()
 {
        int i;
@@ -993,6 +1017,9 @@ void update_current_view()
        case tree:
                update_cputop_display();
                break;
+       case kprobes:
+               update_kprobes_display();
+               break;
        default:
                break;
        }
@@ -1551,6 +1578,13 @@ void *handle_keyboard(void *p)
                        selected_line = 0;
                        update_current_view();
                        break;
+               case KEY_F(5):
+                       if (pref_panel_visible)
+                               toggle_pref_panel();
+                       current_view = kprobes;
+                       selected_line = 0;
+                       update_current_view();
+                       break;
                case KEY_F(10):
                case 'q':
                        reset_ncurses();
index fac262900b288b388c97a419b1faf6bab8a2fb30..82877f993e13908c8a757a00b3bb04f7865fb3b8 100644 (file)
@@ -29,6 +29,7 @@ enum view_list
        process_details,
        iostream,
        tree,
+       kprobes,
 };
 
 enum view_list current_view;
index 9c8cd17cf45d51491bc22fb30db3035482967e3d..87a4043adb6f70f5bb34bec34d72892ae0dcb848 100644 (file)
@@ -181,7 +181,7 @@ void print_fields(struct bt_ctf_event *event)
                        printf("%s", bt_ctf_get_string(list[i]));
                } else if (type == CTF_TYPE_ARRAY) {
                        str = bt_ctf_get_char_array(list[i]);
-                       if (str)
+                       if (!bt_ctf_field_get_error() && str)
                                printf("%s", str);
                }
        }
@@ -223,7 +223,7 @@ enum bt_cb_ret print_timestamp(struct bt_ctf_event *call_data, void *private_dat
        cpu_id = get_cpu_id(call_data);
        procname = get_context_comm(call_data);
 
-       if (strcmp(bt_ctf_event_name(call_data), "exit_syscall") == 0) {
+       if ((strcmp(bt_ctf_event_name(call_data), "exit_syscall") == 0) && !last_textdump_print_newline) {
                scope = bt_ctf_get_top_level_scope(call_data,
                                BT_EVENT_FIELDS);
                syscall_ret = bt_ctf_get_int64(bt_ctf_get_field(call_data,
@@ -241,13 +241,12 @@ enum bt_cb_ret print_timestamp(struct bt_ctf_event *call_data, void *private_dat
                                bt_ctf_event_name(call_data));
                print_fields(call_data);
                printf(") ");
-               /*
-               if (strncmp(bt_ctf_event_name(call_data), "sys_", 4) == 0) {
-               } else {
+               if (strncmp(bt_ctf_event_name(call_data), "sys_", 4) != 0) {
                        printf("\n");
+                       last_textdump_print_newline = 1;
+               } else {
+                       last_textdump_print_newline = 0;
                }
-               */
-               last_textdump_print_newline = 0;
        }
 
 end:
@@ -625,7 +624,7 @@ void iter_trace(struct bt_context *bt_ctx)
                                NULL, NULL, NULL);
        }
 
-       while ((event = bt_ctf_iter_read_event(iter, NULL)) != NULL) {
+       while ((event = bt_ctf_iter_read_event(iter)) != NULL) {
                if (quit || reload_trace)
                        goto end_iter;
                ret = bt_iter_next(bt_ctf_get_iter(iter));
@@ -1071,6 +1070,7 @@ int setup_live_tracing()
                goto error_session;
        }
 
+       memset(&ev, '\0', sizeof(struct lttng_event));
        ev.type = LTTNG_EVENT_SYSCALL;
        if ((ret = lttng_enable_event(handle, &ev, channel_name)) < 0) {
                fprintf(stderr,"error enabling syscalls : %s\n",
@@ -1078,6 +1078,20 @@ int setup_live_tracing()
                goto error_session;
        }
 
+       /*
+       memset(&ev, '\0', sizeof(struct lttng_event));
+       ev.type = LTTNG_EVENT_PROBE;
+       sprintf(ev.attr.probe.symbol_name, "sys_open");
+       sprintf(ev.name, "probe_sys_open");
+       ev.attr.probe.addr = 0;
+       ev.attr.probe.offset = 0;
+       if ((ret = lttng_enable_event(handle, &ev, channel_name)) < 0) {
+               fprintf(stderr,"error enabling kprobes : %s\n",
+                               helper_lttcomm_get_readable_code(ret));
+               goto error_session;
+       }
+       */
+
        kctxpid.ctx = LTTNG_EVENT_CONTEXT_PID;
        lttng_add_context(handle, &kctxpid, NULL, NULL);
        kctxtid.ctx = LTTNG_EVENT_CONTEXT_TID;
This page took 0.026558 seconds and 4 git commands to generate.