Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
[firefly-linux-kernel-4.4.55.git] / tools / perf / util / machine.c
index f1a4c833121e306a364851328f6409cb22d779eb..6309f7ceb08f14cfbf0ce0b3cd23d82d4603a60e 100644 (file)
@@ -250,7 +250,7 @@ struct machine *machines__findnew(struct machines *machines, pid_t pid)
                        static struct strlist *seen;
 
                        if (!seen)
-                               seen = strlist__new(true, NULL);
+                               seen = strlist__new(NULL, NULL);
 
                        if (!strlist__has_entry(seen, path)) {
                                pr_err("Can't access file %s\n", path);
@@ -550,6 +550,14 @@ int machine__process_itrace_start_event(struct machine *machine __maybe_unused,
        return 0;
 }
 
+int machine__process_switch_event(struct machine *machine __maybe_unused,
+                                 union perf_event *event)
+{
+       if (dump_trace)
+               perf_event__fprintf_switch(event, stdout);
+       return 0;
+}
+
 struct map *machine__findnew_module_map(struct machine *machine, u64 start,
                                        const char *filename)
 {
@@ -1467,6 +1475,9 @@ int machine__process_event(struct machine *machine, union perf_event *event,
                ret = machine__process_itrace_start_event(machine, event); break;
        case PERF_RECORD_LOST_SAMPLES:
                ret = machine__process_lost_samples_event(machine, event, sample); break;
+       case PERF_RECORD_SWITCH:
+       case PERF_RECORD_SWITCH_CPU_WIDE:
+               ret = machine__process_switch_event(machine, event); break;
        default:
                ret = -1;
                break;
@@ -2009,3 +2020,17 @@ struct dso *machine__findnew_dso(struct machine *machine, const char *filename)
 {
        return dsos__findnew(&machine->dsos, filename);
 }
+
+char *machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, char **modp)
+{
+       struct machine *machine = vmachine;
+       struct map *map;
+       struct symbol *sym = map_groups__find_symbol(&machine->kmaps, MAP__FUNCTION, *addrp, &map,  NULL);
+
+       if (sym == NULL)
+               return NULL;
+
+       *modp = __map__is_kmodule(map) ? (char *)map->dso->short_name : NULL;
+       *addrp = map->unmap_ip(map, sym->start);
+       return sym->name;
+}