summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2023-03-10 18:43:17 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-03-10 18:43:17 -0300
commitb8fa3e3833c14151a47ebebbc5427dcfe94bb407 (patch)
treed0c6fa9b055b5d58de913346b0a077cd2bcc6416 /tools/perf/util
parent0ec73817ca21f6ed4f2cca44b63e81a688c0ba0b (diff)
parent55a21105ecc156495446d8ae75d7d73f66baed7b (diff)
downloadlinux-stable-b8fa3e3833c14151a47ebebbc5427dcfe94bb407.tar.gz
linux-stable-b8fa3e3833c14151a47ebebbc5427dcfe94bb407.tar.bz2
linux-stable-b8fa3e3833c14151a47ebebbc5427dcfe94bb407.zip
Merge remote-tracking branch 'acme/perf-tools' into perf-tools-next
To pick up perf-tools fixes just merged upstream. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/stat.c6
-rw-r--r--tools/perf/util/stat.h1
-rw-r--r--tools/perf/util/target.h12
3 files changed, 13 insertions, 6 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 4abfd87c5352..0f7b8a8cdea6 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -768,11 +768,7 @@ int create_perf_stat_counter(struct evsel *evsel,
if (evsel__is_group_leader(evsel)) {
attr->disabled = 1;
- /*
- * In case of initial_delay we enable tracee
- * events manually.
- */
- if (target__none(target) && !config->initial_delay)
+ if (target__enable_on_exec(target))
attr->enable_on_exec = 1;
}
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index 41204547b76b..e35e188237c8 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -92,7 +92,6 @@ struct perf_stat_config {
FILE *output;
unsigned int interval;
unsigned int timeout;
- int initial_delay;
unsigned int unit_width;
unsigned int metric_only_len;
int times;
diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
index daec6cba500d..880f1af7f6ad 100644
--- a/tools/perf/util/target.h
+++ b/tools/perf/util/target.h
@@ -18,6 +18,7 @@ struct target {
bool per_thread;
bool use_bpf;
bool hybrid;
+ int initial_delay;
const char *attr_map;
};
@@ -72,6 +73,17 @@ static inline bool target__none(struct target *target)
return !target__has_task(target) && !target__has_cpu(target);
}
+static inline bool target__enable_on_exec(struct target *target)
+{
+ /*
+ * Normally enable_on_exec should be set if:
+ * 1) The tracee process is forked (not attaching to existed task or cpu).
+ * 2) And initial_delay is not configured.
+ * Otherwise, we enable tracee events manually.
+ */
+ return target__none(target) && !target->initial_delay;
+}
+
static inline bool target__has_per_thread(struct target *target)
{
return target->system_wide && target->per_thread;