aboutsummaryrefslogtreecommitdiffstats
path: root/trace-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-cmd.c')
-rw-r--r--trace-cmd.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/trace-cmd.c b/trace-cmd.c
index 7c13264..93fcfb8 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -86,6 +86,13 @@ static struct func_list *filter_funcs;
86static struct func_list *notrace_funcs; 86static struct func_list *notrace_funcs;
87static struct func_list *graph_funcs; 87static struct func_list *graph_funcs;
88 88
89struct opt_list {
90 struct opt_list *next;
91 const char *option;
92};
93
94static struct opt_list *options;
95
89struct event_list { 96struct event_list {
90 struct event_list *next; 97 struct event_list *next;
91 const char *event; 98 const char *event;
@@ -480,6 +487,16 @@ static void show_options(void)
480 fclose(fp); 487 fclose(fp);
481} 488}
482 489
490static void save_option(const char *option)
491{
492 struct opt_list *opt;
493
494 opt = malloc_or_die(sizeof(*opt));
495 opt->next = options;
496 options = opt;
497 opt->option = option;
498}
499
483static void set_option(const char *option) 500static void set_option(const char *option)
484{ 501{
485 FILE *fp; 502 FILE *fp;
@@ -495,6 +512,18 @@ static void set_option(const char *option)
495 fclose(fp); 512 fclose(fp);
496} 513}
497 514
515static void set_options(void)
516{
517 struct opt_list *opt;
518
519 while (options) {
520 opt = options;
521 options = opt->next;
522 set_option(opt->option);
523 free(opt);
524 }
525}
526
498static void old_update_events(const char *name, char update) 527static void old_update_events(const char *name, char update)
499{ 528{
500 char *path; 529 char *path;
@@ -1427,7 +1456,7 @@ int main (int argc, char **argv)
1427 break; 1456 break;
1428 case 'O': 1457 case 'O':
1429 option = optarg; 1458 option = optarg;
1430 set_option(option); 1459 save_option(option);
1431 break; 1460 break;
1432 case 's': 1461 case 's':
1433 if (extract) 1462 if (extract)
@@ -1566,6 +1595,8 @@ int main (int argc, char **argv)
1566 set_plugin(plugin); 1595 set_plugin(plugin);
1567 } 1596 }
1568 1597
1598 set_options();
1599
1569 if (record || extract) { 1600 if (record || extract) {
1570 if (!latency) 1601 if (!latency)
1571 start_threads(); 1602 start_threads();