perf report: Fix HV bit mismerge
[deliverable/linux.git] / tools / perf / builtin-top.c
index fe338d3c5d7ec3a82931f7e34b2b9837295bd60c..0506cd6e04cce267b9cc33bea3906d80b50e6f63 100644 (file)
@@ -54,7 +54,7 @@ static int                    system_wide                     =  0;
 
 static int                     default_interval                = 100000;
 
-static __u64                   count_filter                    =  5;
+static u64                     count_filter                    =  5;
 static int                     print_entries                   = 15;
 
 static int                     target_pid                      = -1;
@@ -79,8 +79,8 @@ static int                    dump_symtab;
  * Symbols
  */
 
-static __u64                   min_ip;
-static __u64                   max_ip = -1ll;
+static u64                     min_ip;
+static u64                     max_ip = -1ll;
 
 struct sym_entry {
        struct rb_node          rb_node;
@@ -194,7 +194,7 @@ static void print_sym_table(void)
                100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
 
        if (nr_counters == 1) {
-               printf("%Ld", attrs[0].sample_period);
+               printf("%Ld", (u64)attrs[0].sample_period);
                if (freq)
                        printf("Hz ");
                else
@@ -286,11 +286,31 @@ static void *display_thread(void *arg)
        return NULL;
 }
 
+/* Tag samples to be skipped. */
+char *skip_symbols[] = {
+       "default_idle",
+       "cpu_idle",
+       "enter_idle",
+       "exit_idle",
+       "mwait_idle",
+       "ppc64_runlatch_off",
+       "pseries_dedicated_idle_sleep",
+       NULL
+};
+
 static int symbol_filter(struct dso *self, struct symbol *sym)
 {
        static int filter_match;
        struct sym_entry *syme;
        const char *name = sym->name;
+       int i;
+
+       /*
+        * ppc64 uses function descriptors and appends a '.' to the
+        * start of every instruction address. Remove it.
+        */
+       if (name[0] == '.')
+               name++;
 
        if (!strcmp(name, "_text") ||
            !strcmp(name, "_etext") ||
@@ -302,13 +322,12 @@ static int symbol_filter(struct dso *self, struct symbol *sym)
                return 1;
 
        syme = dso__sym_priv(self, sym);
-       /* Tag samples to be skipped. */
-       if (!strcmp("default_idle", name) ||
-           !strcmp("cpu_idle", name) ||
-           !strcmp("enter_idle", name) ||
-           !strcmp("exit_idle", name) ||
-           !strcmp("mwait_idle", name))
-               syme->skip = 1;
+       for (i = 0; skip_symbols[i]; i++) {
+               if (!strcmp(skip_symbols[i], name)) {
+                       syme->skip = 1;
+                       break;
+               }
+       }
 
        if (filter_match == 1) {
                filter_end = sym->start;
@@ -372,7 +391,7 @@ out_delete_dso:
 /*
  * Binary search in the histogram table and record the hit:
  */
-static void record_ip(__u64 ip, int counter)
+static void record_ip(u64 ip, int counter)
 {
        struct symbol *sym = dso__find_symbol(kernel_dso, ip);
 
@@ -392,11 +411,11 @@ static void record_ip(__u64 ip, int counter)
        samples--;
 }
 
-static void process_event(__u64 ip, int counter)
+static void process_event(u64 ip, int counter, int user)
 {
        samples++;
 
-       if (ip < min_ip || ip > max_ip) {
+       if (user) {
                userspace_samples++;
                return;
        }
@@ -463,15 +482,15 @@ static void mmap_read_counter(struct mmap_data *md)
        for (; old != head;) {
                struct ip_event {
                        struct perf_event_header header;
-                       __u64 ip;
-                       __u32 pid, target_pid;
+                       u64 ip;
+                       u32 pid, target_pid;
                };
                struct mmap_event {
                        struct perf_event_header header;
-                       __u32 pid, target_pid;
-                       __u64 start;
-                       __u64 len;
-                       __u64 pgoff;
+                       u32 pid, target_pid;
+                       u64 start;
+                       u64 len;
+                       u64 pgoff;
                        char filename[PATH_MAX];
                };
 
@@ -509,9 +528,10 @@ static void mmap_read_counter(struct mmap_data *md)
 
                old += size;
 
-               if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
-                       if (event->header.type & PERF_SAMPLE_IP)
-                               process_event(event->ip.ip, md->counter);
+               if (event->header.type == PERF_EVENT_SAMPLE) {
+                       int user =
+       (event->header.misc & PERF_EVENT_MISC_CPUMODE_MASK) == PERF_EVENT_MISC_USER;
+                       process_event(event->ip.ip, md->counter, user);
                }
        }
 
@@ -674,7 +694,7 @@ static const struct option options[] = {
                            "put the counters into a counter group"),
        OPT_STRING('s', "sym-filter", &sym_filter, "pattern",
                    "only display symbols matchig this pattern"),
-       OPT_BOOLEAN('z', "zero", &group,
+       OPT_BOOLEAN('z', "zero", &zero,
                    "zero history across updates"),
        OPT_INTEGER('F', "freq", &freq,
                    "profile at this frequency"),
This page took 0.025764 seconds and 5 git commands to generate.