summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evsel.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:35:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:31 +0000
commit85c675d0d09a45a135bddd15d7b385f8758c32fb (patch)
tree76267dbc9b9a130337be3640948fe397b04ac629 /tools/perf/util/evsel.c
parentAdding upstream version 6.6.15. (diff)
downloadlinux-85c675d0d09a45a135bddd15d7b385f8758c32fb.tar.xz
linux-85c675d0d09a45a135bddd15d7b385f8758c32fb.zip
Adding upstream version 6.7.7.upstream/6.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r--tools/perf/util/evsel.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index a8a5ff87cc..72a5dfc38d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -49,6 +49,7 @@
#include "off_cpu.h"
#include "pmu.h"
#include "pmus.h"
+#include "rlimit.h"
#include "../perf-sys.h"
#include "util/parse-branch-options.h"
#include "util/bpf-filter.h"
@@ -1989,33 +1990,6 @@ bool evsel__detect_missing_features(struct evsel *evsel)
}
}
-bool evsel__increase_rlimit(enum rlimit_action *set_rlimit)
-{
- int old_errno;
- struct rlimit l;
-
- if (*set_rlimit < INCREASED_MAX) {
- old_errno = errno;
-
- if (getrlimit(RLIMIT_NOFILE, &l) == 0) {
- if (*set_rlimit == NO_CHANGE) {
- l.rlim_cur = l.rlim_max;
- } else {
- l.rlim_cur = l.rlim_max + 1000;
- l.rlim_max = l.rlim_cur;
- }
- if (setrlimit(RLIMIT_NOFILE, &l) == 0) {
- (*set_rlimit) += 1;
- errno = old_errno;
- return true;
- }
- }
- errno = old_errno;
- }
-
- return false;
-}
-
static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
struct perf_thread_map *threads,
int start_cpu_map_idx, int end_cpu_map_idx)
@@ -2143,7 +2117,7 @@ try_fallback:
* perf stat needs between 5 and 22 fds per CPU. When we run out
* of them try to increase the limits.
*/
- if (err == -EMFILE && evsel__increase_rlimit(&set_rlimit))
+ if (err == -EMFILE && rlimit__increase_nofile(&set_rlimit))
goto retry_open;
if (err != -EINVAL || idx > 0 || thread > 0)
@@ -2766,6 +2740,11 @@ struct tep_format_field *evsel__field(struct evsel *evsel, const char *name)
return tep_find_field(evsel->tp_format, name);
}
+struct tep_format_field *evsel__common_field(struct evsel *evsel, const char *name)
+{
+ return tep_find_common_field(evsel->tp_format, name);
+}
+
void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const char *name)
{
struct tep_format_field *field = evsel__field(evsel, name);
@@ -2831,6 +2810,14 @@ u64 evsel__intval(struct evsel *evsel, struct perf_sample *sample, const char *n
return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
}
+
+u64 evsel__intval_common(struct evsel *evsel, struct perf_sample *sample, const char *name)
+{
+ struct tep_format_field *field = evsel__common_field(evsel, name);
+
+ return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
+}
+
#endif
bool evsel__fallback(struct evsel *evsel, int err, char *msg, size_t msgsize)