diff options
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 629e602d9405..f6a8437141c8 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -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 | ||
@@ -2420,8 +2443,8 @@ get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, | |||
2420 | int type; | 2443 | int type; |
2421 | int pid; | 2444 | int pid; |
2422 | 2445 | ||
2423 | type = parse_common_type(next->data); | 2446 | type = trace_parse_common_type(next->data); |
2424 | event = find_event(type); | 2447 | event = trace_find_event(type); |
2425 | if (!event) | 2448 | if (!event) |
2426 | return NULL; | 2449 | return NULL; |
2427 | 2450 | ||
@@ -2502,8 +2525,8 @@ print_graph_entry_leaf(struct event *event, void *data, struct record *ret_rec) | |||
2502 | int type; | 2525 | int type; |
2503 | int i; | 2526 | int i; |
2504 | 2527 | ||
2505 | type = parse_common_type(ret_rec->data); | 2528 | type = trace_parse_common_type(ret_rec->data); |
2506 | ret_event = find_event(type); | 2529 | ret_event = trace_find_event(type); |
2507 | 2530 | ||
2508 | field = find_field(ret_event, "rettime"); | 2531 | field = find_field(ret_event, "rettime"); |
2509 | if (!field) | 2532 | if (!field) |
@@ -2696,11 +2719,13 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs, | |||
2696 | nsecs -= secs * NSECS_PER_SEC; | 2719 | nsecs -= secs * NSECS_PER_SEC; |
2697 | usecs = nsecs / NSECS_PER_USEC; | 2720 | usecs = nsecs / NSECS_PER_USEC; |
2698 | 2721 | ||
2699 | type = parse_common_type(data); | 2722 | type = trace_parse_common_type(data); |
2700 | 2723 | ||
2701 | event = find_event(type); | 2724 | event = trace_find_event(type); |
2702 | if (!event) | 2725 | if (!event) { |
2703 | die("ug! no event found for type %d", type); | 2726 | printf("ug! no event found for type %d\n", type); |
2727 | return; | ||
2728 | } | ||
2704 | 2729 | ||
2705 | pid = parse_common_pid(data); | 2730 | pid = parse_common_pid(data); |
2706 | 2731 | ||