Release 4.10 tools/perf/util/sort.c
#include <sys/mman.h>
#include "sort.h"
#include "hist.h"
#include "comm.h"
#include "symbol.h"
#include "evsel.h"
#include "evlist.h"
#include <traceevent/event-parse.h>
#include "mem-events.h"
regex_t parent_regex;
const char default_parent_pattern[] = "^sys_|^do_page_fault";
const char *parent_pattern = default_parent_pattern;
const char *default_sort_order = "comm,dso,symbol";
const char default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles";
const char default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked";
const char default_top_sort_order[] = "dso,symbol";
const char default_diff_sort_order[] = "dso,symbol";
const char default_tracepoint_sort_order[] = "trace";
const char *sort_order;
const char *field_order;
regex_t ignore_callees_regex;
int have_ignore_callees = 0;
enum sort_mode sort__mode = SORT_MODE__NORMAL;
/*
* Replaces all occurrences of a char used with the:
*
* -t, --field-separator
*
* option, that uses a special separator character and don't pad with spaces,
* replacing all occurances of this separator in symbol names (and other
* output) with a '.' character, that thus it's the only non valid separator.
*/
static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...)
{
int n;
va_list ap;
va_start(ap, fmt);
n = vsnprintf(bf, size, fmt, ap);
if (symbol_conf.field_sep && n > 0) {
char *sep = bf;
while (1) {
sep = strchr(sep, *symbol_conf.field_sep);
if (sep == NULL)
break;
*sep = '.';
}
}
va_end(ap);
if (n >= (int)size)
return size - 1;
return n;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
john kacur | john kacur | 86 | 74.14% | 1 | 25.00% |
anton blanchard | anton blanchard | 14 | 12.07% | 1 | 25.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 12 | 10.34% | 1 | 25.00% |
jiri olsa | jiri olsa | 4 | 3.45% | 1 | 25.00% |
| Total | 116 | 100.00% | 4 | 100.00% |
static int64_t cmp_null(const void *l, const void *r)
{
if (!l && !r)
return 0;
else if (!l)
return -1;
else
return 1;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
frederic weisbecker | frederic weisbecker | 41 | 100.00% | 2 | 100.00% |
| Total | 41 | 100.00% | 2 | 100.00% |
/* --sort pid */
static int64_t
sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
{
return right->thread->tid - left->thread->tid;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
frederic weisbecker | frederic weisbecker | 27 | 93.10% | 1 | 50.00% |
adrian hunter | adrian hunter | 2 | 6.90% | 1 | 50.00% |
| Total | 29 | 100.00% | 2 | 100.00% |
static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
const char *comm = thread__comm_str(he->thread);
width = max(7U, width) - 8;
return repsep_snprintf(bf, size, "%7d:%-*.*s", he->thread->tid,
width, width, comm ?: "");
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
frederic weisbecker | frederic weisbecker | 29 | 41.43% | 2 | 25.00% |
namhyung kim | namhyung kim | 18 | 25.71% | 2 | 25.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 11 | 15.71% | 2 | 25.00% |
john kacur | john kacur | 10 | 14.29% | 1 | 12.50% |
jiri olsa | jiri olsa | 2 | 2.86% | 1 | 12.50% |
| Total | 70 | 100.00% | 8 | 100.00% |
static int hist_entry__thread_filter(struct hist_entry *he, int type, const void *arg)
{
const struct thread *th = arg;
if (type != HIST_FILTER__THREAD)
return -1;
return th && he->thread != th;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 46 | 100.00% | 1 | 100.00% |
| Total | 46 | 100.00% | 1 | 100.00% |
struct sort_entry sort_thread = {
.se_header = " Pid:Command",
.se_cmp = sort__thread_cmp,
.se_snprintf = hist_entry__thread_snprintf,
.se_filter = hist_entry__thread_filter,
.se_width_idx = HISTC_THREAD,
};
/* --sort comm */
static int64_t
sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
{
/* Compare the addr that should be unique among comm */
return strcmp(comm__str(right->comm), comm__str(left->comm));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
frederic weisbecker | frederic weisbecker | 27 | 77.14% | 2 | 50.00% |
jiri olsa | jiri olsa | 4 | 11.43% | 1 | 25.00% |
namhyung kim | namhyung kim | 4 | 11.43% | 1 | 25.00% |
| Total | 35 | 100.00% | 4 | 100.00% |
static int64_t
sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
{
/* Compare the addr that should be unique among comm */
return strcmp(comm__str(right->comm), comm__str(left->comm));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
frederic weisbecker | frederic weisbecker | 19 | 54.29% | 2 | 40.00% |
namhyung kim | namhyung kim | 8 | 22.86% | 1 | 20.00% |
john kacur | john kacur | 4 | 11.43% | 1 | 20.00% |
jiri olsa | jiri olsa | 4 | 11.43% | 1 | 20.00% |
| Total | 35 | 100.00% | 5 | 100.00% |
static int64_t
sort__comm_sort(struct hist_entry *left, struct hist_entry *right)
{
return strcmp(comm__str(right->comm), comm__str(left->comm));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 34 | 100.00% | 1 | 100.00% |
| Total | 34 | 100.00% | 1 | 100.00% |
static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return repsep_snprintf(bf, size, "%-*.*s", width, width, comm__str(he->comm));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
john kacur | john kacur | 20 | 46.51% | 1 | 16.67% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 16 | 37.21% | 2 | 33.33% |
namhyung kim | namhyung kim | 5 | 11.63% | 2 | 33.33% |
frederic weisbecker | frederic weisbecker | 2 | 4.65% | 1 | 16.67% |
| Total | 43 | 100.00% | 6 | 100.00% |
struct sort_entry sort_comm = {
.se_header = "Command",
.se_cmp = sort__comm_cmp,
.se_collapse = sort__comm_collapse,
.se_sort = sort__comm_sort,
.se_snprintf = hist_entry__comm_snprintf,
.se_filter = hist_entry__thread_filter,
.se_width_idx = HISTC_COMM,
};
/* --sort dso */
static int64_t _sort__dso_cmp(struct map *map_l, struct map *map_r)
{
struct dso *dso_l = map_l ? map_l->dso : NULL;
struct dso *dso_r = map_r ? map_r->dso : NULL;
const char *dso_name_l, *dso_name_r;
if (!dso_l || !dso_r)
return cmp_null(dso_r, dso_l);
if (verbose) {
dso_name_l = dso_l->long_name;
dso_name_r = dso_r->long_name;
} else {
dso_name_l = dso_l->short_name;
dso_name_r = dso_r->short_name;
}
return strcmp(dso_name_l, dso_name_r);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arnaldo carvalho de melo | arnaldo carvalho de melo | 51 | 47.66% | 1 | 20.00% |
john kacur | john kacur | 44 | 41.12% | 1 | 20.00% |
roberto agostino vitillo | roberto agostino vitillo | 9 | 8.41% | 1 | 20.00% |
namhyung kim | namhyung kim | 2 | 1.87% | 1 | 20.00% |
frederic weisbecker | frederic weisbecker | 1 | 0.93% | 1 | 20.00% |
| Total | 107 | 100.00% | 5 | 100.00% |
static int64_t
sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
{
return _sort__dso_cmp(right->ms.map, left->ms.map);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
roberto agostino vitillo | roberto agostino vitillo | 25 | 78.12% | 1 | 25.00% |
john kacur | john kacur | 4 | 12.50% | 1 | 25.00% |
namhyung kim | namhyung kim | 2 | 6.25% | 1 | 25.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 1 | 3.12% | 1 | 25.00% |
| Total | 32 | 100.00% | 4 | 100.00% |
static int _hist_entry__dso_snprintf(struct map *map, char *bf,
size_t size, unsigned int width)
{
if (map && map->dso) {
const char *dso_name = !verbose ? map->dso->short_name :
map->dso->long_name;
return repsep_snprintf(bf, size, "%-*.*s", width, width, dso_name);
}
return repsep_snprintf(bf, size, "%-*.*s", width, width, "[unknown]");
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arnaldo carvalho de melo | arnaldo carvalho de melo | 42 | 50.00% | 2 | 33.33% |
john kacur | john kacur | 27 | 32.14% | 1 | 16.67% |
roberto agostino vitillo | roberto agostino vitillo | 8 | 9.52% | 1 | 16.67% |
namhyung kim | namhyung kim | 6 | 7.14% | 1 | 16.67% |
ian munsie | ian munsie | 1 | 1.19% | 1 | 16.67% |
| Total | 84 | 100.00% | 6 | 100.00% |
static int hist_entry__dso_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return _hist_entry__dso_snprintf(he->ms.map, bf, size, width);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 15 | 39.47% | 1 | 20.00% |
roberto agostino vitillo | roberto agostino vitillo | 13 | 34.21% | 1 | 20.00% |
john kacur | john kacur | 7 | 18.42% | 1 | 20.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 2 | 5.26% | 1 | 20.00% |
anton blanchard | anton blanchard | 1 | 2.63% | 1 | 20.00% |
| Total | 38 | 100.00% | 5 | 100.00% |
static int hist_entry__dso_filter(struct hist_entry *he, int type, const void *arg)
{
const struct dso *dso = arg;
if (type != HIST_FILTER__DSO)
return -1;
return dso && (!he->ms.map || he->ms.map->dso != dso);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 59 | 100.00% | 1 | 100.00% |
| Total | 59 | 100.00% | 1 | 100.00% |
struct sort_entry sort_dso = {
.se_header = "Shared Object",
.se_cmp = sort__dso_cmp,
.se_snprintf = hist_entry__dso_snprintf,
.se_filter = hist_entry__dso_filter,
.se_width_idx = HISTC_DSO,
};
/* --sort symbol */
static int64_t _sort__addr_cmp(u64 left_ip, u64 right_ip)
{
return (int64_t)(right_ip - left_ip);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 22 | 100.00% | 1 | 100.00% |
| Total | 22 | 100.00% | 1 | 100.00% |
static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
{
if (!sym_l || !sym_r)
return cmp_null(sym_l, sym_r);
if (sym_l == sym_r)
return 0;
if (sym_l->start != sym_r->start)
return (int64_t)(sym_r->start - sym_l->start);
return (int64_t)(sym_r->end - sym_l->end);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 55 | 69.62% | 2 | 66.67% |
yannick brosseau | yannick brosseau | 24 | 30.38% | 1 | 33.33% |
| Total | 79 | 100.00% | 3 | 100.00% |
static int64_t
sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
{
int64_t ret;
if (!left->ms.sym && !right->ms.sym)
return _sort__addr_cmp(left->ip, right->ip);
/*
* comparing symbol address alone is not enough since it's a
* relative address within a dso.
*/
if (!hists__has(left->hists, dso) || hists__has(right->hists, dso)) {
ret = sort__dso_cmp(left, right);
if (ret != 0)
return ret;
}
return _sort__sym_cmp(left->ms.sym, right->ms.sym);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 80 | 76.19% | 4 | 50.00% |
jiri olsa | jiri olsa | 17 | 16.19% | 1 | 12.50% |
john kacur | john kacur | 4 | 3.81% | 1 | 12.50% |
anton blanchard | anton blanchard | 2 | 1.90% | 1 | 12.50% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 2 | 1.90% | 1 | 12.50% |
| Total | 105 | 100.00% | 8 | 100.00% |
static int64_t
sort__sym_sort(struct hist_entry *left, struct hist_entry *right)
{
if (!left->ms.sym || !right->ms.sym)
return cmp_null(left->ms.sym, right->ms.sym);
return strcmp(right->ms.sym->name, left->ms.sym->name);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 68 | 100.00% | 1 | 100.00% |
| Total | 68 | 100.00% | 1 | 100.00% |
static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
u64 ip, char level, char *bf, size_t size,
unsigned int width)
{
size_t ret = 0;
if (verbose) {
char o = map ? dso__symtab_origin(map->dso) : '!';
ret += repsep_snprintf(bf, size, "%-#*llx %c ",
BITS_PER_LONG / 4 + 2, ip, o);
}
ret += repsep_snprintf(bf + ret, size - ret, "[%c] ", level);
if (sym && map) {
if (map->type == MAP__VARIABLE) {
ret += repsep_snprintf(bf + ret, size - ret, "%s", sym->name);
ret += repsep_snprintf(bf + ret, size - ret, "+0x%llx",
ip - map->unmap_ip(map, sym->start));
} else {
ret += repsep_snprintf(bf + ret, size - ret, "%.*s",
width - ret,
sym->name);
}
} else {
size_t len = BITS_PER_LONG / 4;
ret += repsep_snprintf(bf + ret, size - ret, "%-#.*llx",
len, ip);
}
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
stephane eranian | stephane eranian | 57 | 26.03% | 1 | 8.33% |
john kacur | john kacur | 47 | 21.46% | 1 | 8.33% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 44 | 20.09% | 4 | 33.33% |
frederic weisbecker | frederic weisbecker | 31 | 14.16% | 1 | 8.33% |
roberto agostino vitillo | roberto agostino vitillo | 29 | 13.24% | 1 | 8.33% |
namhyung kim | namhyung kim | 10 | 4.57% | 3 | 25.00% |
ian munsie | ian munsie | 1 | 0.46% | 1 | 8.33% |
| Total | 219 | 100.00% | 12 | 100.00% |
static int hist_entry__sym_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return _hist_entry__sym_snprintf(he->ms.map, he->ms.sym, he->ip,
he->level, bf, size, width);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
roberto agostino vitillo | roberto agostino vitillo | 41 | 78.85% | 1 | 25.00% |
john kacur | john kacur | 5 | 9.62% | 1 | 25.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 5 | 9.62% | 1 | 25.00% |
frederic weisbecker | frederic weisbecker | 1 | 1.92% | 1 | 25.00% |
| Total | 52 | 100.00% | 4 | 100.00% |
static int hist_entry__sym_filter(struct hist_entry *he, int type, const void *arg)
{
const char *sym = arg;
if (type != HIST_FILTER__SYMBOL)
return -1;
return sym && (!he->ms.sym || !strstr(he->ms.sym->name, sym));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 62 | 100.00% | 1 | 100.00% |
| Total | 62 | 100.00% | 1 | 100.00% |
struct sort_entry sort_sym = {
.se_header = "Symbol",
.se_cmp = sort__sym_cmp,
.se_sort = sort__sym_sort,
.se_snprintf = hist_entry__sym_snprintf,
.se_filter = hist_entry__sym_filter,
.se_width_idx = HISTC_SYMBOL,
};
/* --sort srcline */
char *hist_entry__get_srcline(struct hist_entry *he)
{
struct map *map = he->ms.map;
if (!map)
return SRCLINE_UNKNOWN;
return get_srcline(map->dso, map__rip_2objdump(map, he->ip),
he->ms.sym, true);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 39 | 70.91% | 2 | 40.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 8 | 14.55% | 1 | 20.00% |
andi kleen | andi kleen | 7 | 12.73% | 1 | 20.00% |
thomas jarosch | thomas jarosch | 1 | 1.82% | 1 | 20.00% |
| Total | 55 | 100.00% | 5 | 100.00% |
static int64_t
sort__srcline_cmp(struct hist_entry *left, struct hist_entry *right)
{
if (!left->srcline)
left->srcline = hist_entry__get_srcline(left);
if (!right->srcline)
right->srcline = hist_entry__get_srcline(right);
return strcmp(right->srcline, left->srcline);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 51 | 85.00% | 5 | 62.50% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 6 | 10.00% | 1 | 12.50% |
thomas jarosch | thomas jarosch | 2 | 3.33% | 1 | 12.50% |
andi kleen | andi kleen | 1 | 1.67% | 1 | 12.50% |
| Total | 60 | 100.00% | 8 | 100.00% |
static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
if (!he->srcline)
he->srcline = hist_entry__get_srcline(he);
return repsep_snprintf(bf, size, "%-.*s", width, he->srcline);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
namhyung kim | namhyung kim | 40 | 74.07% | 4 | 66.67% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 14 | 25.93% | 2 | 33.33% |
| Total | 54 | 100.00% | 6 | 100.00% |
struct sort_entry sort_srcline = {
.se_header = "Source:Line",
.se_cmp = sort__srcline_cmp,
.se_snprintf = hist_entry__srcline_snprintf,
.se_width_idx = HISTC_SRCLINE,
};
/* --sort srcline_from */
static int64_t
sort__srcline_from_cmp(struct hist_entry *left, struct hist_entry *right)
{
if (!left->branch_info->srcline_from) {
struct map *map = left->branch_info->from.map;
if (!map)
left->branch_info->srcline_from = SRCLINE_UNKNOWN;
else
left->branch_info->srcline_from = get_srcline(map->dso,
map__rip_2objdump(map,
left->branch_info->from.al_addr),
left->branch_info->from.sym, true);
}
if (!right->branch_info->srcline_from) {
struct map *map = right->branch_info->from.map;
if (!map)
right->branch_info->srcline_from = SRCLINE_UNKNOWN;
else
right->branch_info->srcline_from = get_srcline(map->dso,
map__rip_2objdump(map,
right->branch_info->from.al_addr),
right->branch_info->from.sym, true);
}
return strcmp(right->branch_info->srcline_from, left->branch_info->srcline_from);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 180 | 100.00% | 1 | 100.00% |
| Total | 180 | 100.00% | 1 | 100.00% |
static int hist_entry__srcline_from_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return repsep_snprintf(bf, size, "%-*.*s", width, width, he->branch_info->srcline_from);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 42 | 100.00% | 1 | 100.00% |
| Total | 42 | 100.00% | 1 | 100.00% |
struct sort_entry sort_srcline_from = {
.se_header = "From Source:Line",
.se_cmp = sort__srcline_from_cmp,
.se_snprintf = hist_entry__srcline_from_snprintf,
.se_width_idx = HISTC_SRCLINE_FROM,
};
/* --sort srcline_to */
static int64_t
sort__srcline_to_cmp(struct hist_entry *left, struct hist_entry *right)
{
if (!left->branch_info->srcline_to) {
struct map *map = left->branch_info->to.map;
if (!map)
left->branch_info->srcline_to = SRCLINE_UNKNOWN;
else
left->branch_info->srcline_to = get_srcline(map->dso,
map__rip_2objdump(map,
left->branch_info->to.al_addr),
left->branch_info->from.sym, true);
}
if (!right->branch_info->srcline_to) {
struct map *map = right->branch_info->to.map;
if (!map)
right->branch_info->srcline_to = SRCLINE_UNKNOWN;
else
right->branch_info->srcline_to = get_srcline(map->dso,
map__rip_2objdump(map,
right->branch_info->to.al_addr),
right->branch_info->to.sym, true);
}
return strcmp(right->branch_info->srcline_to, left->branch_info->srcline_to);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 180 | 100.00% | 1 | 100.00% |
| Total | 180 | 100.00% | 1 | 100.00% |
static int hist_entry__srcline_to_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return repsep_snprintf(bf, size, "%-*.*s", width, width, he->branch_info->srcline_to);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 42 | 100.00% | 1 | 100.00% |
| Total | 42 | 100.00% | 1 | 100.00% |
struct sort_entry sort_srcline_to = {
.se_header = "To Source:Line",
.se_cmp = sort__srcline_to_cmp,
.se_snprintf = hist_entry__srcline_to_snprintf,
.se_width_idx = HISTC_SRCLINE_TO,
};
/* --sort srcfile */
static char no_srcfile[1];
static char *hist_entry__get_srcfile(struct hist_entry *e)
{
char *sf, *p;
struct map *map = e->ms.map;
if (!map)
return no_srcfile;
sf = __get_srcline(map->dso, map__rip_2objdump(map, e->ip),
e->ms.sym, false, true);
if (!strcmp(sf, SRCLINE_UNKNOWN))
return no_srcfile;
p = strchr(sf, ':');
if (p && *sf) {
*p = 0;
return sf;
}
free(sf);
return no_srcfile;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 104 | 92.04% | 3 | 75.00% |
namhyung kim | namhyung kim | 9 | 7.96% | 1 | 25.00% |
| Total | 113 | 100.00% | 4 | 100.00% |
static int64_t
sort__srcfile_cmp(struct hist_entry *left, struct hist_entry *right)
{
if (!left->srcfile)
left->srcfile = hist_entry__get_srcfile(left);
if (!right->srcfile)
right->srcfile = hist_entry__get_srcfile(right);
return strcmp(right->srcfile, left->srcfile);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 58 | 96.67% | 1 | 50.00% |
namhyung kim | namhyung kim | 2 | 3.33% | 1 | 50.00% |
| Total | 60 | 100.00% | 2 | 100.00% |
static int hist_entry__srcfile_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
if (!he->srcfile)
he->srcfile = hist_entry__get_srcfile(he);
return repsep_snprintf(bf, size, "%-.*s", width, he->srcfile);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 37 | 68.52% | 1 | 33.33% |
namhyung kim | namhyung kim | 17 | 31.48% | 2 | 66.67% |
| Total | 54 | 100.00% | 3 | 100.00% |
struct sort_entry sort_srcfile = {
.se_header = "Source File",
.se_cmp = sort__srcfile_cmp,
.se_snprintf = hist_entry__srcfile_snprintf,
.se_width_idx = HISTC_SRCFILE,
};
/* --sort parent */
static int64_t
sort__parent_cmp(struct hist_entry *left, struct hist_entry *right)
{
struct symbol *sym_l = left->parent;
struct symbol *sym_r = right->parent;
if (!sym_l || !sym_r)
return cmp_null(sym_l, sym_r);
return strcmp(sym_r->name, sym_l->name);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
john kacur | john kacur | 57 | 91.94% | 1 | 33.33% |
roberto agostino vitillo | roberto agostino vitillo | 3 | 4.84% | 1 | 33.33% |
namhyung kim | namhyung kim | 2 | 3.23% | 1 | 33.33% |
| Total | 62 | 100.00% | 3 | 100.00% |
static int hist_entry__parent_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return repsep_snprintf(bf, size, "%-*.*s", width, width,
he->parent ? he->parent->name : "[other]");
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
john kacur | john kacur | 28 | 58.33% | 1 | 25.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 17 | 35.42% | 2 | 50.00% |
namhyung kim | namhyung kim | 3 | 6.25% | 1 | 25.00% |
| Total | 48 | 100.00% | 4 | 100.00% |
struct sort_entry sort_parent = {
.se_header = "Parent symbol",
.se_cmp = sort__parent_cmp,
.se_snprintf = hist_entry__parent_snprintf,
.se_width_idx = HISTC_PARENT,
};
/* --sort cpu */
static int64_t
sort__cpu_cmp(struct hist_entry *left, struct hist_entry *right)
{
return right->cpu - left->cpu;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arun sharma | arun sharma | 14 | 56.00% | 1 | 33.33% |
roberto agostino vitillo | roberto agostino vitillo | 10 | 40.00% | 1 | 33.33% |
frederic weisbecker | frederic weisbecker | 1 | 4.00% | 1 | 33.33% |
| Total | 25 | 100.00% | 3 | 100.00% |
static int hist_entry__cpu_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
return repsep_snprintf(bf, size, "%*.*d", width, width, he->cpu);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
roberto agostino vitillo | roberto agostino vitillo | 35 | 87.50% | 1 | 33.33% |
namhyung kim | namhyung kim | 3 | 7.50% | 1 | 33.33% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 2 | 5.00% | 1 | 33.33% |
| Total | 40 | 100.00% | 3 | 100.00% |
struct sort_entry sort_cpu = {
.se_header = "CPU",
.se_cmp = sort__cpu_cmp,
.se_snprintf = hist_entry__cpu_snprintf,
.se_width_idx = HISTC_CPU,
};
/* --sort socket */
static int64_t
sort__socket_cmp(struct hist_entry *left, struct hist_entry *right)