|
@@ -373,6 +373,9 @@ struct sort_entry sort_cpu = {
|
|
static int64_t
|
|
static int64_t
|
|
sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
{
|
|
{
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
+
|
|
return _sort__dso_cmp(left->branch_info->from.map,
|
|
return _sort__dso_cmp(left->branch_info->from.map,
|
|
right->branch_info->from.map);
|
|
right->branch_info->from.map);
|
|
}
|
|
}
|
|
@@ -380,13 +383,19 @@ sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf,
|
|
static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width)
|
|
size_t size, unsigned int width)
|
|
{
|
|
{
|
|
- return _hist_entry__dso_snprintf(he->branch_info->from.map,
|
|
|
|
- bf, size, width);
|
|
|
|
|
|
+ if (he->branch_info)
|
|
|
|
+ return _hist_entry__dso_snprintf(he->branch_info->from.map,
|
|
|
|
+ bf, size, width);
|
|
|
|
+ else
|
|
|
|
+ return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
|
|
}
|
|
}
|
|
|
|
|
|
static int64_t
|
|
static int64_t
|
|
sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
{
|
|
{
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
+
|
|
return _sort__dso_cmp(left->branch_info->to.map,
|
|
return _sort__dso_cmp(left->branch_info->to.map,
|
|
right->branch_info->to.map);
|
|
right->branch_info->to.map);
|
|
}
|
|
}
|
|
@@ -394,8 +403,11 @@ sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf,
|
|
static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width)
|
|
size_t size, unsigned int width)
|
|
{
|
|
{
|
|
- return _hist_entry__dso_snprintf(he->branch_info->to.map,
|
|
|
|
- bf, size, width);
|
|
|
|
|
|
+ if (he->branch_info)
|
|
|
|
+ return _hist_entry__dso_snprintf(he->branch_info->to.map,
|
|
|
|
+ bf, size, width);
|
|
|
|
+ else
|
|
|
|
+ return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
|
|
}
|
|
}
|
|
|
|
|
|
static int64_t
|
|
static int64_t
|
|
@@ -404,6 +416,12 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
struct addr_map_symbol *from_l = &left->branch_info->from;
|
|
struct addr_map_symbol *from_l = &left->branch_info->from;
|
|
struct addr_map_symbol *from_r = &right->branch_info->from;
|
|
struct addr_map_symbol *from_r = &right->branch_info->from;
|
|
|
|
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
+
|
|
|
|
+ from_l = &left->branch_info->from;
|
|
|
|
+ from_r = &right->branch_info->from;
|
|
|
|
+
|
|
if (!from_l->sym && !from_r->sym)
|
|
if (!from_l->sym && !from_r->sym)
|
|
return _sort__addr_cmp(from_l->addr, from_r->addr);
|
|
return _sort__addr_cmp(from_l->addr, from_r->addr);
|
|
|
|
|
|
@@ -413,8 +431,13 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
static int64_t
|
|
static int64_t
|
|
sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
{
|
|
{
|
|
- struct addr_map_symbol *to_l = &left->branch_info->to;
|
|
|
|
- struct addr_map_symbol *to_r = &right->branch_info->to;
|
|
|
|
|
|
+ struct addr_map_symbol *to_l, *to_r;
|
|
|
|
+
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
+
|
|
|
|
+ to_l = &left->branch_info->to;
|
|
|
|
+ to_r = &right->branch_info->to;
|
|
|
|
|
|
if (!to_l->sym && !to_r->sym)
|
|
if (!to_l->sym && !to_r->sym)
|
|
return _sort__addr_cmp(to_l->addr, to_r->addr);
|
|
return _sort__addr_cmp(to_l->addr, to_r->addr);
|
|
@@ -425,19 +448,27 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
|
|
static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width)
|
|
size_t size, unsigned int width)
|
|
{
|
|
{
|
|
- struct addr_map_symbol *from = &he->branch_info->from;
|
|
|
|
- return _hist_entry__sym_snprintf(from->map, from->sym, from->addr,
|
|
|
|
- he->level, bf, size, width);
|
|
|
|
|
|
+ if (he->branch_info) {
|
|
|
|
+ struct addr_map_symbol *from = &he->branch_info->from;
|
|
|
|
|
|
|
|
+ return _hist_entry__sym_snprintf(from->map, from->sym, from->addr,
|
|
|
|
+ he->level, bf, size, width);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
|
|
}
|
|
}
|
|
|
|
|
|
static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
|
|
static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width)
|
|
size_t size, unsigned int width)
|
|
{
|
|
{
|
|
- struct addr_map_symbol *to = &he->branch_info->to;
|
|
|
|
- return _hist_entry__sym_snprintf(to->map, to->sym, to->addr,
|
|
|
|
- he->level, bf, size, width);
|
|
|
|
|
|
+ if (he->branch_info) {
|
|
|
|
+ struct addr_map_symbol *to = &he->branch_info->to;
|
|
|
|
|
|
|
|
+ return _hist_entry__sym_snprintf(to->map, to->sym, to->addr,
|
|
|
|
+ he->level, bf, size, width);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
|
|
}
|
|
}
|
|
|
|
|
|
struct sort_entry sort_dso_from = {
|
|
struct sort_entry sort_dso_from = {
|
|
@@ -471,11 +502,13 @@ struct sort_entry sort_sym_to = {
|
|
static int64_t
|
|
static int64_t
|
|
sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
{
|
|
{
|
|
- const unsigned char mp = left->branch_info->flags.mispred !=
|
|
|
|
- right->branch_info->flags.mispred;
|
|
|
|
- const unsigned char p = left->branch_info->flags.predicted !=
|
|
|
|
- right->branch_info->flags.predicted;
|
|
|
|
|
|
+ unsigned char mp, p;
|
|
|
|
+
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
|
|
|
|
+ mp = left->branch_info->flags.mispred != right->branch_info->flags.mispred;
|
|
|
|
+ p = left->branch_info->flags.predicted != right->branch_info->flags.predicted;
|
|
return mp || p;
|
|
return mp || p;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -483,10 +516,12 @@ static int hist_entry__mispredict_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width){
|
|
size_t size, unsigned int width){
|
|
static const char *out = "N/A";
|
|
static const char *out = "N/A";
|
|
|
|
|
|
- if (he->branch_info->flags.predicted)
|
|
|
|
- out = "N";
|
|
|
|
- else if (he->branch_info->flags.mispred)
|
|
|
|
- out = "Y";
|
|
|
|
|
|
+ if (he->branch_info) {
|
|
|
|
+ if (he->branch_info->flags.predicted)
|
|
|
|
+ out = "N";
|
|
|
|
+ else if (he->branch_info->flags.mispred)
|
|
|
|
+ out = "Y";
|
|
|
|
+ }
|
|
|
|
|
|
return repsep_snprintf(bf, size, "%-*.*s", width, width, out);
|
|
return repsep_snprintf(bf, size, "%-*.*s", width, width, out);
|
|
}
|
|
}
|
|
@@ -989,6 +1024,9 @@ struct sort_entry sort_mem_dcacheline = {
|
|
static int64_t
|
|
static int64_t
|
|
sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
{
|
|
{
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
+
|
|
return left->branch_info->flags.abort !=
|
|
return left->branch_info->flags.abort !=
|
|
right->branch_info->flags.abort;
|
|
right->branch_info->flags.abort;
|
|
}
|
|
}
|
|
@@ -996,10 +1034,15 @@ sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
|
|
static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width)
|
|
size_t size, unsigned int width)
|
|
{
|
|
{
|
|
- static const char *out = ".";
|
|
|
|
|
|
+ static const char *out = "N/A";
|
|
|
|
+
|
|
|
|
+ if (he->branch_info) {
|
|
|
|
+ if (he->branch_info->flags.abort)
|
|
|
|
+ out = "A";
|
|
|
|
+ else
|
|
|
|
+ out = ".";
|
|
|
|
+ }
|
|
|
|
|
|
- if (he->branch_info->flags.abort)
|
|
|
|
- out = "A";
|
|
|
|
return repsep_snprintf(bf, size, "%-*s", width, out);
|
|
return repsep_snprintf(bf, size, "%-*s", width, out);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1013,6 +1056,9 @@ struct sort_entry sort_abort = {
|
|
static int64_t
|
|
static int64_t
|
|
sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
{
|
|
{
|
|
|
|
+ if (!left->branch_info || !right->branch_info)
|
|
|
|
+ return cmp_null(left->branch_info, right->branch_info);
|
|
|
|
+
|
|
return left->branch_info->flags.in_tx !=
|
|
return left->branch_info->flags.in_tx !=
|
|
right->branch_info->flags.in_tx;
|
|
right->branch_info->flags.in_tx;
|
|
}
|
|
}
|
|
@@ -1020,10 +1066,14 @@ sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf,
|
|
static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf,
|
|
size_t size, unsigned int width)
|
|
size_t size, unsigned int width)
|
|
{
|
|
{
|
|
- static const char *out = ".";
|
|
|
|
|
|
+ static const char *out = "N/A";
|
|
|
|
|
|
- if (he->branch_info->flags.in_tx)
|
|
|
|
- out = "T";
|
|
|
|
|
|
+ if (he->branch_info) {
|
|
|
|
+ if (he->branch_info->flags.in_tx)
|
|
|
|
+ out = "T";
|
|
|
|
+ else
|
|
|
|
+ out = ".";
|
|
|
|
+ }
|
|
|
|
|
|
return repsep_snprintf(bf, size, "%-*s", width, out);
|
|
return repsep_snprintf(bf, size, "%-*s", width, out);
|
|
}
|
|
}
|