The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
        Note that this feature may not be available on all processors.
 
+--branch-history::
+       Add the addresses of sampled taken branches to the callstack.
+       This allows to examine the path the program took to each sample.
+
 --raw-trace::
        When displaying traceevent output, do not use print fmt or plugins.
 
 
                .max_stack           = sysctl__max_stack(),
                .nr_threads_synthesize = UINT_MAX,
        };
+       bool branch_call_mode = false;
        struct record_opts *opts = &top.record_opts;
        struct target *target = &opts->target;
        const char *disassembler_style = NULL, *objdump_path = NULL, *addr2line_path = NULL;
        OPT_CALLBACK('j', "branch-filter", &opts->branch_stack,
                     "branch filter mask", "branch stack filter modes",
                     parse_branch_stack),
+       OPT_BOOLEAN(0, "branch-history", &branch_call_mode,
+                   "add last branch records to call history"),
        OPT_BOOLEAN(0, "raw-trace", &symbol_conf.raw_trace,
                    "Show raw trace event output (do not use print fmt or plugins)"),
        OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy,
                goto out_delete_evlist;
        }
 
+       if (branch_call_mode) {
+               if (!opts->branch_stack)
+                       opts->branch_stack = PERF_SAMPLE_BRANCH_ANY;
+               symbol_conf.use_callchain = true;
+               callchain_param.key = CCKEY_ADDRESS;
+               callchain_param.branch_callstack = true;
+               callchain_param.enabled = true;
+               if (callchain_param.record_mode == CALLCHAIN_NONE)
+                       callchain_param.record_mode = CALLCHAIN_FP;
+               callchain_register_param(&callchain_param);
+               if (!sort_order)
+                       sort_order = "srcline,symbol,dso";
+       }
+
        if (opts->branch_stack && callchain_param.enabled)
                symbol_conf.show_branchflag_count = true;