diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-10-14 13:24:19 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-10-14 13:24:19 -0400 |
commit | cc3028478d22ce3e90391738d48750b510090ffb (patch) | |
tree | 7ffd0caf7e84035463a5a8311aeb0380e29dbd89 | |
parent | 0c5718631784e62ab18d481ce87132ad297e6089 (diff) |
port over changes from perf
Frederic Weisbecker added a bunch of changes to the perf code. This
is a port of his work to trace-cmd.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
-rw-r--r-- | parse-events.c | 345 | ||||
-rw-r--r-- | parse-events.h | 19 | ||||
-rw-r--r-- | trace-cmd.c | 2 | ||||
-rw-r--r-- | trace-read.c | 14 |
4 files changed, 230 insertions, 150 deletions
diff --git a/parse-events.c b/parse-events.c index 637d512..eb0812f 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -80,7 +80,7 @@ static int cmdline_cmp(const void *a, const void *b) | |||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | void parse_cmdlines(char *file, int size) | 83 | void parse_cmdlines(char *file, int size __unused) |
84 | { | 84 | { |
85 | struct cmdline_list { | 85 | struct cmdline_list { |
86 | struct cmdline_list *next; | 86 | struct cmdline_list *next; |
@@ -88,14 +88,14 @@ void parse_cmdlines(char *file, int size) | |||
88 | int pid; | 88 | int pid; |
89 | } *list = NULL, *item; | 89 | } *list = NULL, *item; |
90 | char *line; | 90 | char *line; |
91 | char *next; | 91 | char *next = NULL; |
92 | int i; | 92 | int i; |
93 | 93 | ||
94 | line = strtok_r(file, "\n", &next); | 94 | line = strtok_r(file, "\n", &next); |
95 | while (line) { | 95 | while (line) { |
96 | item = malloc_or_die(sizeof(*item)); | 96 | item = malloc_or_die(sizeof(*item)); |
97 | sscanf(line, "%d %as", &item->pid, | 97 | sscanf(line, "%d %as", &item->pid, |
98 | &item->comm); | 98 | &item->comm); /* workaround gcc warning */ |
99 | item->next = list; | 99 | item->next = list; |
100 | list = item; | 100 | list = item; |
101 | line = strtok_r(NULL, "\n", &next); | 101 | line = strtok_r(NULL, "\n", &next); |
@@ -155,7 +155,7 @@ static int func_cmp(const void *a, const void *b) | |||
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | 157 | ||
158 | void parse_proc_kallsyms(char *file, unsigned int size) | 158 | void parse_proc_kallsyms(char *file, unsigned int size __unused) |
159 | { | 159 | { |
160 | struct func_list { | 160 | struct func_list { |
161 | struct func_list *next; | 161 | struct func_list *next; |
@@ -164,7 +164,7 @@ void parse_proc_kallsyms(char *file, unsigned int size) | |||
164 | char *mod; | 164 | char *mod; |
165 | } *list = NULL, *item; | 165 | } *list = NULL, *item; |
166 | char *line; | 166 | char *line; |
167 | char *next; | 167 | char *next = NULL; |
168 | char *addr_str; | 168 | char *addr_str; |
169 | char ch; | 169 | char ch; |
170 | int ret; | 170 | int ret; |
@@ -185,7 +185,7 @@ void parse_proc_kallsyms(char *file, unsigned int size) | |||
185 | /* truncate the extra ']' */ | 185 | /* truncate the extra ']' */ |
186 | if (item->mod) | 186 | if (item->mod) |
187 | item->mod[strlen(item->mod) - 1] = 0; | 187 | item->mod[strlen(item->mod) - 1] = 0; |
188 | 188 | ||
189 | 189 | ||
190 | item->next = list; | 190 | item->next = list; |
191 | list = item; | 191 | list = item; |
@@ -254,7 +254,7 @@ void print_funcs(void) | |||
254 | { | 254 | { |
255 | int i; | 255 | int i; |
256 | 256 | ||
257 | for (i = 0; i < func_count; i++) { | 257 | for (i = 0; i < (int)func_count; i++) { |
258 | printf("%016llx %s", | 258 | printf("%016llx %s", |
259 | func_list[i].addr, | 259 | func_list[i].addr, |
260 | func_list[i].func); | 260 | func_list[i].func); |
@@ -297,7 +297,7 @@ static struct printk_map *find_printk(unsigned long long addr) | |||
297 | return printk; | 297 | return printk; |
298 | } | 298 | } |
299 | 299 | ||
300 | void parse_ftrace_printk(char *file, unsigned int size) | 300 | void parse_ftrace_printk(char *file, unsigned int size __unused) |
301 | { | 301 | { |
302 | struct printk_list { | 302 | struct printk_list { |
303 | struct printk_list *next; | 303 | struct printk_list *next; |
@@ -305,7 +305,7 @@ void parse_ftrace_printk(char *file, unsigned int size) | |||
305 | char *printk; | 305 | char *printk; |
306 | } *list = NULL, *item; | 306 | } *list = NULL, *item; |
307 | char *line; | 307 | char *line; |
308 | char *next; | 308 | char *next = NULL; |
309 | char *addr_str; | 309 | char *addr_str; |
310 | char *fmt; | 310 | char *fmt; |
311 | int i; | 311 | int i; |
@@ -342,14 +342,14 @@ void print_printk(void) | |||
342 | { | 342 | { |
343 | int i; | 343 | int i; |
344 | 344 | ||
345 | for (i = 0; i < printk_count; i++) { | 345 | for (i = 0; i < (int)printk_count; i++) { |
346 | printf("%016llx %s\n", | 346 | printf("%016llx %s\n", |
347 | printk_list[i].addr, | 347 | printk_list[i].addr, |
348 | printk_list[i].printk); | 348 | printk_list[i].printk); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | struct event *alloc_event(void) | 352 | static struct event *alloc_event(void) |
353 | { | 353 | { |
354 | struct event *event; | 354 | struct event *event; |
355 | 355 | ||
@@ -364,9 +364,9 @@ enum event_type { | |||
364 | EVENT_NONE, | 364 | EVENT_NONE, |
365 | EVENT_SPACE, | 365 | EVENT_SPACE, |
366 | EVENT_NEWLINE, | 366 | EVENT_NEWLINE, |
367 | EVENT_ITEM, | ||
368 | EVENT_OP, | 367 | EVENT_OP, |
369 | EVENT_DELIM, | 368 | EVENT_DELIM, |
369 | EVENT_ITEM, | ||
370 | EVENT_DQUOTE, | 370 | EVENT_DQUOTE, |
371 | EVENT_SQUOTE, | 371 | EVENT_SQUOTE, |
372 | }; | 372 | }; |
@@ -382,16 +382,15 @@ static void add_event(struct event *event) | |||
382 | static int event_item_type(enum event_type type) | 382 | static int event_item_type(enum event_type type) |
383 | { | 383 | { |
384 | switch (type) { | 384 | switch (type) { |
385 | case EVENT_ITEM: | 385 | case EVENT_ITEM ... EVENT_SQUOTE: |
386 | case EVENT_DQUOTE: | ||
387 | case EVENT_SQUOTE: | ||
388 | return 1; | 386 | return 1; |
387 | case EVENT_ERROR ... EVENT_DELIM: | ||
389 | default: | 388 | default: |
390 | return 0; | 389 | return 0; |
391 | } | 390 | } |
392 | } | 391 | } |
393 | 392 | ||
394 | void free_arg(struct print_arg *arg) | 393 | static void free_arg(struct print_arg *arg) |
395 | { | 394 | { |
396 | if (!arg) | 395 | if (!arg) |
397 | return; | 396 | return; |
@@ -401,6 +400,8 @@ void free_arg(struct print_arg *arg) | |||
401 | if (arg->atom.atom) | 400 | if (arg->atom.atom) |
402 | free(arg->atom.atom); | 401 | free(arg->atom.atom); |
403 | break; | 402 | break; |
403 | case PRINT_NULL: | ||
404 | case PRINT_FIELD ... PRINT_OP: | ||
404 | default: | 405 | default: |
405 | /* todo */ | 406 | /* todo */ |
406 | break; | 407 | break; |
@@ -409,7 +410,7 @@ void free_arg(struct print_arg *arg) | |||
409 | free(arg); | 410 | free(arg); |
410 | } | 411 | } |
411 | 412 | ||
412 | enum event_type get_type(int ch) | 413 | static enum event_type get_type(int ch) |
413 | { | 414 | { |
414 | if (ch == '\n') | 415 | if (ch == '\n') |
415 | return EVENT_NEWLINE; | 416 | return EVENT_NEWLINE; |
@@ -445,7 +446,7 @@ static int __peek_char(void) | |||
445 | return input_buf[input_buf_ptr]; | 446 | return input_buf[input_buf_ptr]; |
446 | } | 447 | } |
447 | 448 | ||
448 | enum event_type __read_token(char **tok) | 449 | static enum event_type __read_token(char **tok) |
449 | { | 450 | { |
450 | char buf[BUFSIZ]; | 451 | char buf[BUFSIZ]; |
451 | int ch, last_ch, quote_ch, next_ch; | 452 | int ch, last_ch, quote_ch, next_ch; |
@@ -497,11 +498,15 @@ enum event_type __read_token(char **tok) | |||
497 | case '>': | 498 | case '>': |
498 | case '<': | 499 | case '<': |
499 | goto test_equal; | 500 | goto test_equal; |
501 | default: | ||
502 | break; | ||
500 | } | 503 | } |
501 | break; | 504 | break; |
502 | case '!': | 505 | case '!': |
503 | case '=': | 506 | case '=': |
504 | goto test_equal; | 507 | goto test_equal; |
508 | default: /* what should we do instead? */ | ||
509 | break; | ||
505 | } | 510 | } |
506 | buf[i] = 0; | 511 | buf[i] = 0; |
507 | *tok = strdup(buf); | 512 | *tok = strdup(buf); |
@@ -545,10 +550,13 @@ enum event_type __read_token(char **tok) | |||
545 | /* remove the last quote */ | 550 | /* remove the last quote */ |
546 | i--; | 551 | i--; |
547 | goto out; | 552 | goto out; |
553 | |||
554 | case EVENT_ERROR ... EVENT_SPACE: | ||
555 | case EVENT_ITEM: | ||
548 | default: | 556 | default: |
549 | break; | 557 | break; |
550 | } | 558 | } |
551 | 559 | ||
552 | while (get_type(__peek_char()) == type) { | 560 | while (get_type(__peek_char()) == type) { |
553 | if (i == (BUFSIZ - 1)) { | 561 | if (i == (BUFSIZ - 1)) { |
554 | buf[i] = 0; | 562 | buf[i] = 0; |
@@ -584,13 +592,13 @@ enum event_type __read_token(char **tok) | |||
584 | return type; | 592 | return type; |
585 | } | 593 | } |
586 | 594 | ||
587 | void free_token(char *tok) | 595 | static void free_token(char *tok) |
588 | { | 596 | { |
589 | if (tok) | 597 | if (tok) |
590 | free(tok); | 598 | free(tok); |
591 | } | 599 | } |
592 | 600 | ||
593 | enum event_type read_token(char **tok) | 601 | static enum event_type read_token(char **tok) |
594 | { | 602 | { |
595 | enum event_type type; | 603 | enum event_type type; |
596 | 604 | ||
@@ -607,7 +615,7 @@ enum event_type read_token(char **tok) | |||
607 | } | 615 | } |
608 | 616 | ||
609 | /* no newline */ | 617 | /* no newline */ |
610 | enum event_type read_token_item(char **tok) | 618 | static enum event_type read_token_item(char **tok) |
611 | { | 619 | { |
612 | enum event_type type; | 620 | enum event_type type; |
613 | 621 | ||
@@ -623,7 +631,7 @@ enum event_type read_token_item(char **tok) | |||
623 | return EVENT_NONE; | 631 | return EVENT_NONE; |
624 | } | 632 | } |
625 | 633 | ||
626 | int test_type(enum event_type type, enum event_type expect) | 634 | static int test_type(enum event_type type, enum event_type expect) |
627 | { | 635 | { |
628 | if (type != expect) { | 636 | if (type != expect) { |
629 | warn("Error: expected type %d but read %d", | 637 | warn("Error: expected type %d but read %d", |
@@ -633,7 +641,7 @@ int test_type(enum event_type type, enum event_type expect) | |||
633 | return 0; | 641 | return 0; |
634 | } | 642 | } |
635 | 643 | ||
636 | int test_type_token(enum event_type type, char *token, | 644 | static int test_type_token(enum event_type type, char *token, |
637 | enum event_type expect, char *expect_tok) | 645 | enum event_type expect, char *expect_tok) |
638 | { | 646 | { |
639 | if (type != expect) { | 647 | if (type != expect) { |
@@ -650,7 +658,7 @@ int test_type_token(enum event_type type, char *token, | |||
650 | return 0; | 658 | return 0; |
651 | } | 659 | } |
652 | 660 | ||
653 | int __read_expect_type(enum event_type expect, char **tok, int newline_ok) | 661 | static int __read_expect_type(enum event_type expect, char **tok, int newline_ok) |
654 | { | 662 | { |
655 | enum event_type type; | 663 | enum event_type type; |
656 | 664 | ||
@@ -661,17 +669,12 @@ int __read_expect_type(enum event_type expect, char **tok, int newline_ok) | |||
661 | return test_type(type, expect); | 669 | return test_type(type, expect); |
662 | } | 670 | } |
663 | 671 | ||
664 | int read_expect_type(enum event_type expect, char **tok) | 672 | static int read_expect_type(enum event_type expect, char **tok) |
665 | { | 673 | { |
666 | return __read_expect_type(expect, tok, 1); | 674 | return __read_expect_type(expect, tok, 1); |
667 | } | 675 | } |
668 | 676 | ||
669 | int read_expect_type_item(enum event_type expect, char **tok) | 677 | static int __read_expected(enum event_type expect, char *str, int newline_ok) |
670 | { | ||
671 | return __read_expect_type(expect, tok, 0); | ||
672 | } | ||
673 | |||
674 | int __read_expected(enum event_type expect, char *str, int newline_ok) | ||
675 | { | 678 | { |
676 | enum event_type type; | 679 | enum event_type type; |
677 | char *token; | 680 | char *token; |
@@ -689,24 +692,24 @@ int __read_expected(enum event_type expect, char *str, int newline_ok) | |||
689 | return ret; | 692 | return ret; |
690 | } | 693 | } |
691 | 694 | ||
692 | int read_expected(enum event_type expect, char *str) | 695 | static int read_expected(enum event_type expect, char *str) |
693 | { | 696 | { |
694 | return __read_expected(expect, str, 1); | 697 | return __read_expected(expect, str, 1); |
695 | } | 698 | } |
696 | 699 | ||
697 | int read_expected_item(enum event_type expect, char *str) | 700 | static int read_expected_item(enum event_type expect, char *str) |
698 | { | 701 | { |
699 | return __read_expected(expect, str, 0); | 702 | return __read_expected(expect, str, 0); |
700 | } | 703 | } |
701 | 704 | ||
702 | char *event_read_name(void) | 705 | static char *event_read_name(void) |
703 | { | 706 | { |
704 | char *token; | 707 | char *token; |
705 | 708 | ||
706 | if (read_expected(EVENT_ITEM, "name") < 0) | 709 | if (read_expected(EVENT_ITEM, (char *)"name") < 0) |
707 | return NULL; | 710 | return NULL; |
708 | 711 | ||
709 | if (read_expected(EVENT_OP, ":") < 0) | 712 | if (read_expected(EVENT_OP, (char *)":") < 0) |
710 | return NULL; | 713 | return NULL; |
711 | 714 | ||
712 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 715 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
@@ -719,15 +722,15 @@ char *event_read_name(void) | |||
719 | return NULL; | 722 | return NULL; |
720 | } | 723 | } |
721 | 724 | ||
722 | int event_read_id(void) | 725 | static int event_read_id(void) |
723 | { | 726 | { |
724 | char *token; | 727 | char *token; |
725 | int id; | 728 | int id; |
726 | 729 | ||
727 | if (read_expected_item(EVENT_ITEM, "ID") < 0) | 730 | if (read_expected_item(EVENT_ITEM, (char *)"ID") < 0) |
728 | return -1; | 731 | return -1; |
729 | 732 | ||
730 | if (read_expected(EVENT_OP, ":") < 0) | 733 | if (read_expected(EVENT_OP, (char *)":") < 0) |
731 | return -1; | 734 | return -1; |
732 | 735 | ||
733 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 736 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
@@ -742,7 +745,25 @@ int event_read_id(void) | |||
742 | return -1; | 745 | return -1; |
743 | } | 746 | } |
744 | 747 | ||
745 | int event_read_fields(struct event *event, struct format_field **fields) | 748 | static int field_is_string(struct format_field *field) |
749 | { | ||
750 | if ((field->flags & FIELD_IS_ARRAY) && | ||
751 | (!strstr(field->type, "char") || !strstr(field->type, "u8") || | ||
752 | !strstr(field->type, "s8"))) | ||
753 | return 1; | ||
754 | |||
755 | return 0; | ||
756 | } | ||
757 | |||
758 | static int field_is_dynamic(struct format_field *field) | ||
759 | { | ||
760 | if (!strcmp(field->type, "__data_loc")) | ||
761 | return 1; | ||
762 | |||
763 | return 0; | ||
764 | } | ||
765 | |||
766 | static int event_read_fields(struct event *event, struct format_field **fields) | ||
746 | { | 767 | { |
747 | struct format_field *field = NULL; | 768 | struct format_field *field = NULL; |
748 | enum event_type type; | 769 | enum event_type type; |
@@ -759,7 +780,7 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
759 | 780 | ||
760 | count++; | 781 | count++; |
761 | 782 | ||
762 | if (test_type_token(type, token, EVENT_ITEM, "field")) | 783 | if (test_type_token(type, token, EVENT_ITEM, (char *)"field")) |
763 | goto fail; | 784 | goto fail; |
764 | free_token(token); | 785 | free_token(token); |
765 | 786 | ||
@@ -774,7 +795,7 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
774 | type = read_token(&token); | 795 | type = read_token(&token); |
775 | } | 796 | } |
776 | 797 | ||
777 | if (test_type_token(type, token, EVENT_OP, ":") < 0) | 798 | if (test_type_token(type, token, EVENT_OP, (char *)":") < 0) |
778 | return -1; | 799 | return -1; |
779 | 800 | ||
780 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 801 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
@@ -811,7 +832,7 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
811 | last_token = token; | 832 | last_token = token; |
812 | continue; | 833 | continue; |
813 | } | 834 | } |
814 | 835 | ||
815 | break; | 836 | break; |
816 | } | 837 | } |
817 | 838 | ||
@@ -886,14 +907,20 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
886 | free(brackets); | 907 | free(brackets); |
887 | } | 908 | } |
888 | 909 | ||
889 | if (test_type_token(type, token, EVENT_OP, ";")) | 910 | if (field_is_string(field)) { |
911 | field->flags |= FIELD_IS_STRING; | ||
912 | if (field_is_dynamic(field)) | ||
913 | field->flags |= FIELD_IS_DYNAMIC; | ||
914 | } | ||
915 | |||
916 | if (test_type_token(type, token, EVENT_OP, (char *)";")) | ||
890 | goto fail; | 917 | goto fail; |
891 | free_token(token); | 918 | free_token(token); |
892 | 919 | ||
893 | if (read_expected(EVENT_ITEM, "offset") < 0) | 920 | if (read_expected(EVENT_ITEM, (char *)"offset") < 0) |
894 | goto fail_expect; | 921 | goto fail_expect; |
895 | 922 | ||
896 | if (read_expected(EVENT_OP, ":") < 0) | 923 | if (read_expected(EVENT_OP, (char *)":") < 0) |
897 | goto fail_expect; | 924 | goto fail_expect; |
898 | 925 | ||
899 | if (read_expect_type(EVENT_ITEM, &token)) | 926 | if (read_expect_type(EVENT_ITEM, &token)) |
@@ -901,13 +928,13 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
901 | field->offset = strtoul(token, NULL, 0); | 928 | field->offset = strtoul(token, NULL, 0); |
902 | free_token(token); | 929 | free_token(token); |
903 | 930 | ||
904 | if (read_expected(EVENT_OP, ";") < 0) | 931 | if (read_expected(EVENT_OP, (char *)";") < 0) |
905 | goto fail_expect; | 932 | goto fail_expect; |
906 | 933 | ||
907 | if (read_expected(EVENT_ITEM, "size") < 0) | 934 | if (read_expected(EVENT_ITEM, (char *)"size") < 0) |
908 | goto fail_expect; | 935 | goto fail_expect; |
909 | 936 | ||
910 | if (read_expected(EVENT_OP, ":") < 0) | 937 | if (read_expected(EVENT_OP, (char *)":") < 0) |
911 | goto fail_expect; | 938 | goto fail_expect; |
912 | 939 | ||
913 | if (read_expect_type(EVENT_ITEM, &token)) | 940 | if (read_expect_type(EVENT_ITEM, &token)) |
@@ -915,18 +942,18 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
915 | field->size = strtoul(token, NULL, 0); | 942 | field->size = strtoul(token, NULL, 0); |
916 | free_token(token); | 943 | free_token(token); |
917 | 944 | ||
918 | if (read_expected(EVENT_OP, ";") < 0) | 945 | if (read_expected(EVENT_OP, (char *)";") < 0) |
919 | goto fail_expect; | 946 | goto fail_expect; |
920 | 947 | ||
921 | type = read_token(&token); | 948 | type = read_token(&token); |
922 | if (type != EVENT_NEWLINE) { | 949 | if (type != EVENT_NEWLINE) { |
923 | /* newer versions of the kernel have a "signed" type */ | 950 | /* newer versions of the kernel have a "signed" type */ |
924 | if (test_type_token(type, token, EVENT_ITEM, "signed")) | 951 | if (test_type_token(type, token, EVENT_ITEM, (char *)"signed")) |
925 | goto fail; | 952 | goto fail; |
926 | 953 | ||
927 | free_token(token); | 954 | free_token(token); |
928 | 955 | ||
929 | if (read_expected(EVENT_OP, ":") < 0) | 956 | if (read_expected(EVENT_OP, (char *)":") < 0) |
930 | goto fail_expect; | 957 | goto fail_expect; |
931 | 958 | ||
932 | if (read_expect_type(EVENT_ITEM, &token)) | 959 | if (read_expect_type(EVENT_ITEM, &token)) |
@@ -935,7 +962,7 @@ int event_read_fields(struct event *event, struct format_field **fields) | |||
935 | /* add signed type */ | 962 | /* add signed type */ |
936 | 963 | ||
937 | free_token(token); | 964 | free_token(token); |
938 | if (read_expected(EVENT_OP, ";") < 0) | 965 | if (read_expected(EVENT_OP, (char *)";") < 0) |
939 | goto fail_expect; | 966 | goto fail_expect; |
940 | 967 | ||
941 | if (read_expect_type(EVENT_NEWLINE, &token)) | 968 | if (read_expect_type(EVENT_NEWLINE, &token)) |
@@ -959,15 +986,15 @@ fail_expect: | |||
959 | return -1; | 986 | return -1; |
960 | } | 987 | } |
961 | 988 | ||
962 | int event_read_format(struct event *event) | 989 | static int event_read_format(struct event *event) |
963 | { | 990 | { |
964 | char *token; | 991 | char *token; |
965 | int ret; | 992 | int ret; |
966 | 993 | ||
967 | if (read_expected_item(EVENT_ITEM, "format") < 0) | 994 | if (read_expected_item(EVENT_ITEM, (char *)"format") < 0) |
968 | return -1; | 995 | return -1; |
969 | 996 | ||
970 | if (read_expected(EVENT_OP, ":") < 0) | 997 | if (read_expected(EVENT_OP, (char *)":") < 0) |
971 | return -1; | 998 | return -1; |
972 | 999 | ||
973 | if (read_expect_type(EVENT_NEWLINE, &token)) | 1000 | if (read_expect_type(EVENT_NEWLINE, &token)) |
@@ -994,8 +1021,8 @@ int event_read_format(struct event *event) | |||
994 | enum event_type | 1021 | enum event_type |
995 | process_arg_token(struct event *event, struct print_arg *arg, | 1022 | process_arg_token(struct event *event, struct print_arg *arg, |
996 | char **tok, enum event_type type); | 1023 | char **tok, enum event_type type); |
997 | 1024 | ||
998 | enum event_type | 1025 | static enum event_type |
999 | process_arg(struct event *event, struct print_arg *arg, char **tok) | 1026 | process_arg(struct event *event, struct print_arg *arg, char **tok) |
1000 | { | 1027 | { |
1001 | enum event_type type; | 1028 | enum event_type type; |
@@ -1007,7 +1034,7 @@ process_arg(struct event *event, struct print_arg *arg, char **tok) | |||
1007 | return process_arg_token(event, arg, tok, type); | 1034 | return process_arg_token(event, arg, tok, type); |
1008 | } | 1035 | } |
1009 | 1036 | ||
1010 | enum event_type | 1037 | static enum event_type |
1011 | process_cond(struct event *event, struct print_arg *top, char **tok) | 1038 | process_cond(struct event *event, struct print_arg *top, char **tok) |
1012 | { | 1039 | { |
1013 | struct print_arg *arg, *left, *right; | 1040 | struct print_arg *arg, *left, *right; |
@@ -1027,7 +1054,7 @@ process_cond(struct event *event, struct print_arg *top, char **tok) | |||
1027 | 1054 | ||
1028 | *tok = NULL; | 1055 | *tok = NULL; |
1029 | type = process_arg(event, left, &token); | 1056 | type = process_arg(event, left, &token); |
1030 | if (test_type_token(type, token, EVENT_OP, ":")) | 1057 | if (test_type_token(type, token, EVENT_OP, (char *)":")) |
1031 | goto out_free; | 1058 | goto out_free; |
1032 | 1059 | ||
1033 | arg->op.op = token; | 1060 | arg->op.op = token; |
@@ -1140,10 +1167,10 @@ static void set_op_prio(struct print_arg *arg) | |||
1140 | arg->op.prio = get_op_prio(arg->op.op); | 1167 | arg->op.prio = get_op_prio(arg->op.op); |
1141 | } | 1168 | } |
1142 | 1169 | ||
1143 | enum event_type | 1170 | static enum event_type |
1144 | process_op(struct event *event, struct print_arg *arg, char **tok) | 1171 | process_op(struct event *event, struct print_arg *arg, char **tok) |
1145 | { | 1172 | { |
1146 | struct print_arg *left, *right; | 1173 | struct print_arg *left, *right = NULL; |
1147 | enum event_type type; | 1174 | enum event_type type; |
1148 | char *token; | 1175 | char *token; |
1149 | 1176 | ||
@@ -1273,15 +1300,15 @@ process_op(struct event *event, struct print_arg *arg, char **tok) | |||
1273 | return type; | 1300 | return type; |
1274 | } | 1301 | } |
1275 | 1302 | ||
1276 | enum event_type | 1303 | static enum event_type |
1277 | process_entry(struct event *event, struct print_arg *arg, | 1304 | process_entry(struct event *event __unused, struct print_arg *arg, |
1278 | char **tok) | 1305 | char **tok) |
1279 | { | 1306 | { |
1280 | enum event_type type; | 1307 | enum event_type type; |
1281 | char *field; | 1308 | char *field; |
1282 | char *token; | 1309 | char *token; |
1283 | 1310 | ||
1284 | if (read_expected(EVENT_OP, "->") < 0) | 1311 | if (read_expected(EVENT_OP, (char *)"->") < 0) |
1285 | return EVENT_ERROR; | 1312 | return EVENT_ERROR; |
1286 | 1313 | ||
1287 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1314 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
@@ -1306,7 +1333,7 @@ static char *arg_eval (struct print_arg *arg); | |||
1306 | static long long arg_num_eval(struct print_arg *arg) | 1333 | static long long arg_num_eval(struct print_arg *arg) |
1307 | { | 1334 | { |
1308 | long long left, right; | 1335 | long long left, right; |
1309 | long long val; | 1336 | long long val = 0; |
1310 | 1337 | ||
1311 | switch (arg->type) { | 1338 | switch (arg->type) { |
1312 | case PRINT_ATOM: | 1339 | case PRINT_ATOM: |
@@ -1392,6 +1419,10 @@ static long long arg_num_eval(struct print_arg *arg) | |||
1392 | die("unknown op '%s'", arg->op.op); | 1419 | die("unknown op '%s'", arg->op.op); |
1393 | } | 1420 | } |
1394 | break; | 1421 | break; |
1422 | |||
1423 | case PRINT_NULL: | ||
1424 | case PRINT_FIELD ... PRINT_SYMBOL: | ||
1425 | case PRINT_STRING: | ||
1395 | default: | 1426 | default: |
1396 | die("invalid eval type %d", arg->type); | 1427 | die("invalid eval type %d", arg->type); |
1397 | 1428 | ||
@@ -1413,7 +1444,10 @@ static char *arg_eval (struct print_arg *arg) | |||
1413 | val = arg_num_eval(arg); | 1444 | val = arg_num_eval(arg); |
1414 | sprintf(buf, "%lld", val); | 1445 | sprintf(buf, "%lld", val); |
1415 | return buf; | 1446 | return buf; |
1416 | 1447 | ||
1448 | case PRINT_NULL: | ||
1449 | case PRINT_FIELD ... PRINT_SYMBOL: | ||
1450 | case PRINT_STRING: | ||
1417 | default: | 1451 | default: |
1418 | die("invalid eval type %d", arg->type); | 1452 | die("invalid eval type %d", arg->type); |
1419 | break; | 1453 | break; |
@@ -1422,7 +1456,7 @@ static char *arg_eval (struct print_arg *arg) | |||
1422 | return NULL; | 1456 | return NULL; |
1423 | } | 1457 | } |
1424 | 1458 | ||
1425 | enum event_type | 1459 | static enum event_type |
1426 | process_fields(struct event *event, struct print_flag_sym **list, char **tok) | 1460 | process_fields(struct event *event, struct print_flag_sym **list, char **tok) |
1427 | { | 1461 | { |
1428 | enum event_type type; | 1462 | enum event_type type; |
@@ -1434,14 +1468,14 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok) | |||
1434 | do { | 1468 | do { |
1435 | free_token(token); | 1469 | free_token(token); |
1436 | type = read_token_item(&token); | 1470 | type = read_token_item(&token); |
1437 | if (test_type_token(type, token, EVENT_OP, "{")) | 1471 | if (test_type_token(type, token, EVENT_OP, (char *)"{")) |
1438 | break; | 1472 | break; |
1439 | 1473 | ||
1440 | arg = malloc_or_die(sizeof(*arg)); | 1474 | arg = malloc_or_die(sizeof(*arg)); |
1441 | 1475 | ||
1442 | free_token(token); | 1476 | free_token(token); |
1443 | type = process_arg(event, arg, &token); | 1477 | type = process_arg(event, arg, &token); |
1444 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1478 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) |
1445 | goto out_free; | 1479 | goto out_free; |
1446 | 1480 | ||
1447 | field = malloc_or_die(sizeof(*field)); | 1481 | field = malloc_or_die(sizeof(*field)); |
@@ -1452,7 +1486,7 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok) | |||
1452 | 1486 | ||
1453 | free_token(token); | 1487 | free_token(token); |
1454 | type = process_arg(event, arg, &token); | 1488 | type = process_arg(event, arg, &token); |
1455 | if (test_type_token(type, token, EVENT_OP, "}")) | 1489 | if (test_type_token(type, token, EVENT_OP, (char *)"}")) |
1456 | goto out_free; | 1490 | goto out_free; |
1457 | 1491 | ||
1458 | value = arg_eval(arg); | 1492 | value = arg_eval(arg); |
@@ -1477,7 +1511,7 @@ out_free: | |||
1477 | return EVENT_ERROR; | 1511 | return EVENT_ERROR; |
1478 | } | 1512 | } |
1479 | 1513 | ||
1480 | enum event_type | 1514 | static enum event_type |
1481 | process_flags(struct event *event, struct print_arg *arg, char **tok) | 1515 | process_flags(struct event *event, struct print_arg *arg, char **tok) |
1482 | { | 1516 | { |
1483 | struct print_arg *field; | 1517 | struct print_arg *field; |
@@ -1487,13 +1521,13 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) | |||
1487 | memset(arg, 0, sizeof(*arg)); | 1521 | memset(arg, 0, sizeof(*arg)); |
1488 | arg->type = PRINT_FLAGS; | 1522 | arg->type = PRINT_FLAGS; |
1489 | 1523 | ||
1490 | if (read_expected_item(EVENT_DELIM, "(") < 0) | 1524 | if (read_expected_item(EVENT_DELIM, (char *)"(") < 0) |
1491 | return EVENT_ERROR; | 1525 | return EVENT_ERROR; |
1492 | 1526 | ||
1493 | field = malloc_or_die(sizeof(*field)); | 1527 | field = malloc_or_die(sizeof(*field)); |
1494 | 1528 | ||
1495 | type = process_arg(event, field, &token); | 1529 | type = process_arg(event, field, &token); |
1496 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1530 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) |
1497 | goto out_free; | 1531 | goto out_free; |
1498 | 1532 | ||
1499 | arg->flags.field = field; | 1533 | arg->flags.field = field; |
@@ -1504,11 +1538,11 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) | |||
1504 | type = read_token_item(&token); | 1538 | type = read_token_item(&token); |
1505 | } | 1539 | } |
1506 | 1540 | ||
1507 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1541 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) |
1508 | goto out_free; | 1542 | goto out_free; |
1509 | 1543 | ||
1510 | type = process_fields(event, &arg->flags.flags, &token); | 1544 | type = process_fields(event, &arg->flags.flags, &token); |
1511 | if (test_type_token(type, token, EVENT_DELIM, ")")) | 1545 | if (test_type_token(type, token, EVENT_DELIM, (char *)")")) |
1512 | goto out_free; | 1546 | goto out_free; |
1513 | 1547 | ||
1514 | free_token(token); | 1548 | free_token(token); |
@@ -1520,7 +1554,7 @@ out_free: | |||
1520 | return EVENT_ERROR; | 1554 | return EVENT_ERROR; |
1521 | } | 1555 | } |
1522 | 1556 | ||
1523 | enum event_type | 1557 | static enum event_type |
1524 | process_symbols(struct event *event, struct print_arg *arg, char **tok) | 1558 | process_symbols(struct event *event, struct print_arg *arg, char **tok) |
1525 | { | 1559 | { |
1526 | struct print_arg *field; | 1560 | struct print_arg *field; |
@@ -1530,19 +1564,19 @@ process_symbols(struct event *event, struct print_arg *arg, char **tok) | |||
1530 | memset(arg, 0, sizeof(*arg)); | 1564 | memset(arg, 0, sizeof(*arg)); |
1531 | arg->type = PRINT_SYMBOL; | 1565 | arg->type = PRINT_SYMBOL; |
1532 | 1566 | ||
1533 | if (read_expected_item(EVENT_DELIM, "(") < 0) | 1567 | if (read_expected_item(EVENT_DELIM, (char *)"(") < 0) |
1534 | return EVENT_ERROR; | 1568 | return EVENT_ERROR; |
1535 | 1569 | ||
1536 | field = malloc_or_die(sizeof(*field)); | 1570 | field = malloc_or_die(sizeof(*field)); |
1537 | 1571 | ||
1538 | type = process_arg(event, field, &token); | 1572 | type = process_arg(event, field, &token); |
1539 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1573 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) |
1540 | goto out_free; | 1574 | goto out_free; |
1541 | 1575 | ||
1542 | arg->symbol.field = field; | 1576 | arg->symbol.field = field; |
1543 | 1577 | ||
1544 | type = process_fields(event, &arg->symbol.symbols, &token); | 1578 | type = process_fields(event, &arg->symbol.symbols, &token); |
1545 | if (test_type_token(type, token, EVENT_DELIM, ")")) | 1579 | if (test_type_token(type, token, EVENT_DELIM, (char *)")")) |
1546 | goto out_free; | 1580 | goto out_free; |
1547 | 1581 | ||
1548 | free_token(token); | 1582 | free_token(token); |
@@ -1554,7 +1588,7 @@ out_free: | |||
1554 | return EVENT_ERROR; | 1588 | return EVENT_ERROR; |
1555 | } | 1589 | } |
1556 | 1590 | ||
1557 | enum event_type | 1591 | static enum event_type |
1558 | process_paren(struct event *event, struct print_arg *arg, char **tok) | 1592 | process_paren(struct event *event, struct print_arg *arg, char **tok) |
1559 | { | 1593 | { |
1560 | struct print_arg *item_arg; | 1594 | struct print_arg *item_arg; |
@@ -1579,7 +1613,7 @@ process_paren(struct event *event, struct print_arg *arg, char **tok) | |||
1579 | 1613 | ||
1580 | free_token(token); | 1614 | free_token(token); |
1581 | type = read_token_item(&token); | 1615 | type = read_token_item(&token); |
1582 | 1616 | ||
1583 | /* | 1617 | /* |
1584 | * If the next token is an item or another open paren, then | 1618 | * If the next token is an item or another open paren, then |
1585 | * this was a typecast. | 1619 | * this was a typecast. |
@@ -1607,13 +1641,13 @@ process_paren(struct event *event, struct print_arg *arg, char **tok) | |||
1607 | } | 1641 | } |
1608 | 1642 | ||
1609 | 1643 | ||
1610 | enum event_type | 1644 | static enum event_type |
1611 | process_str(struct event *event, struct print_arg *arg, char **tok) | 1645 | process_str(struct event *event __unused, struct print_arg *arg, char **tok) |
1612 | { | 1646 | { |
1613 | enum event_type type; | 1647 | enum event_type type; |
1614 | char *token; | 1648 | char *token; |
1615 | 1649 | ||
1616 | if (read_expected(EVENT_DELIM, "(") < 0) | 1650 | if (read_expected(EVENT_DELIM, (char *)"(") < 0) |
1617 | return EVENT_ERROR; | 1651 | return EVENT_ERROR; |
1618 | 1652 | ||
1619 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1653 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
@@ -1621,10 +1655,11 @@ process_str(struct event *event, struct print_arg *arg, char **tok) | |||
1621 | 1655 | ||
1622 | arg->type = PRINT_STRING; | 1656 | arg->type = PRINT_STRING; |
1623 | arg->string.string = token; | 1657 | arg->string.string = token; |
1658 | arg->string.offset = -1; | ||
1624 | 1659 | ||
1625 | if (read_expected(EVENT_DELIM, ")") < 0) | 1660 | if (read_expected(EVENT_DELIM, (char *)")") < 0) |
1626 | return EVENT_ERROR; | 1661 | return EVENT_ERROR; |
1627 | 1662 | ||
1628 | type = read_token(&token); | 1663 | type = read_token(&token); |
1629 | *tok = token; | 1664 | *tok = token; |
1630 | 1665 | ||
@@ -1697,6 +1732,8 @@ process_arg_token(struct event *event, struct print_arg *arg, | |||
1697 | type = process_op(event, arg, &token); | 1732 | type = process_op(event, arg, &token); |
1698 | 1733 | ||
1699 | break; | 1734 | break; |
1735 | |||
1736 | case EVENT_ERROR ... EVENT_NEWLINE: | ||
1700 | default: | 1737 | default: |
1701 | die("unexpected type %d", type); | 1738 | die("unexpected type %d", type); |
1702 | } | 1739 | } |
@@ -1705,7 +1742,7 @@ process_arg_token(struct event *event, struct print_arg *arg, | |||
1705 | return type; | 1742 | return type; |
1706 | } | 1743 | } |
1707 | 1744 | ||
1708 | int event_read_print_args(struct event *event, struct print_arg **list) | 1745 | static int event_read_print_args(struct event *event, struct print_arg **list) |
1709 | { | 1746 | { |
1710 | enum event_type type = EVENT_ERROR; | 1747 | enum event_type type = EVENT_ERROR; |
1711 | struct print_arg *arg; | 1748 | struct print_arg *arg; |
@@ -1753,19 +1790,19 @@ int event_read_print_args(struct event *event, struct print_arg **list) | |||
1753 | return args; | 1790 | return args; |
1754 | } | 1791 | } |
1755 | 1792 | ||
1756 | int event_read_print(struct event *event) | 1793 | static int event_read_print(struct event *event) |
1757 | { | 1794 | { |
1758 | enum event_type type; | 1795 | enum event_type type; |
1759 | char *token; | 1796 | char *token; |
1760 | int ret; | 1797 | int ret; |
1761 | 1798 | ||
1762 | if (read_expected_item(EVENT_ITEM, "print") < 0) | 1799 | if (read_expected_item(EVENT_ITEM, (char *)"print") < 0) |
1763 | return -1; | 1800 | return -1; |
1764 | 1801 | ||
1765 | if (read_expected(EVENT_ITEM, "fmt") < 0) | 1802 | if (read_expected(EVENT_ITEM, (char *)"fmt") < 0) |
1766 | return -1; | 1803 | return -1; |
1767 | 1804 | ||
1768 | if (read_expected(EVENT_OP, ":") < 0) | 1805 | if (read_expected(EVENT_OP, (char *)":") < 0) |
1769 | return -1; | 1806 | return -1; |
1770 | 1807 | ||
1771 | if (read_expect_type(EVENT_DQUOTE, &token) < 0) | 1808 | if (read_expect_type(EVENT_DQUOTE, &token) < 0) |
@@ -1904,7 +1941,7 @@ static int __parse_common(void *data, int *size, int *offset, | |||
1904 | return read_size(data + *offset, *size); | 1941 | return read_size(data + *offset, *size); |
1905 | } | 1942 | } |
1906 | 1943 | ||
1907 | static int parse_common_type(void *data) | 1944 | static int trace_parse_common_type(void *data) |
1908 | { | 1945 | { |
1909 | static int type_offset; | 1946 | static int type_offset; |
1910 | static int type_size; | 1947 | static int type_size; |
@@ -1954,7 +1991,7 @@ static int parse_common_lock_depth(void *data) | |||
1954 | return ret; | 1991 | return ret; |
1955 | } | 1992 | } |
1956 | 1993 | ||
1957 | static struct event *find_event(int id) | 1994 | struct event *trace_find_event(int id) |
1958 | { | 1995 | { |
1959 | struct event *event; | 1996 | struct event *event; |
1960 | 1997 | ||
@@ -2067,8 +2104,12 @@ static unsigned long long eval_num_arg(void *data, int size, | |||
2067 | die("unknown op '%s'", arg->op.op); | 2104 | die("unknown op '%s'", arg->op.op); |
2068 | val = left == right; | 2105 | val = left == right; |
2069 | break; | 2106 | break; |
2107 | default: | ||
2108 | die("unknown op '%s'", arg->op.op); | ||
2070 | } | 2109 | } |
2071 | break; | 2110 | break; |
2111 | default: /* not sure what to do there */ | ||
2112 | return 0; | ||
2072 | } | 2113 | } |
2073 | return val; | 2114 | return val; |
2074 | } | 2115 | } |
@@ -2084,10 +2125,11 @@ static const struct flag flags[] = { | |||
2084 | { "NET_TX_SOFTIRQ", 2 }, | 2125 | { "NET_TX_SOFTIRQ", 2 }, |
2085 | { "NET_RX_SOFTIRQ", 3 }, | 2126 | { "NET_RX_SOFTIRQ", 3 }, |
2086 | { "BLOCK_SOFTIRQ", 4 }, | 2127 | { "BLOCK_SOFTIRQ", 4 }, |
2087 | { "TASKLET_SOFTIRQ", 5 }, | 2128 | { "BLOCK_IOPOLL_SOFTIRQ", 5 }, |
2088 | { "SCHED_SOFTIRQ", 6 }, | 2129 | { "TASKLET_SOFTIRQ", 6 }, |
2089 | { "HRTIMER_SOFTIRQ", 7 }, | 2130 | { "SCHED_SOFTIRQ", 7 }, |
2090 | { "RCU_SOFTIRQ", 8 }, | 2131 | { "HRTIMER_SOFTIRQ", 8 }, |
2132 | { "RCU_SOFTIRQ", 9 }, | ||
2091 | 2133 | ||
2092 | { "HRTIMER_NORESTART", 0 }, | 2134 | { "HRTIMER_NORESTART", 0 }, |
2093 | { "HRTIMER_RESTART", 1 }, | 2135 | { "HRTIMER_RESTART", 1 }, |
@@ -2105,7 +2147,7 @@ static unsigned long long eval_flag(const char *flag) | |||
2105 | if (isdigit(flag[0])) | 2147 | if (isdigit(flag[0])) |
2106 | return strtoull(flag, NULL, 0); | 2148 | return strtoull(flag, NULL, 0); |
2107 | 2149 | ||
2108 | for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) | 2150 | for (i = 0; i < (int)(sizeof(flags)/sizeof(flags[0])); i++) |
2109 | if (strcmp(flags[i].name, flag) == 0) | 2151 | if (strcmp(flags[i].name, flag) == 0) |
2110 | return flags[i].value; | 2152 | return flags[i].value; |
2111 | 2153 | ||
@@ -2137,6 +2179,7 @@ static void print_str_arg(void *data, int size, | |||
2137 | memcpy(str, data + arg->field.field->offset, | 2179 | memcpy(str, data + arg->field.field->offset, |
2138 | arg->field.field->size); | 2180 | arg->field.field->size); |
2139 | str[arg->field.field->size] = 0; | 2181 | str[arg->field.field->size] = 0; |
2182 | printf("%s", str); | ||
2140 | free(str); | 2183 | free(str); |
2141 | break; | 2184 | break; |
2142 | case PRINT_FLAGS: | 2185 | case PRINT_FLAGS: |
@@ -2170,9 +2213,20 @@ static void print_str_arg(void *data, int size, | |||
2170 | 2213 | ||
2171 | case PRINT_TYPE: | 2214 | case PRINT_TYPE: |
2172 | break; | 2215 | break; |
2173 | case PRINT_STRING: | 2216 | case PRINT_STRING: { |
2174 | printf("%s", arg->string.string); | 2217 | int str_offset; |
2218 | |||
2219 | if (arg->string.offset == -1) { | ||
2220 | struct format_field *f; | ||
2221 | |||
2222 | f = find_any_field(event, arg->string.string); | ||
2223 | arg->string.offset = f->offset; | ||
2224 | } | ||
2225 | str_offset = *(int *)(data + arg->string.offset); | ||
2226 | str_offset &= 0xffff; | ||
2227 | printf("%s", ((char *)data) + str_offset); | ||
2175 | break; | 2228 | break; |
2229 | } | ||
2176 | case PRINT_OP: | 2230 | case PRINT_OP: |
2177 | /* | 2231 | /* |
2178 | * The only op for string should be ? : | 2232 | * The only op for string should be ? : |
@@ -2185,6 +2239,9 @@ static void print_str_arg(void *data, int size, | |||
2185 | else | 2239 | else |
2186 | print_str_arg(data, size, event, arg->op.right->op.right); | 2240 | print_str_arg(data, size, event, arg->op.right->op.right); |
2187 | break; | 2241 | break; |
2242 | default: | ||
2243 | /* well... */ | ||
2244 | break; | ||
2188 | } | 2245 | } |
2189 | } | 2246 | } |
2190 | 2247 | ||
@@ -2254,6 +2311,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
2254 | break; | 2311 | break; |
2255 | case 2: | 2312 | case 2: |
2256 | ls = 8; | 2313 | ls = 8; |
2314 | default: | ||
2315 | break; | ||
2257 | } | 2316 | } |
2258 | val = read_size(bptr, ls); | 2317 | val = read_size(bptr, ls); |
2259 | bptr += ls; | 2318 | bptr += ls; |
@@ -2273,6 +2332,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
2273 | bptr += strlen(bptr) + 1; | 2332 | bptr += strlen(bptr) + 1; |
2274 | *next = arg; | 2333 | *next = arg; |
2275 | next = &arg->next; | 2334 | next = &arg->next; |
2335 | default: | ||
2336 | break; | ||
2276 | } | 2337 | } |
2277 | } | 2338 | } |
2278 | } | 2339 | } |
@@ -2296,7 +2357,7 @@ static void free_args(struct print_arg *args) | |||
2296 | } | 2357 | } |
2297 | } | 2358 | } |
2298 | 2359 | ||
2299 | static char *get_bprint_format(void *data, int size, struct event *event) | 2360 | static char *get_bprint_format(void *data, int size __unused, struct event *event) |
2300 | { | 2361 | { |
2301 | unsigned long long addr; | 2362 | unsigned long long addr; |
2302 | static struct format_field *field; | 2363 | static struct format_field *field; |
@@ -2354,6 +2415,9 @@ static void pretty_print(void *data, int size, struct event *event) | |||
2354 | int len; | 2415 | int len; |
2355 | int ls; | 2416 | int ls; |
2356 | 2417 | ||
2418 | if (strcmp(event->name,"mm_page_alloc") == 0) | ||
2419 | breakpoint(); | ||
2420 | |||
2357 | if (event->flags & EVENT_FL_ISFUNC) | 2421 | if (event->flags & EVENT_FL_ISFUNC) |
2358 | ptr = " %pF <-- %pF"; | 2422 | ptr = " %pF <-- %pF"; |
2359 | 2423 | ||
@@ -2472,7 +2536,7 @@ static void pretty_print(void *data, int size, struct event *event) | |||
2472 | break; | 2536 | break; |
2473 | default: | 2537 | default: |
2474 | printf(">%c<", *ptr); | 2538 | printf(">%c<", *ptr); |
2475 | 2539 | ||
2476 | } | 2540 | } |
2477 | } else | 2541 | } else |
2478 | printf("%c", *ptr); | 2542 | printf("%c", *ptr); |
@@ -2595,8 +2659,8 @@ get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, | |||
2595 | int type; | 2659 | int type; |
2596 | int pid; | 2660 | int pid; |
2597 | 2661 | ||
2598 | type = parse_common_type(next->data); | 2662 | type = trace_parse_common_type(next->data); |
2599 | event = find_event(type); | 2663 | event = trace_find_event(type); |
2600 | if (!event) | 2664 | if (!event) |
2601 | return NULL; | 2665 | return NULL; |
2602 | 2666 | ||
@@ -2614,14 +2678,14 @@ get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, | |||
2614 | return NULL; | 2678 | return NULL; |
2615 | 2679 | ||
2616 | /* this is a leaf, now advance the iterator */ | 2680 | /* this is a leaf, now advance the iterator */ |
2617 | return read_data(cpu); | 2681 | return trace_read_data(cpu); |
2618 | } | 2682 | } |
2619 | 2683 | ||
2620 | /* Signal a overhead of time execution to the output */ | 2684 | /* Signal a overhead of time execution to the output */ |
2621 | static void print_graph_overhead(unsigned long long duration) | 2685 | static void print_graph_overhead(unsigned long long duration) |
2622 | { | 2686 | { |
2623 | /* Non nested entry or return */ | 2687 | /* Non nested entry or return */ |
2624 | if (duration == -1) | 2688 | if (duration == ~0ULL) |
2625 | return (void)printf(" "); | 2689 | return (void)printf(" "); |
2626 | 2690 | ||
2627 | /* Duration exceeded 100 msecs */ | 2691 | /* Duration exceeded 100 msecs */ |
@@ -2677,8 +2741,8 @@ print_graph_entry_leaf(struct event *event, void *data, struct record *ret_rec) | |||
2677 | int type; | 2741 | int type; |
2678 | int i; | 2742 | int i; |
2679 | 2743 | ||
2680 | type = parse_common_type(ret_rec->data); | 2744 | type = trace_parse_common_type(ret_rec->data); |
2681 | ret_event = find_event(type); | 2745 | ret_event = trace_find_event(type); |
2682 | 2746 | ||
2683 | field = find_field(ret_event, "rettime"); | 2747 | field = find_field(ret_event, "rettime"); |
2684 | if (!field) | 2748 | if (!field) |
@@ -2704,7 +2768,7 @@ print_graph_entry_leaf(struct event *event, void *data, struct record *ret_rec) | |||
2704 | depth = read_size(data + field->offset, field->size); | 2768 | depth = read_size(data + field->offset, field->size); |
2705 | 2769 | ||
2706 | /* Function */ | 2770 | /* Function */ |
2707 | for (i = 0; i < depth * TRACE_GRAPH_INDENT; i++) | 2771 | for (i = 0; i < (int)(depth * TRACE_GRAPH_INDENT); i++) |
2708 | printf(" "); | 2772 | printf(" "); |
2709 | 2773 | ||
2710 | field = find_field(event, "func"); | 2774 | field = find_field(event, "func"); |
@@ -2739,7 +2803,7 @@ static void print_graph_nested(struct event *event, void *data) | |||
2739 | depth = read_size(data + field->offset, field->size); | 2803 | depth = read_size(data + field->offset, field->size); |
2740 | 2804 | ||
2741 | /* Function */ | 2805 | /* Function */ |
2742 | for (i = 0; i < depth * TRACE_GRAPH_INDENT; i++) | 2806 | for (i = 0; i < (int)(depth * TRACE_GRAPH_INDENT); i++) |
2743 | printf(" "); | 2807 | printf(" "); |
2744 | 2808 | ||
2745 | field = find_field(event, "func"); | 2809 | field = find_field(event, "func"); |
@@ -2789,7 +2853,7 @@ pretty_print_func_ent(void *data, int size, struct event *event, | |||
2789 | memcpy(copy_data, data, size); | 2853 | memcpy(copy_data, data, size); |
2790 | data = copy_data; | 2854 | data = copy_data; |
2791 | 2855 | ||
2792 | rec = peek_data(cpu); | 2856 | rec = trace_peek_data(cpu); |
2793 | if (rec) { | 2857 | if (rec) { |
2794 | rec = get_return_for_leaf(cpu, pid, val, rec); | 2858 | rec = get_return_for_leaf(cpu, pid, val, rec); |
2795 | if (rec) { | 2859 | if (rec) { |
@@ -2803,7 +2867,7 @@ out_free: | |||
2803 | } | 2867 | } |
2804 | 2868 | ||
2805 | static void | 2869 | static void |
2806 | pretty_print_func_ret(void *data, int size, struct event *event, | 2870 | pretty_print_func_ret(void *data, int size __unused, struct event *event, |
2807 | int cpu, int pid, const char *comm, | 2871 | int cpu, int pid, const char *comm, |
2808 | unsigned long secs, unsigned long usecs) | 2872 | unsigned long secs, unsigned long usecs) |
2809 | { | 2873 | { |
@@ -2848,7 +2912,7 @@ pretty_print_func_ret(void *data, int size, struct event *event, | |||
2848 | depth = read_size(data + field->offset, field->size); | 2912 | depth = read_size(data + field->offset, field->size); |
2849 | 2913 | ||
2850 | /* Function */ | 2914 | /* Function */ |
2851 | for (i = 0; i < depth * TRACE_GRAPH_INDENT; i++) | 2915 | for (i = 0; i < (int)(depth * TRACE_GRAPH_INDENT); i++) |
2852 | printf(" "); | 2916 | printf(" "); |
2853 | 2917 | ||
2854 | printf("}"); | 2918 | printf("}"); |
@@ -2881,11 +2945,13 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs) | |||
2881 | nsecs -= secs * NSECS_PER_SEC; | 2945 | nsecs -= secs * NSECS_PER_SEC; |
2882 | usecs = nsecs / NSECS_PER_USEC; | 2946 | usecs = nsecs / NSECS_PER_USEC; |
2883 | 2947 | ||
2884 | type = parse_common_type(data); | 2948 | type = trace_parse_common_type(data); |
2885 | 2949 | ||
2886 | event = find_event(type); | 2950 | event = trace_find_event(type); |
2887 | if (!event) | 2951 | if (!event) { |
2888 | die("ug! no event found for type %d", type); | 2952 | warn("ug! no event found for type %d", type); |
2953 | return; | ||
2954 | } | ||
2889 | 2955 | ||
2890 | pid = parse_common_pid(data); | 2956 | pid = parse_common_pid(data); |
2891 | comm = find_cmdline(pid); | 2957 | comm = find_cmdline(pid); |
@@ -2913,7 +2979,7 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs) | |||
2913 | printf("\n"); | 2979 | printf("\n"); |
2914 | } | 2980 | } |
2915 | 2981 | ||
2916 | void print_fields(struct print_flag_sym *field) | 2982 | static void print_fields(struct print_flag_sym *field) |
2917 | { | 2983 | { |
2918 | printf("{ %s, %s }", field->value, field->str); | 2984 | printf("{ %s, %s }", field->value, field->str); |
2919 | if (field->next) { | 2985 | if (field->next) { |
@@ -2922,7 +2988,7 @@ void print_fields(struct print_flag_sym *field) | |||
2922 | } | 2988 | } |
2923 | } | 2989 | } |
2924 | 2990 | ||
2925 | void print_args(struct print_arg *args) | 2991 | static void print_args(struct print_arg *args) |
2926 | { | 2992 | { |
2927 | int print_paren = 1; | 2993 | int print_paren = 1; |
2928 | 2994 | ||
@@ -2968,6 +3034,9 @@ void print_args(struct print_arg *args) | |||
2968 | if (print_paren) | 3034 | if (print_paren) |
2969 | printf(")"); | 3035 | printf(")"); |
2970 | break; | 3036 | break; |
3037 | default: | ||
3038 | /* we should warn... */ | ||
3039 | return; | ||
2971 | } | 3040 | } |
2972 | if (args->next) { | 3041 | if (args->next) { |
2973 | printf("\n"); | 3042 | printf("\n"); |
@@ -2981,9 +3050,9 @@ static void parse_header_field(char *field, | |||
2981 | char *token; | 3050 | char *token; |
2982 | int type; | 3051 | int type; |
2983 | 3052 | ||
2984 | if (read_expected(EVENT_ITEM, "field") < 0) | 3053 | if (read_expected(EVENT_ITEM, (char *)"field") < 0) |
2985 | return; | 3054 | return; |
2986 | if (read_expected(EVENT_OP, ":") < 0) | 3055 | if (read_expected(EVENT_OP, (char *)":") < 0) |
2987 | return; | 3056 | return; |
2988 | 3057 | ||
2989 | /* type */ | 3058 | /* type */ |
@@ -2993,27 +3062,27 @@ static void parse_header_field(char *field, | |||
2993 | 3062 | ||
2994 | if (read_expected(EVENT_ITEM, field) < 0) | 3063 | if (read_expected(EVENT_ITEM, field) < 0) |
2995 | return; | 3064 | return; |
2996 | if (read_expected(EVENT_OP, ";") < 0) | 3065 | if (read_expected(EVENT_OP, (char *)";") < 0) |
2997 | return; | 3066 | return; |
2998 | if (read_expected(EVENT_ITEM, "offset") < 0) | 3067 | if (read_expected(EVENT_ITEM, (char *)"offset") < 0) |
2999 | return; | 3068 | return; |
3000 | if (read_expected(EVENT_OP, ":") < 0) | 3069 | if (read_expected(EVENT_OP, (char *)":") < 0) |
3001 | return; | 3070 | return; |
3002 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 3071 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
3003 | goto fail; | 3072 | goto fail; |
3004 | *offset = atoi(token); | 3073 | *offset = atoi(token); |
3005 | free_token(token); | 3074 | free_token(token); |
3006 | if (read_expected(EVENT_OP, ";") < 0) | 3075 | if (read_expected(EVENT_OP, (char *)";") < 0) |
3007 | return; | 3076 | return; |
3008 | if (read_expected(EVENT_ITEM, "size") < 0) | 3077 | if (read_expected(EVENT_ITEM, (char *)"size") < 0) |
3009 | return; | 3078 | return; |
3010 | if (read_expected(EVENT_OP, ":") < 0) | 3079 | if (read_expected(EVENT_OP, (char *)":") < 0) |
3011 | return; | 3080 | return; |
3012 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 3081 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
3013 | goto fail; | 3082 | goto fail; |
3014 | *size = atoi(token); | 3083 | *size = atoi(token); |
3015 | free_token(token); | 3084 | free_token(token); |
3016 | if (read_expected(EVENT_OP, ";") < 0) | 3085 | if (read_expected(EVENT_OP, (char *)";") < 0) |
3017 | return; | 3086 | return; |
3018 | type = read_token(&token); | 3087 | type = read_token(&token); |
3019 | if (type != EVENT_NEWLINE) { | 3088 | if (type != EVENT_NEWLINE) { |
@@ -3021,19 +3090,19 @@ static void parse_header_field(char *field, | |||
3021 | if (type != EVENT_ITEM) | 3090 | if (type != EVENT_ITEM) |
3022 | goto fail; | 3091 | goto fail; |
3023 | 3092 | ||
3024 | if (strcmp(token, "signed") != 0) | 3093 | if (strcmp(token, (char *)"signed") != 0) |
3025 | goto fail; | 3094 | goto fail; |
3026 | 3095 | ||
3027 | free_token(token); | 3096 | free_token(token); |
3028 | 3097 | ||
3029 | if (read_expected(EVENT_OP, ":") < 0) | 3098 | if (read_expected(EVENT_OP, (char *)":") < 0) |
3030 | return; | 3099 | return; |
3031 | 3100 | ||
3032 | if (read_expect_type(EVENT_ITEM, &token)) | 3101 | if (read_expect_type(EVENT_ITEM, &token)) |
3033 | goto fail; | 3102 | goto fail; |
3034 | 3103 | ||
3035 | free_token(token); | 3104 | free_token(token); |
3036 | if (read_expected(EVENT_OP, ";") < 0) | 3105 | if (read_expected(EVENT_OP, (char *)";") < 0) |
3037 | return; | 3106 | return; |
3038 | 3107 | ||
3039 | if (read_expect_type(EVENT_NEWLINE, &token)) | 3108 | if (read_expect_type(EVENT_NEWLINE, &token)) |
@@ -3047,11 +3116,11 @@ int parse_header_page(char *buf, unsigned long size) | |||
3047 | { | 3116 | { |
3048 | init_input_buf(buf, size); | 3117 | init_input_buf(buf, size); |
3049 | 3118 | ||
3050 | parse_header_field("timestamp", &header_page_ts_offset, | 3119 | parse_header_field((char *)"timestamp", &header_page_ts_offset, |
3051 | &header_page_ts_size); | 3120 | &header_page_ts_size); |
3052 | parse_header_field("commit", &header_page_size_offset, | 3121 | parse_header_field((char *)"commit", &header_page_size_offset, |
3053 | &header_page_size_size); | 3122 | &header_page_size_size); |
3054 | parse_header_field("data", &header_page_data_offset, | 3123 | parse_header_field((char *)"data", &header_page_data_offset, |
3055 | &header_page_data_size); | 3124 | &header_page_data_size); |
3056 | 3125 | ||
3057 | return 0; | 3126 | return 0; |
@@ -3122,7 +3191,7 @@ int parse_ftrace_file(char *buf, unsigned long size) | |||
3122 | return 0; | 3191 | return 0; |
3123 | } | 3192 | } |
3124 | 3193 | ||
3125 | int parse_event_file(char *buf, unsigned long size, char *system) | 3194 | int parse_event_file(char *buf, unsigned long size, char *sys) |
3126 | { | 3195 | { |
3127 | struct event *event; | 3196 | struct event *event; |
3128 | int ret; | 3197 | int ret; |
@@ -3153,6 +3222,8 @@ int parse_event_file(char *buf, unsigned long size, char *system) | |||
3153 | goto event_failed; | 3222 | goto event_failed; |
3154 | } | 3223 | } |
3155 | 3224 | ||
3225 | event->system = strdup(sys); | ||
3226 | |||
3156 | #define PRINT_ARGS 0 | 3227 | #define PRINT_ARGS 0 |
3157 | if (PRINT_ARGS && event->print_fmt.args) | 3228 | if (PRINT_ARGS && event->print_fmt.args) |
3158 | print_args(event->print_fmt.args); | 3229 | print_args(event->print_fmt.args); |
diff --git a/parse-events.h b/parse-events.h index d9e8f4f..d044fd5 100644 --- a/parse-events.h +++ b/parse-events.h | |||
@@ -1,7 +1,13 @@ | |||
1 | #ifndef _PARSE_EVENTS_H | 1 | #ifndef _PARSE_EVENTS_H |
2 | #define _PARSE_EVENTS_H | 2 | #define _PARSE_EVENTS_H |
3 | 3 | ||
4 | #ifndef __unused | ||
5 | #define __unused __attribute__ ((unused)) | ||
6 | #endif | ||
7 | |||
8 | /* unique to trace-cmd */ | ||
4 | extern unsigned int page_size; | 9 | extern unsigned int page_size; |
10 | void usage(char **argv); | ||
5 | 11 | ||
6 | #ifndef PAGE_MASK | 12 | #ifndef PAGE_MASK |
7 | #define PAGE_MASK (page_size - 1) | 13 | #define PAGE_MASK (page_size - 1) |
@@ -23,6 +29,9 @@ enum { | |||
23 | enum format_flags { | 29 | enum format_flags { |
24 | FIELD_IS_ARRAY = 1, | 30 | FIELD_IS_ARRAY = 1, |
25 | FIELD_IS_POINTER = 2, | 31 | FIELD_IS_POINTER = 2, |
32 | FIELD_IS_SIGNED = 4, | ||
33 | FIELD_IS_STRING = 8, | ||
34 | FIELD_IS_DYNAMIC = 16, | ||
26 | }; | 35 | }; |
27 | 36 | ||
28 | struct format_field { | 37 | struct format_field { |
@@ -47,6 +56,7 @@ struct print_arg_atom { | |||
47 | 56 | ||
48 | struct print_arg_string { | 57 | struct print_arg_string { |
49 | char *string; | 58 | char *string; |
59 | int offset; | ||
50 | }; | 60 | }; |
51 | 61 | ||
52 | struct print_arg_field { | 62 | struct print_arg_field { |
@@ -128,6 +138,7 @@ struct event { | |||
128 | int flags; | 138 | int flags; |
129 | struct format format; | 139 | struct format format; |
130 | struct print_fmt print_fmt; | 140 | struct print_fmt print_fmt; |
141 | char *system; | ||
131 | }; | 142 | }; |
132 | 143 | ||
133 | enum { | 144 | enum { |
@@ -147,10 +158,8 @@ struct record { | |||
147 | void *data; | 158 | void *data; |
148 | }; | 159 | }; |
149 | 160 | ||
150 | void usage(char **argv); | 161 | struct record *trace_peek_data(int cpu); |
151 | 162 | struct record *trace_read_data(int cpu); | |
152 | struct record *peek_data(int cpu); | ||
153 | struct record *read_data(int cpu); | ||
154 | 163 | ||
155 | void parse_set_info(int nr_cpus, int long_sz); | 164 | void parse_set_info(int nr_cpus, int long_sz); |
156 | 165 | ||
@@ -168,7 +177,7 @@ void print_funcs(void); | |||
168 | void print_printk(void); | 177 | void print_printk(void); |
169 | 178 | ||
170 | int parse_ftrace_file(char *buf, unsigned long size); | 179 | int parse_ftrace_file(char *buf, unsigned long size); |
171 | int parse_event_file(char *buf, unsigned long size, char *system); | 180 | int parse_event_file(char *buf, unsigned long size, char *sys); |
172 | void print_event(int cpu, void *data, int size, unsigned long long nsecs); | 181 | void print_event(int cpu, void *data, int size, unsigned long long nsecs); |
173 | 182 | ||
174 | extern int file_bigendian; | 183 | extern int file_bigendian; |
diff --git a/trace-cmd.c b/trace-cmd.c index 759b6fa..fe5284d 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -272,7 +272,7 @@ static int find_trace_type(const char *type) | |||
272 | FILE *fp; | 272 | FILE *fp; |
273 | int ret; | 273 | int ret; |
274 | 274 | ||
275 | path = get_tracing_file(path); | 275 | path = get_tracing_file(type); |
276 | fp = fopen(path, "r"); | 276 | fp = fopen(path, "r"); |
277 | if (!fp) | 277 | if (!fp) |
278 | die("reading %s", path); | 278 | die("reading %s", path); |
diff --git a/trace-read.c b/trace-read.c index b3cb20a..3e4ae6f 100644 --- a/trace-read.c +++ b/trace-read.c | |||
@@ -387,7 +387,7 @@ static int calc_index(void *ptr, int cpu) | |||
387 | return (unsigned long)ptr - (unsigned long)cpu_data[cpu].page; | 387 | return (unsigned long)ptr - (unsigned long)cpu_data[cpu].page; |
388 | } | 388 | } |
389 | 389 | ||
390 | struct record *peek_data(int cpu) | 390 | struct record *trace_peek_data(int cpu) |
391 | { | 391 | { |
392 | struct record *data; | 392 | struct record *data; |
393 | void *page = cpu_data[cpu].page; | 393 | void *page = cpu_data[cpu].page; |
@@ -431,7 +431,7 @@ read_again: | |||
431 | 431 | ||
432 | if (index >= cpu_data[cpu].page_size) { | 432 | if (index >= cpu_data[cpu].page_size) { |
433 | get_next_page(cpu); | 433 | get_next_page(cpu); |
434 | return peek_data(cpu); | 434 | return trace_peek_data(cpu); |
435 | } | 435 | } |
436 | 436 | ||
437 | type_len_ts = data2host4(ptr); | 437 | type_len_ts = data2host4(ptr); |
@@ -487,11 +487,11 @@ read_again: | |||
487 | return data; | 487 | return data; |
488 | } | 488 | } |
489 | 489 | ||
490 | struct record *read_data(int cpu) | 490 | struct record *trace_read_data(int cpu) |
491 | { | 491 | { |
492 | struct record *data; | 492 | struct record *data; |
493 | 493 | ||
494 | data = peek_data(cpu); | 494 | data = trace_peek_data(cpu); |
495 | cpu_data[cpu].next = NULL; | 495 | cpu_data[cpu].next = NULL; |
496 | 496 | ||
497 | return data; | 497 | return data; |
@@ -501,7 +501,7 @@ static void show_data(int cpu) | |||
501 | { | 501 | { |
502 | struct record *record; | 502 | struct record *record; |
503 | 503 | ||
504 | record = read_data(cpu); | 504 | record = trace_read_data(cpu); |
505 | 505 | ||
506 | print_event(cpu, record->data, record->size, record->ts); | 506 | print_event(cpu, record->data, record->size, record->ts); |
507 | 507 | ||
@@ -568,12 +568,12 @@ static void read_data_info(void) | |||
568 | ts = 0; | 568 | ts = 0; |
569 | if (filter_cpu >= 0) { | 569 | if (filter_cpu >= 0) { |
570 | cpu = filter_cpu; | 570 | cpu = filter_cpu; |
571 | data = peek_data(cpu); | 571 | data = trace_peek_data(cpu); |
572 | if (data) | 572 | if (data) |
573 | next = cpu; | 573 | next = cpu; |
574 | } else { | 574 | } else { |
575 | for (cpu = 0; cpu < cpus; cpu++) { | 575 | for (cpu = 0; cpu < cpus; cpu++) { |
576 | data = peek_data(cpu); | 576 | data = trace_peek_data(cpu); |
577 | if (data && (!ts || data->ts < ts)) { | 577 | if (data && (!ts || data->ts < ts)) { |
578 | ts = data->ts; | 578 | ts = data->ts; |
579 | next = cpu; | 579 | next = cpu; |