|
@@ -291,7 +291,7 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s,
|
|
|
+static int hist_entry__period_snprintf(struct hist_entry *he, char *s,
|
|
|
size_t size, struct hists *pair_hists,
|
|
|
bool show_displacement, long displacement,
|
|
|
bool color, u64 total_period)
|
|
@@ -404,8 +404,8 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size,
|
|
|
- struct hists *hists)
|
|
|
+int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
|
|
|
+ struct hists *hists)
|
|
|
{
|
|
|
const char *sep = symbol_conf.field_sep;
|
|
|
struct sort_entry *se;
|
|
@@ -423,6 +423,22 @@ int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
|
|
|
+ struct hists *hists,
|
|
|
+ u64 total_period, FILE *fp)
|
|
|
+{
|
|
|
+ int left_margin = 0;
|
|
|
+
|
|
|
+ if (sort__first_dimension == SORT_COMM) {
|
|
|
+ struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
|
|
|
+ typeof(*se), list);
|
|
|
+ left_margin = hists__col_len(hists, se->se_width_idx);
|
|
|
+ left_margin -= thread__comm_len(he->thread);
|
|
|
+ }
|
|
|
+
|
|
|
+ return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
|
|
|
+}
|
|
|
+
|
|
|
static int hist_entry__fprintf(struct hist_entry *he, size_t size,
|
|
|
struct hists *hists, struct hists *pair_hists,
|
|
|
bool show_displacement, long displacement,
|
|
@@ -434,27 +450,18 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
|
|
|
if (size == 0 || size > sizeof(bf))
|
|
|
size = sizeof(bf);
|
|
|
|
|
|
- ret = hist_entry__pcnt_snprintf(he, bf, size, pair_hists,
|
|
|
- show_displacement, displacement,
|
|
|
- true, total_period);
|
|
|
- hist_entry__snprintf(he, bf + ret, size - ret, hists);
|
|
|
- return fprintf(fp, "%s\n", bf);
|
|
|
-}
|
|
|
+ ret = hist_entry__period_snprintf(he, bf, size, pair_hists,
|
|
|
+ show_displacement, displacement,
|
|
|
+ true, total_period);
|
|
|
+ hist_entry__sort_snprintf(he, bf + ret, size - ret, hists);
|
|
|
|
|
|
-static size_t hist_entry__fprintf_callchain(struct hist_entry *he,
|
|
|
- struct hists *hists,
|
|
|
- u64 total_period, FILE *fp)
|
|
|
-{
|
|
|
- int left_margin = 0;
|
|
|
+ ret = fprintf(fp, "%s\n", bf);
|
|
|
|
|
|
- if (sort__first_dimension == SORT_COMM) {
|
|
|
- struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
|
|
|
- typeof(*se), list);
|
|
|
- left_margin = hists__col_len(hists, se->se_width_idx);
|
|
|
- left_margin -= thread__comm_len(he->thread);
|
|
|
- }
|
|
|
+ if (symbol_conf.use_callchain)
|
|
|
+ ret += hist_entry__callchain_fprintf(he, hists,
|
|
|
+ total_period, fp);
|
|
|
|
|
|
- return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
size_t hists__fprintf(struct hists *hists, struct hists *pair,
|
|
@@ -608,8 +615,6 @@ print_entries:
|
|
|
ret += hist_entry__fprintf(h, max_cols, hists, pair, show_displacement,
|
|
|
displacement, total_period, fp);
|
|
|
|
|
|
- if (symbol_conf.use_callchain)
|
|
|
- ret += hist_entry__fprintf_callchain(h, hists, total_period, fp);
|
|
|
if (max_rows && ++nr_rows >= max_rows)
|
|
|
goto out;
|
|
|
|