-m::
  --mmap-pages=::
 -      Number of mmap data pages. Must be a power of two.
 +      Number of mmap data pages (must be a power of two) or size
 +      specification with appended unit character - B/K/M/G. The
 +      size is rounded up to have nearest pages power of two value.
  
  -g::
+       Enables call-graph (stack chain/backtrace) recording.
+ 
  --call-graph::
-       Do call-graph (stack chain/backtrace) recording.
+       Setup and enable call-graph (stack chain/backtrace) recording,
+       implies -g.
+ 
+       Allows specifying "fp" (frame pointer) or "dwarf"
+       (DWARF's CFI - Call Frame Information) as the method to collect
+       the information used to show the call graphs.
+ 
+       In some systems, where binaries are build with gcc
+       --fomit-frame-pointer, using the "fp" method will produce bogus
+       call graphs, using "dwarf", if available (perf tools linked to
+       the libunwind library) should be used instead.
  
  -q::
  --quiet::
 
  --asm-raw::
        Show raw instruction encoding of assembly instructions.
  
- -G [type,min,order]::
+ -G::
+       Enables call-graph (stack chain/backtrace) recording.
+ 
  --call-graph::
-         Display call chains using type, min percent threshold and order.
-       type can be either:
-       - flat: single column, linear exposure of call chains.
-       - graph: use a graph tree, displaying absolute overhead rates.
-       - fractal: like graph, but displays relative rates. Each branch of
-                the tree is considered as a new profiled object.
- 
-       order can be either:
-       - callee: callee based call graph.
-       - caller: inverted caller based call graph.
- 
-       Default: fractal,0.5,callee.
+       Setup and enable call-graph (stack chain/backtrace) recording,
+       implies -G.
  
 +--max-stack::
 +      Set the stack depth limit when parsing the callchain, anything
 +      beyond the specified depth will be ignored. This is a trade-off
 +      between information loss and faster processing especially for
 +      workloads that can have a very long callchain stack.
 +
 +      Default: 127
 +
  --ignore-callees=<regex>::
          Ignore callees of the function(s) matching the given regex.
          This has the effect of collecting the callers of each such
 
               max_size, str);
        return -1;
  }
 -#endif /* LIBUNWIND_SUPPORT */
 +#endif /* HAVE_LIBUNWIND_SUPPORT */
  
- int record_parse_callchain_opt(const struct option *opt,
-                              const char *arg, int unset)
+ int record_parse_callchain(const char *arg, struct perf_record_opts *opts)
  {
-       struct perf_record_opts *opts = opt->value;
        char *tok, *name, *saveptr = NULL;
        char *buf;
        int ret = -1;
                                ret = get_stack_size(tok, &size);
                                opts->stack_dump_size = size;
                        }
- 
-                       if (!ret)
-                               pr_debug("callchain: stack dump size %d\n",
-                                        opts->stack_dump_size);
 -#endif /* LIBUNWIND_SUPPORT */
 +#endif /* HAVE_LIBUNWIND_SUPPORT */
                } else {
-                       pr_err("callchain: Unknown -g option "
+                       pr_err("callchain: Unknown --call-graph option "
                               "value: %s\n", arg);
                        break;
                }
        },
  };
  
- #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
+ #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
  
 -#ifdef LIBUNWIND_SUPPORT
 +#ifdef HAVE_LIBUNWIND_SUPPORT
- const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
+ const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
  #else
- const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
+ const char record_callchain_help[] = CALLCHAIN_HELP "fp";
  #endif
  
  /*
        OPT_BOOLEAN('i', "no-inherit", &record.opts.no_inherit,
                    "child tasks do not inherit counters"),
        OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this frequency"),
 -      OPT_UINTEGER('m', "mmap-pages", &record.opts.mmap_pages,
 -                   "number of mmap data pages"),
 +      OPT_CALLBACK('m', "mmap-pages", &record.opts.mmap_pages, "pages",
 +                   "number of mmap data pages",
 +                   perf_evlist__parse_mmap_pages),
        OPT_BOOLEAN(0, "group", &record.opts.group,
                    "put the counters into a counter group"),
-       OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts,
-                            "mode[,dump_size]", record_callchain_help,
-                            &record_parse_callchain_opt, "fp"),
+       OPT_CALLBACK_NOOPT('g', NULL, &record.opts,
+                          NULL, "enables call-graph recording" ,
+                          &record_callchain_opt),
+       OPT_CALLBACK(0, "call-graph", &record.opts,
+                    "mode[,dump_size]", record_callchain_help,
+                    &record_parse_callchain_opt),
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show counter open errors, etc)"),
        OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
 
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show counter open errors, etc)"),
        OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 -                 "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight"),
 +                 "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight,"
 +                 " abort, in_tx, transaction"),
        OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
                    "Show a column with the number of samples"),
-       OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts,
-                            "mode[,dump_size]", record_callchain_help,
-                            &parse_callchain_opt, "fp"),
+       OPT_CALLBACK_NOOPT('G', NULL, &top.record_opts,
+                          NULL, "enables call-graph recording",
+                          &callchain_opt),
+       OPT_CALLBACK(0, "call-graph", &top.record_opts,
+                    "mode[,dump_size]", record_callchain_help,
+                    &parse_callchain_opt),
 +      OPT_INTEGER(0, "max-stack", &top.max_stack,
 +                  "Set the maximum stack depth when parsing the callchain. "
 +                  "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
        OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
                   "ignore callees of these functions in call graphs",
                   report_parse_ignore_callees_opt),
 
                        err = perf_evlist__parse_sample(evlist, event, &sample);
                        if (err) {
                                fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err);
-                               continue;
+                               goto next_event;
                        }
  
 -                      if (trace->base_time == 0)
 +                      if (!trace->full_time && trace->base_time == 0)
                                trace->base_time = sample.time;
  
                        if (type != PERF_RECORD_SAMPLE) {
  
                        handler = evsel->handler.func;
                        handler(trace, evsel, &sample);
+ next_event:
+                       perf_evlist__mmap_consume(evlist, i);
  
 -                      if (done)
 -                              goto out_unmap_evlist;
 +                      if (interrupted)
 +                              goto out_disable;
                }
        }
  
 
                attr->sample_type       |= PERF_SAMPLE_WEIGHT;
  
        attr->mmap  = track;
-       attr->mmap2 = track && !perf_missing_features.mmap2;
        attr->comm  = track;
  
 +      if (opts->sample_transaction)
 +              attr->sample_type       |= PERF_SAMPLE_TRANSACTION;
 +
        /*
         * XXX see the function comment above
         *
 
  #include <pthread.h>
  #include "callchain.h"
  #include "header.h"
+ #include "color.h"
 +#include "ui/progress.h"
  
  extern struct callchain_param callchain_param;