diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-03 01:10:07 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-03 01:10:07 -0500 |
| commit | 7a53c7f56bbfc9b0ef892e68f5cfae3d902544d1 (patch) | |
| tree | 19dec256fc80ad06d631ece78b9eb68a457ce66b /tools/perf/util/trace-event-parse.c | |
| parent | e57130698fe3dd2b7d617d90bbf86474473cb40c (diff) | |
| parent | 012abeea669ea49636cf952d13298bb68654146a (diff) | |
Merge commit 'v2.6.32-rc5' into for-linus
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
| -rw-r--r-- | tools/perf/util/trace-event-parse.c | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 629e602d9405..55c9659a56e2 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
| @@ -618,7 +618,7 @@ static int test_type(enum event_type type, enum event_type expect) | |||
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | static int test_type_token(enum event_type type, char *token, | 620 | static int test_type_token(enum event_type type, char *token, |
| 621 | enum event_type expect, char *expect_tok) | 621 | enum event_type expect, const char *expect_tok) |
| 622 | { | 622 | { |
| 623 | if (type != expect) { | 623 | if (type != expect) { |
| 624 | die("Error: expected type %d but read %d", | 624 | die("Error: expected type %d but read %d", |
| @@ -650,7 +650,7 @@ static int read_expect_type(enum event_type expect, char **tok) | |||
| 650 | return __read_expect_type(expect, tok, 1); | 650 | return __read_expect_type(expect, tok, 1); |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | static int __read_expected(enum event_type expect, char *str, int newline_ok) | 653 | static int __read_expected(enum event_type expect, const char *str, int newline_ok) |
| 654 | { | 654 | { |
| 655 | enum event_type type; | 655 | enum event_type type; |
| 656 | char *token; | 656 | char *token; |
| @@ -668,12 +668,12 @@ static int __read_expected(enum event_type expect, char *str, int newline_ok) | |||
| 668 | return 0; | 668 | return 0; |
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | static int read_expected(enum event_type expect, char *str) | 671 | static int read_expected(enum event_type expect, const char *str) |
| 672 | { | 672 | { |
| 673 | return __read_expected(expect, str, 1); | 673 | return __read_expected(expect, str, 1); |
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | static int read_expected_item(enum event_type expect, char *str) | 676 | static int read_expected_item(enum event_type expect, const char *str) |
| 677 | { | 677 | { |
| 678 | return __read_expected(expect, str, 0); | 678 | return __read_expected(expect, str, 0); |
| 679 | } | 679 | } |
| @@ -1776,6 +1776,29 @@ static unsigned long long read_size(void *ptr, int size) | |||
| 1776 | } | 1776 | } |
| 1777 | } | 1777 | } |
| 1778 | 1778 | ||
| 1779 | unsigned long long | ||
| 1780 | raw_field_value(struct event *event, const char *name, void *data) | ||
| 1781 | { | ||
| 1782 | struct format_field *field; | ||
| 1783 | |||
| 1784 | field = find_any_field(event, name); | ||
| 1785 | if (!field) | ||
| 1786 | return 0ULL; | ||
| 1787 | |||
| 1788 | return read_size(data + field->offset, field->size); | ||
| 1789 | } | ||
| 1790 | |||
| 1791 | void *raw_field_ptr(struct event *event, const char *name, void *data) | ||
| 1792 | { | ||
| 1793 | struct format_field *field; | ||
| 1794 | |||
| 1795 | field = find_any_field(event, name); | ||
| 1796 | if (!field) | ||
| 1797 | return NULL; | ||
| 1798 | |||
| 1799 | return data + field->offset; | ||
| 1800 | } | ||
| 1801 | |||
| 1779 | static int get_common_info(const char *type, int *offset, int *size) | 1802 | static int get_common_info(const char *type, int *offset, int *size) |
| 1780 | { | 1803 | { |
| 1781 | struct event *event; | 1804 | struct event *event; |
| @@ -1799,7 +1822,7 @@ static int get_common_info(const char *type, int *offset, int *size) | |||
| 1799 | return 0; | 1822 | return 0; |
| 1800 | } | 1823 | } |
| 1801 | 1824 | ||
| 1802 | static int parse_common_type(void *data) | 1825 | int trace_parse_common_type(void *data) |
| 1803 | { | 1826 | { |
| 1804 | static int type_offset; | 1827 | static int type_offset; |
| 1805 | static int type_size; | 1828 | static int type_size; |
| @@ -1832,7 +1855,7 @@ static int parse_common_pid(void *data) | |||
| 1832 | return read_size(data + pid_offset, pid_size); | 1855 | return read_size(data + pid_offset, pid_size); |
| 1833 | } | 1856 | } |
| 1834 | 1857 | ||
| 1835 | static struct event *find_event(int id) | 1858 | struct event *trace_find_event(int id) |
| 1836 | { | 1859 | { |
| 1837 | struct event *event; | 1860 | struct event *event; |
| 1838 | 1861 | ||
| @@ -1945,10 +1968,11 @@ static const struct flag flags[] = { | |||
| 1945 | { "NET_TX_SOFTIRQ", 2 }, | 1968 | { "NET_TX_SOFTIRQ", 2 }, |
| 1946 | { "NET_RX_SOFTIRQ", 3 }, | 1969 | { "NET_RX_SOFTIRQ", 3 }, |
| 1947 | { "BLOCK_SOFTIRQ", 4 }, | 1970 | { "BLOCK_SOFTIRQ", 4 }, |
| 1948 | { "TASKLET_SOFTIRQ", 5 }, | 1971 | { "BLOCK_IOPOLL_SOFTIRQ", 5 }, |
| 1949 | { "SCHED_SOFTIRQ", 6 }, | 1972 | { "TASKLET_SOFTIRQ", 6 }, |
| 1950 | { "HRTIMER_SOFTIRQ", 7 }, | 1973 | { "SCHED_SOFTIRQ", 7 }, |
| 1951 | { "RCU_SOFTIRQ", 8 }, | 1974 | { "HRTIMER_SOFTIRQ", 8 }, |
| 1975 | { "RCU_SOFTIRQ", 9 }, | ||
| 1952 | 1976 | ||
| 1953 | { "HRTIMER_NORESTART", 0 }, | 1977 | { "HRTIMER_NORESTART", 0 }, |
| 1954 | { "HRTIMER_RESTART", 1 }, | 1978 | { "HRTIMER_RESTART", 1 }, |
| @@ -2420,8 +2444,8 @@ get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, | |||
| 2420 | int type; | 2444 | int type; |
| 2421 | int pid; | 2445 | int pid; |
| 2422 | 2446 | ||
| 2423 | type = parse_common_type(next->data); | 2447 | type = trace_parse_common_type(next->data); |
| 2424 | event = find_event(type); | 2448 | event = trace_find_event(type); |
| 2425 | if (!event) | 2449 | if (!event) |
| 2426 | return NULL; | 2450 | return NULL; |
| 2427 | 2451 | ||
| @@ -2502,8 +2526,8 @@ print_graph_entry_leaf(struct event *event, void *data, struct record *ret_rec) | |||
| 2502 | int type; | 2526 | int type; |
| 2503 | int i; | 2527 | int i; |
| 2504 | 2528 | ||
| 2505 | type = parse_common_type(ret_rec->data); | 2529 | type = trace_parse_common_type(ret_rec->data); |
| 2506 | ret_event = find_event(type); | 2530 | ret_event = trace_find_event(type); |
| 2507 | 2531 | ||
| 2508 | field = find_field(ret_event, "rettime"); | 2532 | field = find_field(ret_event, "rettime"); |
| 2509 | if (!field) | 2533 | if (!field) |
| @@ -2696,11 +2720,13 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs, | |||
| 2696 | nsecs -= secs * NSECS_PER_SEC; | 2720 | nsecs -= secs * NSECS_PER_SEC; |
| 2697 | usecs = nsecs / NSECS_PER_USEC; | 2721 | usecs = nsecs / NSECS_PER_USEC; |
| 2698 | 2722 | ||
| 2699 | type = parse_common_type(data); | 2723 | type = trace_parse_common_type(data); |
| 2700 | 2724 | ||
| 2701 | event = find_event(type); | 2725 | event = trace_find_event(type); |
| 2702 | if (!event) | 2726 | if (!event) { |
| 2703 | die("ug! no event found for type %d", type); | 2727 | printf("ug! no event found for type %d\n", type); |
| 2728 | return; | ||
| 2729 | } | ||
| 2704 | 2730 | ||
| 2705 | pid = parse_common_pid(data); | 2731 | pid = parse_common_pid(data); |
| 2706 | 2732 | ||
