diff options
Diffstat (limited to 'trace-cmd.c')
-rw-r--r-- | trace-cmd.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index cdb0735..cce499a 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -113,6 +113,8 @@ struct events { | |||
113 | 113 | ||
114 | static struct tracecmd_recorder *recorder; | 114 | static struct tracecmd_recorder *recorder; |
115 | 115 | ||
116 | static int ignore_event_not_found = 0; | ||
117 | |||
116 | static char *get_temp_file(int cpu) | 118 | static char *get_temp_file(int cpu) |
117 | { | 119 | { |
118 | char *file = NULL; | 120 | char *file = NULL; |
@@ -738,7 +740,7 @@ static void update_event(const char *name, const char *filter, | |||
738 | 740 | ||
739 | ret = update_glob(str, filter, filter_only, update); | 741 | ret = update_glob(str, filter, filter_only, update); |
740 | free(str); | 742 | free(str); |
741 | if (!ret) | 743 | if (!ret && !ignore_event_not_found) |
742 | die("No events enabled with %s", name); | 744 | die("No events enabled with %s", name); |
743 | return; | 745 | return; |
744 | } | 746 | } |
@@ -752,7 +754,7 @@ static void update_event(const char *name, const char *filter, | |||
752 | ret2 = update_glob(str, filter, filter_only, update); | 754 | ret2 = update_glob(str, filter, filter_only, update); |
753 | free(str); | 755 | free(str); |
754 | 756 | ||
755 | if (!ret && !ret2) | 757 | if (!ret && !ret2 && !ignore_event_not_found) |
756 | goto fail; | 758 | goto fail; |
757 | 759 | ||
758 | return; | 760 | return; |
@@ -979,6 +981,13 @@ static int count_cpus(void) | |||
979 | size_t n; | 981 | size_t n; |
980 | int r; | 982 | int r; |
981 | 983 | ||
984 | cpus = sysconf(_SC_NPROCESSORS_ONLN); | ||
985 | if (cpus > 0) | ||
986 | return cpus; | ||
987 | |||
988 | warning("sysconf could not determine number of CPUS"); | ||
989 | |||
990 | /* Do the hack to figure out # of CPUS */ | ||
982 | n = 1024; | 991 | n = 1024; |
983 | pn = &n; | 992 | pn = &n; |
984 | pbuf = buf; | 993 | pbuf = buf; |
@@ -1222,7 +1231,7 @@ static void setup_network(void) | |||
1222 | } | 1231 | } |
1223 | 1232 | ||
1224 | /* Now create the handle through this socket */ | 1233 | /* Now create the handle through this socket */ |
1225 | handle = tracecmd_create_init_fd(sfd, cpu_count); | 1234 | handle = tracecmd_create_init_fd(sfd); |
1226 | 1235 | ||
1227 | /* OK, we are all set, let'r rip! */ | 1236 | /* OK, we are all set, let'r rip! */ |
1228 | } | 1237 | } |
@@ -1427,11 +1436,14 @@ int main (int argc, char **argv) | |||
1427 | } else if (strcmp(argv[1], "split") == 0) { | 1436 | } else if (strcmp(argv[1], "split") == 0) { |
1428 | trace_split(argc, argv); | 1437 | trace_split(argc, argv); |
1429 | exit(0); | 1438 | exit(0); |
1439 | } else if (strcmp(argv[1], "restore") == 0) { | ||
1440 | trace_restore(argc, argv); | ||
1441 | exit(0); | ||
1430 | } else if ((record = (strcmp(argv[1], "record") == 0)) || | 1442 | } else if ((record = (strcmp(argv[1], "record") == 0)) || |
1431 | (strcmp(argv[1], "start") == 0) || | 1443 | (strcmp(argv[1], "start") == 0) || |
1432 | ((extract = strcmp(argv[1], "extract") == 0))) { | 1444 | ((extract = strcmp(argv[1], "extract") == 0))) { |
1433 | 1445 | ||
1434 | while ((c = getopt(argc-1, argv+1, "+he:f:Fp:do:O:s:r:vg:l:n:P:N:tb:k")) >= 0) { | 1446 | while ((c = getopt(argc-1, argv+1, "+he:f:Fp:do:O:s:r:vg:l:n:P:N:tb:ki")) >= 0) { |
1435 | switch (c) { | 1447 | switch (c) { |
1436 | case 'h': | 1448 | case 'h': |
1437 | usage(argv); | 1449 | usage(argv); |
@@ -1543,6 +1555,9 @@ int main (int argc, char **argv) | |||
1543 | case 'k': | 1555 | case 'k': |
1544 | keep = 1; | 1556 | keep = 1; |
1545 | break; | 1557 | break; |
1558 | case 'i': | ||
1559 | ignore_event_not_found = 1; | ||
1560 | break; | ||
1546 | } | 1561 | } |
1547 | } | 1562 | } |
1548 | 1563 | ||
@@ -1708,6 +1723,7 @@ int main (int argc, char **argv) | |||
1708 | trace_seq_printf(&s, "CPU: %d\n", cpu); | 1723 | trace_seq_printf(&s, "CPU: %d\n", cpu); |
1709 | tracecmd_stat_cpu(&s, cpu); | 1724 | tracecmd_stat_cpu(&s, cpu); |
1710 | trace_seq_do_printf(&s); | 1725 | trace_seq_do_printf(&s); |
1726 | trace_seq_destroy(&s); | ||
1711 | printf("\n"); | 1727 | printf("\n"); |
1712 | } | 1728 | } |
1713 | 1729 | ||