Commit 56ee04aa authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-core-for-mingo-5.6-20200116' of...

Merge tag 'perf-core-for-mingo-5.6-20200116' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

perf report:

  Andi Kleen:

  - Clarify in help that --children is default.

  Jin Yao:

  - Fix no libunwind compiled warning breaking s390.

perf annotate/report/top:

  Andi Kleen:

  - Support --prefix/--prefix-strip, use it with objdump when doing disassembly.

perf c2c:

  Andres Freund:

  - Fix return type for histogram sorting comparision functions.

perf header:

  Michael Petlan:

  - Use last modification time for timestamp, i.e. st.st_mtime instead
    of the st_ctime.

perf beauty:

  Cengiz Can:

  - Fix sockaddr printf format for long integers.

libperf:

  Jiri Olsa:

  - Setup initial evlist::all_cpus value

perf parser:

  Jiri Olsa:

  - Use %define api.pure full instead of %pure-parser, nuking warning
    from bison about using deprecated stuff.

perf ui gtk:

  - Add missing zalloc object, fixing gtk browser build.

perf clang:

  Maciej S. Szmigiero:

  - Fix build issues with Clang 9 and 8+.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents cb6c82df 8af19d66
...@@ -197,7 +197,7 @@ $(OUTPUT)test-libcrypto.bin: ...@@ -197,7 +197,7 @@ $(OUTPUT)test-libcrypto.bin:
$(BUILD) -lcrypto $(BUILD) -lcrypto
$(OUTPUT)test-gtk2.bin: $(OUTPUT)test-gtk2.bin:
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations
$(OUTPUT)test-gtk2-infobar.bin: $(OUTPUT)test-gtk2-infobar.bin:
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "clang/Basic/Version.h"
#if CLANG_VERSION_MAJOR < 8
#include "clang/Basic/VirtualFileSystem.h" #include "clang/Basic/VirtualFileSystem.h"
#endif
#include "clang/Driver/Driver.h" #include "clang/Driver/Driver.h"
#include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/TextDiagnosticPrinter.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/ManagedStatic.h"
#if CLANG_VERSION_MAJOR >= 8
#include "llvm/Support/VirtualFileSystem.h"
#endif
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace clang; using namespace clang;
......
...@@ -164,6 +164,9 @@ void perf_evlist__set_maps(struct perf_evlist *evlist, ...@@ -164,6 +164,9 @@ void perf_evlist__set_maps(struct perf_evlist *evlist,
evlist->threads = perf_thread_map__get(threads); evlist->threads = perf_thread_map__get(threads);
} }
if (!evlist->all_cpus && cpus)
evlist->all_cpus = perf_cpu_map__get(cpus);
perf_evlist__propagate_maps(evlist); perf_evlist__propagate_maps(evlist);
} }
......
...@@ -112,6 +112,12 @@ OPTIONS ...@@ -112,6 +112,12 @@ OPTIONS
--objdump=<path>:: --objdump=<path>::
Path to objdump binary. Path to objdump binary.
--prefix=PREFIX::
--prefix-strip=N::
Remove first N entries from source file path names in executables
and add PREFIX. This allows to display source code compiled on systems
with different file system layout.
--skip-missing:: --skip-missing::
Skip symbols that cannot be annotated. Skip symbols that cannot be annotated.
......
...@@ -367,6 +367,12 @@ OPTIONS ...@@ -367,6 +367,12 @@ OPTIONS
--objdump=<path>:: --objdump=<path>::
Path to objdump binary. Path to objdump binary.
--prefix=PREFIX::
--prefix-strip=N::
Remove first N entries from source file path names in executables
and add PREFIX. This allows to display source code compiled on systems
with different file system layout.
--group:: --group::
Show event group information together. It forces group output also Show event group information together. It forces group output also
if there are no groups defined in data file. if there are no groups defined in data file.
......
...@@ -158,6 +158,12 @@ Default is to monitor all CPUS. ...@@ -158,6 +158,12 @@ Default is to monitor all CPUS.
-M:: -M::
--disassembler-style=:: Set disassembler style for objdump. --disassembler-style=:: Set disassembler style for objdump.
--prefix=PREFIX::
--prefix-strip=N::
Remove first N entries from source file path names in executables
and add PREFIX. This allows to display source code compiled on systems
with different file system layout.
--source:: --source::
Interleave source code with assembly code. Enabled by default, Interleave source code with assembly code. Enabled by default,
disable with --no-source. disable with --no-source.
......
...@@ -535,6 +535,10 @@ int cmd_annotate(int argc, const char **argv) ...@@ -535,6 +535,10 @@ int cmd_annotate(int argc, const char **argv)
"Display raw encoding of assembly instructions (default)"), "Display raw encoding of assembly instructions (default)"),
OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style", OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"), "Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_STRING(0, "prefix", &annotate.opts.prefix, "prefix",
"Add prefix to source file path names in programs (with --prefix-strip)"),
OPT_STRING(0, "prefix-strip", &annotate.opts.prefix_strip, "N",
"Strip first N entries of source file path name in programs (with --prefix)"),
OPT_STRING(0, "objdump", &annotate.opts.objdump_path, "path", OPT_STRING(0, "objdump", &annotate.opts.objdump_path, "path",
"objdump binary to use for disassembly and annotations"), "objdump binary to use for disassembly and annotations"),
OPT_BOOLEAN(0, "group", &symbol_conf.event_group, OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
...@@ -574,6 +578,9 @@ int cmd_annotate(int argc, const char **argv) ...@@ -574,6 +578,9 @@ int cmd_annotate(int argc, const char **argv)
annotate.sym_hist_filter = argv[0]; annotate.sym_hist_filter = argv[0];
} }
if (annotate_check_args(&annotate.opts) < 0)
return -EINVAL;
if (symbol_conf.show_nr_samples && annotate.use_gtk) { if (symbol_conf.show_nr_samples && annotate.use_gtk) {
pr_err("--show-nr-samples is not available in --gtk mode at this time\n"); pr_err("--show-nr-samples is not available in --gtk mode at this time\n");
return ret; return ret;
......
...@@ -595,8 +595,8 @@ tot_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused, ...@@ -595,8 +595,8 @@ tot_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
{ {
struct c2c_hist_entry *c2c_left; struct c2c_hist_entry *c2c_left;
struct c2c_hist_entry *c2c_right; struct c2c_hist_entry *c2c_right;
unsigned int tot_hitm_left; uint64_t tot_hitm_left;
unsigned int tot_hitm_right; uint64_t tot_hitm_right;
c2c_left = container_of(left, struct c2c_hist_entry, he); c2c_left = container_of(left, struct c2c_hist_entry, he);
c2c_right = container_of(right, struct c2c_hist_entry, he); c2c_right = container_of(right, struct c2c_hist_entry, he);
...@@ -629,7 +629,8 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \ ...@@ -629,7 +629,8 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \
\ \
c2c_left = container_of(left, struct c2c_hist_entry, he); \ c2c_left = container_of(left, struct c2c_hist_entry, he); \
c2c_right = container_of(right, struct c2c_hist_entry, he); \ c2c_right = container_of(right, struct c2c_hist_entry, he); \
return c2c_left->stats.__f - c2c_right->stats.__f; \ return (uint64_t) c2c_left->stats.__f - \
(uint64_t) c2c_right->stats.__f; \
} }
#define STAT_FN(__f) \ #define STAT_FN(__f) \
...@@ -682,7 +683,8 @@ ld_llcmiss_cmp(struct perf_hpp_fmt *fmt __maybe_unused, ...@@ -682,7 +683,8 @@ ld_llcmiss_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
c2c_left = container_of(left, struct c2c_hist_entry, he); c2c_left = container_of(left, struct c2c_hist_entry, he);
c2c_right = container_of(right, struct c2c_hist_entry, he); c2c_right = container_of(right, struct c2c_hist_entry, he);
return llc_miss(&c2c_left->stats) - llc_miss(&c2c_right->stats); return (uint64_t) llc_miss(&c2c_left->stats) -
(uint64_t) llc_miss(&c2c_right->stats);
} }
static uint64_t total_records(struct c2c_stats *stats) static uint64_t total_records(struct c2c_stats *stats)
......
...@@ -412,10 +412,10 @@ static int report__setup_sample_type(struct report *rep) ...@@ -412,10 +412,10 @@ static int report__setup_sample_type(struct report *rep)
PERF_SAMPLE_BRANCH_ANY)) PERF_SAMPLE_BRANCH_ANY))
rep->nonany_branch_mode = true; rep->nonany_branch_mode = true;
#ifndef HAVE_LIBUNWIND_SUPPORT #if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT)
if (dwarf_callchain_users) { if (dwarf_callchain_users) {
ui__warning("Please install libunwind development packages " ui__warning("Please install libunwind or libdw "
"during the perf build.\n"); "development packages during the perf build.\n");
} }
#endif #endif
...@@ -1164,7 +1164,8 @@ int cmd_report(int argc, const char **argv) ...@@ -1164,7 +1164,8 @@ int cmd_report(int argc, const char **argv)
report_callchain_help, &report_parse_callchain_opt, report_callchain_help, &report_parse_callchain_opt,
callchain_default_opt), callchain_default_opt),
OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain, OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
"Accumulate callchains of children and show total overhead as well"), "Accumulate callchains of children and show total overhead as well. "
"Enabled by default, use --no-children to disable."),
OPT_INTEGER(0, "max-stack", &report.max_stack, OPT_INTEGER(0, "max-stack", &report.max_stack,
"Set the maximum stack depth when parsing the callchain, " "Set the maximum stack depth when parsing the callchain, "
"anything beyond the specified depth will be ignored. " "anything beyond the specified depth will be ignored. "
...@@ -1207,6 +1208,10 @@ int cmd_report(int argc, const char **argv) ...@@ -1207,6 +1208,10 @@ int cmd_report(int argc, const char **argv)
"Display raw encoding of assembly instructions (default)"), "Display raw encoding of assembly instructions (default)"),
OPT_STRING('M', "disassembler-style", &report.annotation_opts.disassembler_style, "disassembler style", OPT_STRING('M', "disassembler-style", &report.annotation_opts.disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"), "Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_STRING(0, "prefix", &report.annotation_opts.prefix, "prefix",
"Add prefix to source file path names in programs (with --prefix-strip)"),
OPT_STRING(0, "prefix-strip", &report.annotation_opts.prefix_strip, "N",
"Strip first N entries of source file path name in programs (with --prefix)"),
OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
"Show a column with the sum of periods"), "Show a column with the sum of periods"),
OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group, &report.group_set, OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group, &report.group_set,
...@@ -1286,6 +1291,9 @@ int cmd_report(int argc, const char **argv) ...@@ -1286,6 +1291,9 @@ int cmd_report(int argc, const char **argv)
report.symbol_filter_str = argv[0]; report.symbol_filter_str = argv[0];
} }
if (annotate_check_args(&report.annotation_opts) < 0)
return -EINVAL;
if (report.mmaps_mode) if (report.mmaps_mode)
report.tasks_mode = true; report.tasks_mode = true;
......
...@@ -1512,6 +1512,10 @@ int cmd_top(int argc, const char **argv) ...@@ -1512,6 +1512,10 @@ int cmd_top(int argc, const char **argv)
"objdump binary to use for disassembly and annotations"), "objdump binary to use for disassembly and annotations"),
OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style", OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"), "Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_STRING(0, "prefix", &top.annotation_opts.prefix, "prefix",
"Add prefix to source file path names in programs (with --prefix-strip)"),
OPT_STRING(0, "prefix-strip", &top.annotation_opts.prefix_strip, "N",
"Strip first N entries of source file path name in programs (with --prefix)"),
OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
OPT_CALLBACK(0, "percent-limit", &top, "percent", OPT_CALLBACK(0, "percent-limit", &top, "percent",
"Don't show entries under that percent", parse_percent_limit), "Don't show entries under that percent", parse_percent_limit),
...@@ -1582,6 +1586,9 @@ int cmd_top(int argc, const char **argv) ...@@ -1582,6 +1586,9 @@ int cmd_top(int argc, const char **argv)
if (argc) if (argc)
usage_with_options(top_usage, options); usage_with_options(top_usage, options);
if (annotate_check_args(&top.annotation_opts) < 0)
goto out_delete_evlist;
if (!top.evlist->core.nr_entries && if (!top.evlist->core.nr_entries &&
perf_evlist__add_default(top.evlist) < 0) { perf_evlist__add_default(top.evlist) < 0) {
pr_err("Not enough memory for event selector list\n"); pr_err("Not enough memory for event selector list\n");
......
...@@ -72,5 +72,5 @@ size_t syscall_arg__scnprintf_sockaddr(char *bf, size_t size, struct syscall_arg ...@@ -72,5 +72,5 @@ size_t syscall_arg__scnprintf_sockaddr(char *bf, size_t size, struct syscall_arg
if (arg->augmented.args) if (arg->augmented.args)
return syscall_arg__scnprintf_augmented_sockaddr(arg, bf, size); return syscall_arg__scnprintf_augmented_sockaddr(arg, bf, size);
return scnprintf(bf, size, "%#x", arg->val); return scnprintf(bf, size, "%#lx", arg->val);
} }
CFLAGS_gtk += -fPIC $(GTK_CFLAGS) CFLAGS_gtk += -fPIC $(GTK_CFLAGS) -Wno-deprecated-declarations
gtk-y += browser.o gtk-y += browser.o
gtk-y += hists.o gtk-y += hists.o
...@@ -7,3 +7,8 @@ gtk-y += util.o ...@@ -7,3 +7,8 @@ gtk-y += util.o
gtk-y += helpline.o gtk-y += helpline.o
gtk-y += progress.o gtk-y += progress.o
gtk-y += annotate.o gtk-y += annotate.o
gtk-y += zalloc.o
$(OUTPUT)ui/gtk/zalloc.o: ../lib/zalloc.c FORCE
$(call rule_mkdir)
$(call if_changed_dep,cc_o_c)
...@@ -1966,14 +1966,20 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) ...@@ -1966,14 +1966,20 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
err = asprintf(&command, err = asprintf(&command,
"%s %s%s --start-address=0x%016" PRIx64 "%s %s%s --start-address=0x%016" PRIx64
" --stop-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64
" -l -d %s %s -C \"$1\"", " -l -d %s %s %s %c%s%c %s%s -C \"$1\"",
opts->objdump_path ?: "objdump", opts->objdump_path ?: "objdump",
opts->disassembler_style ? "-M " : "", opts->disassembler_style ? "-M " : "",
opts->disassembler_style ?: "", opts->disassembler_style ?: "",
map__rip_2objdump(map, sym->start), map__rip_2objdump(map, sym->start),
map__rip_2objdump(map, sym->end), map__rip_2objdump(map, sym->end),
opts->show_asm_raw ? "" : "--no-show-raw-insn", opts->show_asm_raw ? "" : "--no-show-raw-insn",
opts->annotate_src ? "-S" : ""); opts->annotate_src ? "-S" : "",
opts->prefix ? "--prefix " : "",
opts->prefix ? '"' : ' ',
opts->prefix ?: "",
opts->prefix ? '"' : ' ',
opts->prefix_strip ? "--prefix-strip=" : "",
opts->prefix_strip ?: "");
if (err < 0) { if (err < 0) {
pr_err("Failure allocating memory for the command to run\n"); pr_err("Failure allocating memory for the command to run\n");
...@@ -3204,3 +3210,12 @@ int annotate_parse_percent_type(const struct option *opt, const char *_str, ...@@ -3204,3 +3210,12 @@ int annotate_parse_percent_type(const struct option *opt, const char *_str,
free(str1); free(str1);
return err; return err;
} }
int annotate_check_args(struct annotation_options *args)
{
if (args->prefix_strip && !args->prefix) {
pr_err("--prefix-strip requires --prefix\n");
return -1;
}
return 0;
}
...@@ -94,6 +94,8 @@ struct annotation_options { ...@@ -94,6 +94,8 @@ struct annotation_options {
int context; int context;
const char *objdump_path; const char *objdump_path;
const char *disassembler_style; const char *disassembler_style;
const char *prefix;
const char *prefix_strip;
unsigned int percent_type; unsigned int percent_type;
}; };
...@@ -415,4 +417,7 @@ void annotation_config__init(void); ...@@ -415,4 +417,7 @@ void annotation_config__init(void);
int annotate_parse_percent_type(const struct option *opt, const char *_str, int annotate_parse_percent_type(const struct option *opt, const char *_str,
int unset); int unset);
int annotate_check_args(struct annotation_options *args);
#endif /* __PERF_ANNOTATE_H */ #endif /* __PERF_ANNOTATE_H */
...@@ -71,7 +71,11 @@ getModuleFromSource(llvm::opt::ArgStringList CFlags, ...@@ -71,7 +71,11 @@ getModuleFromSource(llvm::opt::ArgStringList CFlags,
CompilerInstance Clang; CompilerInstance Clang;
Clang.createDiagnostics(); Clang.createDiagnostics();
#if CLANG_VERSION_MAJOR < 9
Clang.setVirtualFileSystem(&*VFS); Clang.setVirtualFileSystem(&*VFS);
#else
Clang.createFileManager(&*VFS);
#endif
#if CLANG_VERSION_MAJOR < 4 #if CLANG_VERSION_MAJOR < 4
IntrusiveRefCntPtr<CompilerInvocation> CI = IntrusiveRefCntPtr<CompilerInvocation> CI =
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
#define MAXIDLEN 256 #define MAXIDLEN 256
%} %}
%pure-parser %define api.pure full
%parse-param { double *final_val } %parse-param { double *final_val }
%parse-param { struct parse_ctx *ctx } %parse-param { struct parse_ctx *ctx }
%parse-param { const char **pp } %parse-param { const char **pp }
......
...@@ -2922,7 +2922,7 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full) ...@@ -2922,7 +2922,7 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full)
if (ret == -1) if (ret == -1)
return -1; return -1;
stctime = st.st_ctime; stctime = st.st_mtime;
fprintf(fp, "# captured on : %s", ctime(&stctime)); fprintf(fp, "# captured on : %s", ctime(&stctime));
fprintf(fp, "# header version : %u\n", header->version); fprintf(fp, "# header version : %u\n", header->version);
......
%pure-parser %define api.pure full
%parse-param {void *_parse_state} %parse-param {void *_parse_state}
%parse-param {void *scanner} %parse-param {void *scanner}
%lex-param {void* scanner} %lex-param {void* scanner}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment