summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/src/timerlat.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tracing/rtla/src/timerlat.c')
-rw-r--r--tools/tracing/rtla/src/timerlat.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/timerlat.c
index 0b2f03e1e612..e4bf58db1dd2 100644
--- a/tools/tracing/rtla/src/timerlat.c
+++ b/tools/tracing/rtla/src/timerlat.c
@@ -24,21 +24,7 @@
int
timerlat_apply_config(struct osnoise_tool *tool, struct timerlat_params *params)
{
- int retval, i;
-
- if (!params->common.sleep_time)
- params->common.sleep_time = 1;
-
- retval = osnoise_set_cpus(tool->context, params->common.cpus ? params->common.cpus : "all");
- if (retval) {
- err_msg("Failed to apply CPUs config\n");
- goto out_err;
- }
-
- if (!params->common.cpus) {
- for (i = 0; i < sysconf(_SC_NPROCESSORS_CONF); i++)
- CPU_SET(i, &params->common.monitored_cpus);
- }
+ int retval;
if (params->mode != TRACING_MODE_BPF) {
/*
@@ -75,29 +61,11 @@ timerlat_apply_config(struct osnoise_tool *tool, struct timerlat_params *params)
goto out_err;
}
- if (params->common.hk_cpus) {
- retval = sched_setaffinity(getpid(), sizeof(params->common.hk_cpu_set),
- &params->common.hk_cpu_set);
- if (retval == -1) {
- err_msg("Failed to set rtla to the house keeping CPUs\n");
- goto out_err;
- }
- } else if (params->common.cpus) {
- /*
- * Even if the user do not set a house-keeping CPU, try to
- * move rtla to a CPU set different to the one where the user
- * set the workload to run.
- *
- * No need to check results as this is an automatic attempt.
- */
- auto_house_keeping(&params->common.monitored_cpus);
- }
-
/*
* If the user did not specify a type of thread, try user-threads first.
* Fall back to kernel threads otherwise.
*/
- if (!params->kernel_workload && !params->user_data) {
+ if (!params->common.kernel_workload && !params->user_data) {
retval = tracefs_file_exists(NULL, "osnoise/per_cpu/cpu0/timerlat_fd");
if (retval) {
debug_msg("User-space interface detected, setting user-threads\n");
@@ -105,22 +73,11 @@ timerlat_apply_config(struct osnoise_tool *tool, struct timerlat_params *params)
params->user_data = 1;
} else {
debug_msg("User-space interface not detected, setting kernel-threads\n");
- params->kernel_workload = 1;
+ params->common.kernel_workload = 1;
}
}
- /*
- * Set workload according to type of thread if the kernel supports it.
- * On kernels without support, user threads will have already failed
- * on missing timerlat_fd, and kernel threads do not need it.
- */
- retval = osnoise_set_workload(tool->context, params->kernel_workload);
- if (retval < -1) {
- err_msg("Failed to set OSNOISE_WORKLOAD option\n");
- goto out_err;
- }
-
- return 0;
+ return common_apply_config(tool, &params->common);
out_err:
return -1;