Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311396 > unrolled thread

[PATCH 04/26] perf tools: Use struct perf_hpp_fmt::idx in perf_hpp__reset_width

Started byJiri Olsa <jolsa@kernel.org>
First post2016-01-18 10:30 +0100
Last post2016-01-18 10:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 04/26] perf tools: Use struct perf_hpp_fmt::idx in perf_hpp__reset_width Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100

#1311396 — [PATCH 04/26] perf tools: Use struct perf_hpp_fmt::idx in perf_hpp__reset_width

FromJiri Olsa <jolsa@kernel.org>
Date2016-01-18 10:30 +0100
Subject[PATCH 04/26] perf tools: Use struct perf_hpp_fmt::idx in perf_hpp__reset_width
Message-ID<qSeil-73y-11@gated-at.bofh.it>
We are going to add dynamic hpp format fields, so we
need to make the 'len' change for the format itself,
not in the perf_hpp__format template.

Link: http://lkml.kernel.org/n/tip-cc8j41xaxfingpjcag4adkss@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/hist.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index d392801ea17e..5a11bf0aabc7 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -629,20 +629,12 @@ unsigned int hists__sort_list_width(struct hists *hists)
 
 void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists)
 {
-	int idx;
-
 	if (perf_hpp__is_sort_entry(fmt))
 		return perf_hpp__reset_sort_width(fmt, hists);
 
-	for (idx = 0; idx < PERF_HPP__MAX_INDEX; idx++) {
-		if (fmt == &perf_hpp__format[idx])
-			break;
-	}
-
-	if (idx == PERF_HPP__MAX_INDEX)
-		return;
+	BUG_ON(fmt->idx >= PERF_HPP__MAX_INDEX);
 
-	switch (idx) {
+	switch (fmt->idx) {
 	case PERF_HPP__OVERHEAD:
 	case PERF_HPP__OVERHEAD_SYS:
 	case PERF_HPP__OVERHEAD_US:
-- 
2.4.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web