mm/migrate: correct failure handling if !hugepage_migration_support()
[firefly-linux-kernel-4.4.55.git] / tools / perf / builtin-timechart.c
index 8bde57c5c9088b65f4dcc3ea1e3b1e0c5c8e32df..652af0b66a625305deac34b0f18ec2e5ccf1d8f0 100644 (file)
@@ -488,8 +488,7 @@ static const char *cat_backtrace(union perf_event *event,
                                 * It seems the callchain is corrupted.
                                 * Discard all.
                                 */
-                               free(p);
-                               p = NULL;
+                               zfree(&p);
                                goto exit;
                        }
                        continue;
@@ -841,7 +840,6 @@ static void draw_cpu_usage(struct timechart *tchart)
                                                    sample->start_time,
                                                    sample->end_time,
                                                    p->pid,
-                                                   "sample",
                                                    c->comm,
                                                    sample->backtrace);
                                }
@@ -1252,6 +1250,23 @@ parse_process(const struct option *opt __maybe_unused, const char *arg,
        return 0;
 }
 
+static int
+parse_highlight(const struct option *opt __maybe_unused, const char *arg,
+               int __maybe_unused unset)
+{
+       unsigned long duration = strtoul(arg, NULL, 0);
+
+       if (svg_highlight || svg_highlight_name)
+               return -1;
+
+       if (duration)
+               svg_highlight = duration;
+       else
+               svg_highlight_name = strdup(arg);
+
+       return 0;
+}
+
 int cmd_timechart(int argc, const char **argv,
                  const char *prefix __maybe_unused)
 {
@@ -1270,6 +1285,9 @@ int cmd_timechart(int argc, const char **argv,
        OPT_STRING('i', "input", &input_name, "file", "input file name"),
        OPT_STRING('o', "output", &output_name, "file", "output file name"),
        OPT_INTEGER('w', "width", &svg_page_width, "page width"),
+       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"),