static char const *input_name = "perf.data";
static char *vmlinux = NULL;
-static char *sort_order = "comm,dso";
+
+static char default_sort_order[] = "comm,dso";
+static char *sort_order = default_sort_order;
+
static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
if (!dso)
goto out_delete_dso;
- nr = dso__load(dso, NULL);
+ nr = dso__load(dso, NULL, verbose);
if (nr < 0) {
- fprintf(stderr, "Failed to open: %s\n", name);
+ if (verbose)
+ fprintf(stderr, "Failed to open: %s\n", name);
goto out_delete_dso;
}
if (!nr && verbose) {
if (!kernel_dso)
return -1;
- err = dso__load_kernel(kernel_dso, vmlinux, NULL);
+ err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose);
if (err) {
dso__delete(kernel_dso);
kernel_dso = NULL;
ret += hist_entry__fprintf(fp, pos, total_samples);
}
+ if (!strcmp(sort_order, default_sort_order)) {
+ fprintf(fp, "#\n");
+ fprintf(fp, "# ( For more details, try: perf report --sort comm,dso,symbol )\n");
+ fprintf(fp, "#\n");
+ }
+
return ret;
}
return ret;
}
-static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter)
+static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose)
{
struct rb_node *nd, *prevnd;
char *line = NULL;
}
static int dso__load_sym(struct dso *self, int fd, const char *name,
- symbol_filter_t filter)
+ symbol_filter_t filter, int verbose)
{
Elf_Data *symstrs;
uint32_t nr_syms;
elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
if (elf == NULL) {
- fprintf(stderr, "%s: cannot read %s ELF file.\n",
- __func__, name);
+ if (verbose)
+ fprintf(stderr, "%s: cannot read %s ELF file.\n",
+ __func__, name);
goto out_close;
}
if (gelf_getehdr(elf, &ehdr) == NULL) {
- fprintf(stderr, "%s: cannot get elf header.\n", __func__);
+ if (verbose)
+ fprintf(stderr, "%s: cannot get elf header.\n", __func__);
goto out_elf_end;
}
return err;
}
-int dso__load(struct dso *self, symbol_filter_t filter)
+int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
{
int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug");
char *name = malloc(size);
fd = open(name, O_RDONLY);
} while (fd < 0);
- ret = dso__load_sym(self, fd, name, filter);
+ ret = dso__load_sym(self, fd, name, filter, verbose);
close(fd);
/*
}
static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
- symbol_filter_t filter)
+ symbol_filter_t filter, int verbose)
{
int err, fd = open(vmlinux, O_RDONLY);
if (fd < 0)
return -1;
- err = dso__load_sym(self, fd, vmlinux, filter);
+ err = dso__load_sym(self, fd, vmlinux, filter, verbose);
close(fd);
return err;
}
-int dso__load_kernel(struct dso *self, const char *vmlinux, symbol_filter_t filter)
+int dso__load_kernel(struct dso *self, const char *vmlinux,
+ symbol_filter_t filter, int verbose)
{
int err = -1;
if (vmlinux)
- err = dso__load_vmlinux(self, vmlinux, filter);
+ err = dso__load_vmlinux(self, vmlinux, filter, verbose);
if (err)
- err = dso__load_kallsyms(self, filter);
+ err = dso__load_kallsyms(self, filter, verbose);
return err;
}