diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-06-14 20:09:19 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-06-14 20:09:19 -0400 |
commit | a06b4a35cf29205d4c17da6c8f6fbc63b503b68f (patch) | |
tree | e606ac507a499c1def6ae4341d0ebfe59e058edf /kernel-shark.c | |
parent | f9c3158cafeb176f2c8e39103dfab835f0ee4c40 (diff) |
kernelshark: Add "capture" feature
This is the start of code to allow kernelshark to be used to capture data.
This patch also introduced threaded tasks in reading the trace-cmd output.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel-shark.c')
-rw-r--r-- | kernel-shark.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/kernel-shark.c b/kernel-shark.c index 2f2d968..7c0f816 100644 --- a/kernel-shark.c +++ b/kernel-shark.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <getopt.h> | 31 | #include <getopt.h> |
32 | 32 | ||
33 | #include "trace-compat.h" | 33 | #include "trace-compat.h" |
34 | #include "trace-capture.h" | ||
34 | #include "trace-cmd.h" | 35 | #include "trace-cmd.h" |
35 | #include "trace-gui.h" | 36 | #include "trace-gui.h" |
36 | #include "kernel-shark.h" | 37 | #include "kernel-shark.h" |
@@ -1494,6 +1495,9 @@ void kernel_shark(int argc, char **argv) | |||
1494 | int ret; | 1495 | int ret; |
1495 | int c; | 1496 | int c; |
1496 | 1497 | ||
1498 | g_thread_init(NULL); | ||
1499 | gdk_threads_init(); | ||
1500 | |||
1497 | gtk_init(&argc, &argv); | 1501 | gtk_init(&argc, &argv); |
1498 | 1502 | ||
1499 | while ((c = getopt(argc, argv, "hvi:")) != -1) { | 1503 | while ((c = getopt(argc, argv, "hvi:")) != -1) { |
@@ -1889,6 +1893,36 @@ void kernel_shark(int argc, char **argv) | |||
1889 | 1893 | ||
1890 | 1894 | ||
1891 | 1895 | ||
1896 | /* --- Capture Option --- */ | ||
1897 | |||
1898 | menu_item = gtk_menu_item_new_with_label("Capture"); | ||
1899 | gtk_widget_show(menu_item); | ||
1900 | |||
1901 | gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), menu_item); | ||
1902 | |||
1903 | menu = gtk_menu_new(); /* Don't need to show menus */ | ||
1904 | |||
1905 | |||
1906 | |||
1907 | /* --- Capture - Record Option --- */ | ||
1908 | |||
1909 | sub_item = gtk_menu_item_new_with_label("Record"); | ||
1910 | |||
1911 | /* Add them to the menu */ | ||
1912 | gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); | ||
1913 | |||
1914 | /* We can attach the Quit menu item to our exit function */ | ||
1915 | g_signal_connect_swapped (G_OBJECT (sub_item), "activate", | ||
1916 | G_CALLBACK (tracecmd_capture_clicked), | ||
1917 | (gpointer) info); | ||
1918 | |||
1919 | /* We do need to show menu items */ | ||
1920 | gtk_widget_show(sub_item); | ||
1921 | |||
1922 | /* --- End Capture Options --- */ | ||
1923 | gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); | ||
1924 | |||
1925 | |||
1892 | /* --- Help Option --- */ | 1926 | /* --- Help Option --- */ |
1893 | 1927 | ||
1894 | menu_item = gtk_menu_item_new_with_label("Help"); | 1928 | menu_item = gtk_menu_item_new_with_label("Help"); |
@@ -2049,7 +2083,10 @@ void kernel_shark(int argc, char **argv) | |||
2049 | gtk_widget_set_size_request(window, TRACE_WIDTH, TRACE_HEIGHT); | 2083 | gtk_widget_set_size_request(window, TRACE_WIDTH, TRACE_HEIGHT); |
2050 | 2084 | ||
2051 | gtk_widget_show (window); | 2085 | gtk_widget_show (window); |
2086 | |||
2087 | gdk_threads_enter(); | ||
2052 | gtk_main (); | 2088 | gtk_main (); |
2089 | gdk_threads_leave(); | ||
2053 | } | 2090 | } |
2054 | 2091 | ||
2055 | int main(int argc, char **argv) | 2092 | int main(int argc, char **argv) |