]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/builtin-timechart.c
perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used
[karo-tx-linux.git] / tools / perf / builtin-timechart.c
index e7eaa298d34a1ec020a123ade8296451ffe30b73..822c8d39ca1d50f0b77a582ec76a97b256920495 100644 (file)
@@ -23,6 +23,7 @@
 #include "util/cache.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
+#include <linux/kernel.h>
 #include <linux/rbtree.h>
 #include <linux/time64.h>
 #include "util/symbol.h"
@@ -1773,7 +1774,7 @@ static int timechart__io_record(int argc, const char **argv)
        for (i = 0; i < (unsigned int)argc; i++)
                *p++ = argv[i];
 
-       return cmd_record(rec_argc, rec_argv, NULL);
+       return cmd_record(rec_argc, rec_argv);
 }
 
 
@@ -1864,7 +1865,7 @@ static int timechart__record(struct timechart *tchart, int argc, const char **ar
        for (j = 0; j < (unsigned int)argc; j++)
                *p++ = argv[j];
 
-       return cmd_record(rec_argc, rec_argv, NULL);
+       return cmd_record(rec_argc, rec_argv);
 }
 
 static int
@@ -1917,8 +1918,7 @@ parse_time(const struct option *opt, const char *arg, int __maybe_unused unset)
        return 0;
 }
 
-int cmd_timechart(int argc, const char **argv,
-                 const char *prefix __maybe_unused)
+int cmd_timechart(int argc, const char **argv)
 {
        struct timechart tchart = {
                .tool = {
@@ -1933,6 +1933,11 @@ int cmd_timechart(int argc, const char **argv,
                .merge_dist = 1000,
        };
        const char *output_name = "output.svg";
+       const struct option timechart_common_options[] = {
+       OPT_BOOLEAN('P', "power-only", &tchart.power_only, "output power data only"),
+       OPT_BOOLEAN('T', "tasks-only", &tchart.tasks_only, "output processes data only"),
+       OPT_END()
+       };
        const struct option timechart_options[] = {
        OPT_STRING('i', "input", &input_name, "file", "input file name"),
        OPT_STRING('o', "output", &output_name, "file", "output file name"),
@@ -1940,9 +1945,6 @@ int cmd_timechart(int argc, const char **argv,
        OPT_CALLBACK(0, "highlight", NULL, "duration or task name",
                      "highlight tasks. Pass duration in ns or process name.",
                       parse_highlight),
-       OPT_BOOLEAN('P', "power-only", &tchart.power_only, "output power data only"),
-       OPT_BOOLEAN('T', "tasks-only", &tchart.tasks_only,
-                   "output processes data only"),
        OPT_CALLBACK('p', "process", NULL, "process",
                      "process selector. Pass a pid or process name.",
                       parse_process),
@@ -1962,22 +1964,18 @@ int cmd_timechart(int argc, const char **argv,
                     "merge events that are merge-dist us apart",
                     parse_time),
        OPT_BOOLEAN('f', "force", &tchart.force, "don't complain, do it"),
-       OPT_END()
+       OPT_PARENT(timechart_common_options),
        };
        const char * const timechart_subcommands[] = { "record", NULL };
        const char *timechart_usage[] = {
                "perf timechart [<options>] {record}",
                NULL
        };
-
        const struct option timechart_record_options[] = {
-       OPT_BOOLEAN('P', "power-only", &tchart.power_only, "output power data only"),
-       OPT_BOOLEAN('T', "tasks-only", &tchart.tasks_only,
-                   "output processes data only"),
        OPT_BOOLEAN('I', "io-only", &tchart.io_only,
                    "record only IO data"),
        OPT_BOOLEAN('g', "callchain", &tchart.with_backtrace, "record callchain"),
-       OPT_END()
+       OPT_PARENT(timechart_common_options),
        };
        const char * const timechart_record_usage[] = {
                "perf timechart record [<options>]",