Merge commit 'v2.6.34-rc2' into perf/core
[safe/jmp/linux-2.6] / tools / perf / util / hist.c
index 2be33c7..c37da8b 100644 (file)
@@ -455,11 +455,11 @@ static size_t hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
        return ret;
 }
 
-static size_t hist_entry__fprintf(struct hist_entry *self,
-                                 struct perf_session *pair_session,
-                                 bool show_displacement,
-                                 long displacement, FILE *fp,
-                                 u64 session_total)
+size_t hist_entry__fprintf(struct hist_entry *self,
+                          struct perf_session *pair_session,
+                          bool show_displacement,
+                          long displacement, FILE *fp,
+                          u64 session_total)
 {
        struct sort_entry *se;
        u64 count, total;
@@ -485,9 +485,9 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
 
        if (symbol_conf.show_nr_samples) {
                if (sep)
-                       fprintf(fp, "%c%lld", *sep, count);
+                       ret += fprintf(fp, "%c%lld", *sep, count);
                else
-                       fprintf(fp, "%11lld", count);
+                       ret += fprintf(fp, "%11lld", count);
        }
 
        if (pair_session) {
@@ -518,9 +518,9 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
                                snprintf(bf, sizeof(bf), " ");
 
                        if (sep)
-                               fprintf(fp, "%c%s", *sep, bf);
+                               ret += fprintf(fp, "%c%s", *sep, bf);
                        else
-                               fprintf(fp, "%6.6s", bf);
+                               ret += fprintf(fp, "%6.6s", bf);
                }
        }
 
@@ -528,27 +528,27 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
                if (se->elide)
                        continue;
 
-               fprintf(fp, "%s", sep ?: "  ");
+               ret += fprintf(fp, "%s", sep ?: "  ");
                ret += se->print(fp, self, se->width ? *se->width : 0);
        }
 
-       ret += fprintf(fp, "\n");
-
-       if (symbol_conf.use_callchain) {
-               int left_margin = 0;
+       return ret + fprintf(fp, "\n");
+}
 
-               if (sort__first_dimension == SORT_COMM) {
-                       se = list_first_entry(&hist_entry__sort_list, typeof(*se),
-                                               list);
-                       left_margin = se->width ? *se->width : 0;
-                       left_margin -= thread__comm_len(self->thread);
-               }
+static size_t hist_entry__fprintf_callchain(struct hist_entry *self, FILE *fp,
+                                           u64 session_total)
+{
+       int left_margin = 0;
 
-               hist_entry_callchain__fprintf(fp, self, session_total,
-                                             left_margin);
+       if (sort__first_dimension == SORT_COMM) {
+               struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
+                                                        typeof(*se), list);
+               left_margin = se->width ? *se->width : 0;
+               left_margin -= thread__comm_len(self->thread);
        }
 
-       return ret;
+       return hist_entry_callchain__fprintf(fp, self, session_total,
+                                            left_margin);
 }
 
 size_t perf_session__fprintf_hists(struct rb_root *hists,
@@ -655,6 +655,10 @@ print_entries:
                }
                ret += hist_entry__fprintf(h, pair, show_displacement,
                                           displacement, fp, session_total);
+
+               if (symbol_conf.use_callchain)
+                       ret += hist_entry__fprintf_callchain(h, fp, session_total);
+
                if (h->map == NULL && verbose > 1) {
                        __map_groups__fprintf_maps(&h->thread->mg,
                                                   MAP__FUNCTION, fp);