diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-02-17 20:33:39 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-17 20:33:39 -0500 |
commit | d1416b81130c27f35bf79e7a84c9d3c2a79d3174 (patch) | |
tree | 5738082f8479d0d33a7bbdfbb0d948df2177483d /trace-graph.c | |
parent | 667fae1868c7d94c290e74aaaeed1a0f265f830e (diff) |
trace-graph: Add advanced event filter
Add the menu and implementation to perform advance event filtering
on the trace-graph.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-graph.c')
-rw-r--r-- | trace-graph.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/trace-graph.c b/trace-graph.c index 8283824..e83bf27 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "trace-hash.h" | 32 | #include "trace-hash.h" |
33 | #include "trace-filter.h" | 33 | #include "trace-filter.h" |
34 | 34 | ||
35 | #include "util.h" | ||
36 | |||
35 | #define DEBUG_LEVEL 0 | 37 | #define DEBUG_LEVEL 0 |
36 | #if DEBUG_LEVEL > 0 | 38 | #if DEBUG_LEVEL > 0 |
37 | # define dprintf(l, x...) \ | 39 | # define dprintf(l, x...) \ |
@@ -1752,6 +1754,48 @@ void trace_graph_event_filter_callback(gboolean accept, | |||
1752 | redraw_graph(ginfo); | 1754 | redraw_graph(ginfo); |
1753 | } | 1755 | } |
1754 | 1756 | ||
1757 | void trace_graph_adv_filter_callback(gboolean accept, | ||
1758 | const gchar *text, | ||
1759 | gint *event_ids, | ||
1760 | gpointer data) | ||
1761 | { | ||
1762 | struct graph_info *ginfo = data; | ||
1763 | struct event_filter *event_filter; | ||
1764 | char *error_str; | ||
1765 | int ret; | ||
1766 | int i; | ||
1767 | |||
1768 | if (!accept) | ||
1769 | return; | ||
1770 | |||
1771 | if (!has_text(text) && !event_ids) | ||
1772 | return; | ||
1773 | |||
1774 | event_filter = ginfo->event_filter; | ||
1775 | |||
1776 | if (event_ids) { | ||
1777 | for (i = 0; event_ids[i] >= 0; i++) | ||
1778 | pevent_filter_remove_event(event_filter, event_ids[i]); | ||
1779 | } | ||
1780 | |||
1781 | if (has_text(text)) { | ||
1782 | |||
1783 | ginfo->all_events = FALSE; | ||
1784 | |||
1785 | pevent_filter_clear_trivial(event_filter, | ||
1786 | FILTER_TRIVIAL_BOTH); | ||
1787 | |||
1788 | ret = pevent_filter_add_filter_str(event_filter, text, &error_str); | ||
1789 | if (ret < 0) { | ||
1790 | warning("filter failed due to: %s", error_str); | ||
1791 | free(error_str); | ||
1792 | return; | ||
1793 | } | ||
1794 | } | ||
1795 | |||
1796 | redraw_graph(ginfo); | ||
1797 | } | ||
1798 | |||
1755 | static void redraw_pixmap_backend(struct graph_info *ginfo) | 1799 | static void redraw_pixmap_backend(struct graph_info *ginfo) |
1756 | { | 1800 | { |
1757 | GdkPixmap *old_pix; | 1801 | GdkPixmap *old_pix; |