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


Groups > linux.kernel > #1313157 > unrolled thread

[PATCH 0/4] perf tools: Fixes

Started byJiri Olsa <jolsa@kernel.org>
First post2016-01-20 13:00 +0100
Last post2016-01-20 13:00 +0100
Articles 5 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] perf tools: Fixes Jiri Olsa <jolsa@kernel.org> - 2016-01-20 13:00 +0100
    [PATCH 4/4] perf stat: Making several helper functions static Jiri Olsa <jolsa@kernel.org> - 2016-01-20 13:00 +0100
    [PATCH 2/4] perf tools: Fix HISTC_MEM_DCACHELINE width setting Jiri Olsa <jolsa@kernel.org> - 2016-01-20 13:00 +0100
    [PATCH 1/4] perf tools: Do not read symbols/data from device files Jiri Olsa <jolsa@kernel.org> - 2016-01-20 13:00 +0100
    [PATCH 3/4] perf stat: Do not clean event's private stats Jiri Olsa <jolsa@kernel.org> - 2016-01-20 13:00 +0100

#1313157 — [PATCH 0/4] perf tools: Fixes

FromJiri Olsa <jolsa@kernel.org>
Date2016-01-20 13:00 +0100
Subject[PATCH 0/4] perf tools: Fixes
Message-ID<qSZAD-5Pv-9@gated-at.bofh.it>
hi,
sending few assorted fixes, all on top
of my perf/fixes branch

thanks,
jirka


---
Jiri Olsa (4):
      perf tools: Do not read symbols/data from device files
      perf tools: Fix HISTC_MEM_DCACHELINE width setting
      perf stat: Do not clean event's private stats
      perf stat: Making several helper functions static

 tools/perf/util/dso.c    |  5 +++++
 tools/perf/util/hist.c   |  2 ++
 tools/perf/util/stat.c   | 15 +++++++--------
 tools/perf/util/stat.h   | 10 ----------
 tools/perf/util/symbol.c |  6 +++++-
 tools/perf/util/util.c   | 10 ++++++++++
 tools/perf/util/util.h   |  1 +
 7 files changed, 30 insertions(+), 19 deletions(-)

[toc] | [next] | [standalone]


#1313159 — [PATCH 4/4] perf stat: Making several helper functions static

FromJiri Olsa <jolsa@kernel.org>
Date2016-01-20 13:00 +0100
Subject[PATCH 4/4] perf stat: Making several helper functions static
Message-ID<qSZAD-5Pv-17@gated-at.bofh.it>
In reply to#1313157
There's no need for following functions to be global:

  perf_evsel__reset_stat_priv
  perf_evsel__alloc_stat_priv
  perf_evsel__free_stat_priv
  perf_evsel__alloc_prev_raw_counts
  perf_evsel__free_prev_raw_counts
  perf_evsel__alloc_stats

They all ended up in util/stat.c, and they no longer
need to be called from outside this object.

Link: http://lkml.kernel.org/n/tip-5kzfn8belul4bh6qdhjf398l@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/stat.c | 14 +++++++-------
 tools/perf/util/stat.h | 10 ----------
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2b58edccd56f..beeed0bd3bee 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -97,7 +97,7 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel)
 	}
 }
 
-void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
+static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 {
 	int i;
 	struct perf_stat_evsel *ps = evsel->priv;
@@ -108,7 +108,7 @@ void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 	perf_stat_evsel_id_init(evsel);
 }
 
-int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
+static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
 {
 	evsel->priv = zalloc(sizeof(struct perf_stat_evsel));
 	if (evsel->priv == NULL)
@@ -117,13 +117,13 @@ int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
 	return 0;
 }
 
-void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
+static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
 {
 	zfree(&evsel->priv);
 }
 
-int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
-				      int ncpus, int nthreads)
+static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
+					     int ncpus, int nthreads)
 {
 	struct perf_counts *counts;
 
@@ -134,13 +134,13 @@ int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
 	return counts ? 0 : -ENOMEM;
 }
 
-void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel)
+static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel)
 {
 	perf_counts__delete(evsel->prev_raw_counts);
 	evsel->prev_raw_counts = NULL;
 }
 
-int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw)
+static int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw)
 {
 	int ncpus = perf_evsel__nr_cpus(evsel);
 	int nthreads = thread_map__nr(evsel->threads);
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index 086f4e128d63..2af63c9cb59f 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -74,16 +74,6 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
 void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
 				   double avg, int cpu, enum aggr_mode aggr);
 
-void perf_evsel__reset_stat_priv(struct perf_evsel *evsel);
-int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel);
-void perf_evsel__free_stat_priv(struct perf_evsel *evsel);
-
-int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
-				      int ncpus, int nthreads);
-void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel);
-
-int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw);
-
 int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw);
 void perf_evlist__free_stats(struct perf_evlist *evlist);
 void perf_evlist__reset_stats(struct perf_evlist *evlist);
