Lines Matching +full:setup +full:- +full:duration +full:- +full:ns

1 // SPDX-License-Identifier: GPL-2.0
27 * err_msg - print an error message to the stderr
42 * debug_msg - print a debug message to stderr if debug is set
60 * get_llong_from_str - get a long long int from a string
70 return -1; in get_llong_from_str()
76 * get_duration - fill output with a human readable duration since start_time
82 time_t duration; in get_duration() local
84 duration = difftime(now, start_time); in get_duration()
85 tm_info = gmtime(&duration); in get_duration()
88 tm_info->tm_yday, in get_duration()
89 tm_info->tm_hour, in get_duration()
90 tm_info->tm_min, in get_duration()
91 tm_info->tm_sec); in get_duration()
95 * parse_cpu_set - parse a cpu_list filling cpu_set_t argument
97 * Receives a cpu list, like 1-3,5 (cpus 1, 2, 3, 5), and then set
121 if (*p == '-') { in parse_cpu_set()
152 * parse_duration - parse duration with s/m/h/d suffix converting it to seconds
186 * parse_ns_duration - parse duration with ns/us/ms/s converting it to nanoseconds
196 if (!strncmp(end, "ns", 2)) { in parse_ns_duration()
208 return -1; in parse_ns_duration()
258 * procfs_is_workload_pid - check if a procfs entry contains a comm_prefix* comm
274 if (proc_entry->d_type != DT_DIR) in procfs_is_workload_pid()
277 if (*proc_entry->d_name == '.') in procfs_is_workload_pid()
281 for (t_name = proc_entry->d_name; t_name; t_name++) { in procfs_is_workload_pid()
289 snprintf(buffer, MAX_PATH, "/proc/%s/comm", proc_entry->d_name); in procfs_is_workload_pid()
307 debug_msg("Found workload pid:%s comm:%s", proc_entry->d_name, buffer); in procfs_is_workload_pid()
313 * set_comm_sched_attr - set sched params to threads starting with char *comm_prefix
345 retval = __set_sched_attr(atoi(proc_entry->d_name), attr); in set_comm_sched_attr()
347 err_msg("Error setting sched attributes for pid:%s\n", proc_entry->d_name); in set_comm_sched_attr()
351 debug_msg("Set sched attributes for pid:%s\n", proc_entry->d_name); in set_comm_sched_attr()
368 return -1; in get_long_ns_after_colon()
384 return -1; in get_long_after_colon()
415 sched_param->size = sizeof(*sched_param); in parse_prio()
422 return -1; in parse_prio()
426 return -1; in parse_prio()
430 return -1; in parse_prio()
433 return -1; in parse_prio()
435 sched_param->sched_policy = SCHED_DEADLINE; in parse_prio()
436 sched_param->sched_runtime = runtime; in parse_prio()
437 sched_param->sched_deadline = period; in parse_prio()
438 sched_param->sched_period = period; in parse_prio()
445 return -1; in parse_prio()
448 return -1; in parse_prio()
450 return -1; in parse_prio()
452 sched_param->sched_policy = SCHED_FIFO; in parse_prio()
453 sched_param->sched_priority = prio; in parse_prio()
460 return -1; in parse_prio()
463 return -1; in parse_prio()
465 return -1; in parse_prio()
467 sched_param->sched_policy = SCHED_RR; in parse_prio()
468 sched_param->sched_priority = prio; in parse_prio()
475 return -1; in parse_prio()
478 return -1; in parse_prio()
480 return -1; in parse_prio()
482 sched_param->sched_policy = SCHED_OTHER; in parse_prio()
483 sched_param->sched_nice = prio; in parse_prio()
486 return -1; in parse_prio()
492 * set_cpu_dma_latency - set the /dev/cpu_dma_latecy
508 return -1; in set_cpu_dma_latency()
515 return -1; in set_cpu_dma_latency()
528 * save_cpu_idle_state_disable - save disable for all idle states of a cpu
551 return -1; in save_cpu_idle_disable_state()
556 return -1; in save_cpu_idle_disable_state()
570 * restore_cpu_idle_disable_state - restore disable for all idle states of a cpu
590 return -1; in restore_cpu_idle_disable_state()
594 return -1; in restore_cpu_idle_disable_state()
603 saved_cpu_idle_disable_state_alloc_ctr--; in restore_cpu_idle_disable_state()
613 * free_cpu_idle_disable_states - free saved idle state disable for all cpus
642 * set_deepest_cpu_idle_state - limit idle state of cpu
674 * find_mount - find a the mount point of a given fs
702 strncpy(mp, mount_point, sizeof_mp - 1); in find_mount()
709 * get_self_cgroup - get the current thread cgroup path
713 * 0::/user.slice/user-0.slice/session-3.scope'\n'
772 * set_comm_cgroup - Set cgroup to pid_t pid
783 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")]; in set_pid_cgroup()
797 sizeof(cgroup_path) - strlen(cgroup_path)); in set_pid_cgroup()
804 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); in set_pid_cgroup()
819 err_msg("Error setting cgroup attributes for pid:%s - %s\n", in set_pid_cgroup()
830 * set_comm_cgroup - Set cgroup to threads starting with char *comm_prefix
841 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")]; in set_comm_cgroup()
862 sizeof(cgroup_path) - strlen(cgroup_path)); in set_comm_cgroup()
869 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); in set_comm_cgroup()
892 retval = write(cg_fd, proc_entry->d_name, strlen(proc_entry->d_name)); in set_comm_cgroup()
894 err_msg("Error setting cgroup attributes for pid:%s - %s\n", in set_comm_cgroup()
895 proc_entry->d_name, strerror(errno)); in set_comm_cgroup()
899 debug_msg("Set cgroup attributes for pid:%s\n", proc_entry->d_name); in set_comm_cgroup()
914 * auto_house_keeping - Automatically move rtla out of measurement threads
927 if (retval == -1) { in auto_house_keeping()
932 /* then check if the existing setup is already good. */ in auto_house_keeping()
936 debug_msg("Skipping auto house-keeping\n"); in auto_house_keeping()
948 debug_msg("Could not find any CPU for auto house-keeping\n"); in auto_house_keeping()
953 if (retval == -1) { in auto_house_keeping()
954 debug_msg("Could not set affinity for auto house-keeping\n"); in auto_house_keeping()
958 debug_msg("rtla automatically moved to an auto house-keeping cpu set\n"); in auto_house_keeping()