diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-06-28 13:29:02 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-30 18:27:44 -0300 |
commit | f3069249e9e6b0ce303c3547dfa2960ee2e95b61 (patch) | |
tree | bfbcc640021817450bdf555d13e27bf1bbf72ce0 /tools/perf/util | |
parent | 3be28870c05ad09dfff4dbefe71b02aba5dba569 (diff) | |
download | linux-stable-f3069249e9e6b0ce303c3547dfa2960ee2e95b61.tar.gz linux-stable-f3069249e9e6b0ce303c3547dfa2960ee2e95b61.tar.bz2 linux-stable-f3069249e9e6b0ce303c3547dfa2960ee2e95b61.zip |
perf tools: Allow to reset open files counter
I hit a bug when running test suite without forking
each test (-F option):
$ perf test -F dso
8: Test dso data read : Ok
9: Test dso data cache : FAILED!
10: Test dso data reopen : FAILED!
The reason the session file limit is set just once for
perf process so we need to reset it for each test,
otherwise wrong limit is taken into account.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Nilay Vaish <nilayvaish@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1467113345-12669-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/dso.c | 22 | ||||
-rw-r--r-- | tools/perf/util/dso.h | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 5d286f5d7906..e1de6cc4863e 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -442,17 +442,27 @@ static rlim_t get_fd_limit(void) return limit; } -static bool may_cache_fd(void) +static rlim_t fd_limit; + +/* + * Used only by tests/dso-data.c to reset the environment + * for tests. I dont expect we should change this during + * standard runtime. + */ +void reset_fd_limit(void) { - static rlim_t limit; + fd_limit = 0; +} - if (!limit) - limit = get_fd_limit(); +static bool may_cache_fd(void) +{ + if (!fd_limit) + fd_limit = get_fd_limit(); - if (limit == RLIM_INFINITY) + if (fd_limit == RLIM_INFINITY) return true; - return limit > (rlim_t) dso__data_open_cnt; + return fd_limit > (rlim_t) dso__data_open_cnt; } /* diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 76d79d070e21..a571f24895ca 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -360,4 +360,6 @@ enum dso_type dso__type(struct dso *dso, struct machine *machine); int dso__strerror_load(struct dso *dso, char *buf, size_t buflen); +void reset_fd_limit(void); + #endif /* __PERF_DSO */ |