-- 
2.4.3

[toc] | [prev] | [next] | [standalone]


#1313161 — [PATCH 2/4] perf tools: Fix HISTC_MEM_DCACHELINE width setting

FromJiri Olsa <jolsa@kernel.org>
Date2016-01-20 13:00 +0100
Subject[PATCH 2/4] perf tools: Fix HISTC_MEM_DCACHELINE width setting
Message-ID<qSZAD-5Pv-19@gated-at.bofh.it>
In reply to#1313157
Set correct with for unresolved addr.

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

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index c226303e3da0..68a7612019dc 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -131,6 +131,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 			symlen = unresolved_col_width + 4 + 2;
 			hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
 					   symlen);
+			hists__new_col_len(hists, HISTC_MEM_DCACHELINE,
+					   symlen);
 		}
 
 		if (h->mem_info->iaddr.sym) {
-- 
2.4.3

[toc] | [prev] | [next] | [standalone]


#1313162 — [PATCH 1/4] perf tools: Do not read symbols/data from device files

FromJiri Olsa <jolsa@kernel.org>
Date2016-01-20 13:00 +0100
Subject[PATCH 1/4] perf tools: Do not read symbols/data from device files
Message-ID<qSZAD-5Pv-21@gated-at.bofh.it>
In reply to#1313157
With mem sampling we could get data source within mapped
device file. Processing such sample would block during
report phase on trying to read the device file.

Chacking for device files and skip the processing if
it's detected.

Link: http://lkml.kernel.org/n/tip-rdj48ax089rhsdzpy31r48fw@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/dso.c    |  5 +++++
 tools/perf/util/symbol.c |  6 +++++-
 tools/perf/util/util.c   | 10 ++++++++++
 tools/perf/util/util.h   |  1 +
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index e8e9a9dbf5e3..8e6395439ca0 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -52,6 +52,11 @@ int dso__read_binary_type_filename(const struct dso *dso,
 			debuglink--;
 		if (*debuglink == '/')
 			debuglink++;
+
+		ret = -1;
+		if (!is_regular_file(filename))
+			break;
+
 		ret = filename__read_debuglink(filename, debuglink,
 					       size - (debuglink - filename));
 		}
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index ab02209a7cf3..90cedfa30e43 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1466,7 +1466,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
-	if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
+	if (is_regular_file(name) &&
+	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
 
 	/*
@@ -1487,6 +1488,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
 						   root_dir, name, PATH_MAX))
 			continue;
 
+		if (!is_regular_file(name))
+			continue;
+
 		/* Name is now the name of the next image to try */
 		if (symsrc__init(ss, dso, name, symtab_type) < 0)
 			continue;
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index ead9509835d2..7a2da7ef556e 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -691,3 +691,13 @@ out:
 
 	return tip;
 }
+
+bool is_regular_file(const char *file)
+{
+	struct stat st;
+
+	if (stat(file, &st))
+		return false;
+
+	return S_ISREG(st.st_mode);
+}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index fe915e616f9b..61650f05e5c1 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -343,5 +343,6 @@ int fetch_kernel_version(unsigned int *puint,
 #define KVER_PARAM(x)	KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)
 
 const char *perf_tip(const char *dirpath);
+bool is_regular_file(const char *file);
 
 #endif /* GIT_COMPAT_UTIL_H */
-- 
2.4.3

[toc] | [prev] | [next] | [standalone]


#1313164 — [PATCH 3/4] perf stat: Do not clean event's private stats

FromJiri Olsa <jolsa@kernel.org>
Date2016-01-20 13:00 +0100
Subject[PATCH 3/4] perf stat: Do not clean event's private stats
Message-ID<qSZAD-5Pv-25@gated-at.bofh.it>
In reply to#1313157
Mel reported stddev reporting was broken due to
following commit:
  106a94a0f8c2 perf stat: Introduce read_counters function

This commit merged interval and overall counters
reading into single read_counters function.

The old interval code cleaned the stddev data for
some reason (it's never displayed in interval mode)
and the mentioned commit kept on cleaning the stddev
data in merged function, which resulted in the stddev
not being displayed.

Removing the wrong stddev data cleanup init_stats call.

Reported-by: Mel Gorman <mgorman@techsingularity.net>
Tested-by: Mel Gorman <mgorman@techsingularity.net>
Cc: stable@vger.kernel.org # v4.2+
Cc: Mel Gorman <mgorman@techsingularity.net>
Link: http://lkml.kernel.org/n/tip-tbcxtpjsqrrbwn2me0je8yxt@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/stat.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2f901d15e063..2b58edccd56f 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -310,7 +310,6 @@ int perf_stat_process_counter(struct perf_stat_config *config,
 	int i, ret;
 
 	aggr->val = aggr->ena = aggr->run = 0;
-	init_stats(ps->res_stats);
 
 	if (counter->per_pkg)
 		zero_per_pkg(counter);
-- 
2.4.3

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web