]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - tools/perf/util/callchain.c
perf report: Add branch flag to callchain cursor node
[mirror_ubuntu-artful-kernel.git] / tools / perf / util / callchain.c
index 24b4bd0d77545e7bb9f95e83222eb103c92f5151..138a415fad0d9b15e1cdc2ef6b73eefb351753e0 100644 (file)
@@ -109,6 +109,7 @@ __parse_callchain_report_opt(const char *arg, bool allow_record_opt)
        bool record_opt_set = false;
        bool try_stack_size = false;
 
+       callchain_param.enabled = true;
        symbol_conf.use_callchain = true;
 
        if (!arg)
@@ -117,6 +118,7 @@ __parse_callchain_report_opt(const char *arg, bool allow_record_opt)
        while ((tok = strtok((char *)arg, ",")) != NULL) {
                if (!strncmp(tok, "none", strlen(tok))) {
                        callchain_param.mode = CHAIN_NONE;
+                       callchain_param.enabled = false;
                        symbol_conf.use_callchain = false;
                        return 0;
                }
@@ -191,7 +193,6 @@ int perf_callchain_config(const char *var, const char *value)
 
        if (!strcmp(var, "record-mode"))
                return parse_callchain_record_opt(value, &callchain_param);
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
        if (!strcmp(var, "dump-size")) {
                unsigned long size = 0;
                int ret;
@@ -201,7 +202,6 @@ int perf_callchain_config(const char *var, const char *value)
 
                return ret;
        }
-#endif
        if (!strcmp(var, "print-type"))
                return parse_callchain_mode(value);
        if (!strcmp(var, "order"))
@@ -728,7 +728,8 @@ merge_chain_branch(struct callchain_cursor *cursor,
 
        list_for_each_entry_safe(list, next_list, &src->val, list) {
                callchain_cursor_append(cursor, list->ip,
-                                       list->ms.map, list->ms.sym);
+                                       list->ms.map, list->ms.sym,
+                                       false, NULL, 0, 0);
                list_del(&list->list);
                free(list);
        }
@@ -765,7 +766,9 @@ int callchain_merge(struct callchain_cursor *cursor,
 }
 
 int callchain_cursor_append(struct callchain_cursor *cursor,
-                           u64 ip, struct map *map, struct symbol *sym)
+                           u64 ip, struct map *map, struct symbol *sym,
+                           bool branch, struct branch_flags *flags,
+                           int nr_loop_iter, int samples)
 {
        struct callchain_cursor_node *node = *cursor->last;
 
@@ -780,6 +783,13 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
        node->ip = ip;
        node->map = map;
        node->sym = sym;
+       node->branch = branch;
+       node->nr_loop_iter = nr_loop_iter;
+       node->samples = samples;
+
+       if (flags)
+               memcpy(&node->branch_flags, flags,
+                       sizeof(struct branch_flags));
 
        cursor->nr++;
 
@@ -788,7 +798,8 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
        return 0;
 }
 
-int sample__resolve_callchain(struct perf_sample *sample, struct symbol **parent,
+int sample__resolve_callchain(struct perf_sample *sample,
+                             struct callchain_cursor *cursor, struct symbol **parent,
                              struct perf_evsel *evsel, struct addr_location *al,
                              int max_stack)
 {
@@ -796,8 +807,8 @@ int sample__resolve_callchain(struct perf_sample *sample, struct symbol **parent
                return 0;
 
        if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain ||
-           sort__has_parent) {
-               return thread__resolve_callchain(al->thread, evsel, sample,
+           perf_hpp_list.parent) {
+               return thread__resolve_callchain(al->thread, cursor, evsel, sample,
                                                 parent, al, max_stack);
        }
        return 0;