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

1 // SPDX-License-Identifier: GPL-2.0
24 * err_msg - print an error message to the stderr
39 * debug_msg - print a debug message to stderr if debug is set
57 * get_llong_from_str - get a long long int from a string
67 return -1; in get_llong_from_str()
73 * get_duration - fill output with a human readable duration since start_time
79 time_t duration; in get_duration() local
81 duration = difftime(now, start_time); in get_duration()
82 tm_info = gmtime(&duration); in get_duration()
85 tm_info->tm_yday, in get_duration()
86 tm_info->tm_hour, in get_duration()
87 tm_info->tm_min, in get_duration()
88 tm_info->tm_sec); in get_duration()
92 * parse_cpu_set - parse a cpu_list filling cpu_set_t argument
94 * Receives a cpu list, like 1-3,5 (cpus 1, 2, 3, 5), and then set
118 if (*p == '-') { in parse_cpu_set()
149 * parse_duration - parse duration with s/m/h/d suffix converting it to seconds
183 * parse_ns_duration - parse duration with ns/us/ms/s converting it to nanoseconds
193 if (!strncmp(end, "ns", 2)) { in parse_ns_duration()
205 return -1; in parse_ns_duration()
257 * procfs_is_workload_pid - check if a procfs entry contains a comm_prefix* comm
273 if (proc_entry->d_type != DT_DIR) in procfs_is_workload_pid()
276 if (*proc_entry->d_name == '.') in procfs_is_workload_pid()
280 for (t_name = proc_entry->d_name; t_name; t_name++) { in procfs_is_workload_pid()
288 snprintf(buffer, MAX_PATH, "/proc/%s/comm", proc_entry->d_name); in procfs_is_workload_pid()
306 debug_msg("Found workload pid:%s comm:%s", proc_entry->d_name, buffer); in procfs_is_workload_pid()
312 * set_comm_sched_attr - set sched params to threads starting with char *comm_prefix
344 retval = __set_sched_attr(atoi(proc_entry->d_name), attr); in set_comm_sched_attr()
346 err_msg("Error setting sched attributes for pid:%s\n", proc_entry->d_name); in set_comm_sched_attr()
350 debug_msg("Set sched attributes for pid:%s\n", proc_entry->d_name); in set_comm_sched_attr()
367 return -1; in get_long_ns_after_colon()
383 return -1; in get_long_after_colon()
414 sched_param->size = sizeof(*sched_param); in parse_prio()
421 return -1; in parse_prio()
425 return -1; in parse_prio()
429 return -1; in parse_prio()
432 return -1; in parse_prio()
434 sched_param->sched_policy = SCHED_DEADLINE; in parse_prio()
435 sched_param->sched_runtime = runtime; in parse_prio()
436 sched_param->sched_deadline = period; in parse_prio()
437 sched_param->sched_period = period; in parse_prio()
444 return -1; in parse_prio()
447 return -1; in parse_prio()
449 return -1; in parse_prio()
451 sched_param->sched_policy = SCHED_FIFO; in parse_prio()
452 sched_param->sched_priority = prio; in parse_prio()
459 return -1; in parse_prio()
462 return -1; in parse_prio()
464 return -1; in parse_prio()
466 sched_param->sched_policy = SCHED_RR; in parse_prio()
467 sched_param->sched_priority = prio; in parse_prio()
474 return -1; in parse_prio()
477 return -1; in parse_prio()
479 return -1; in parse_prio()
481 sched_param->sched_policy = SCHED_OTHER; in parse_prio()
482 sched_param->sched_nice = prio; in parse_prio()
485 return -1; in parse_prio()
491 * set_cpu_dma_latency - set the /dev/cpu_dma_latecy
507 return -1; in set_cpu_dma_latency()
514 return -1; in set_cpu_dma_latency()
526 * find_mount - find a the mount point of a given fs
554 strncpy(mp, mount_point, sizeof_mp - 1); in find_mount()
561 * get_self_cgroup - get the current thread cgroup path
565 * 0::/user.slice/user-0.slice/session-3.scope'\n'
624 * set_comm_cgroup - Set cgroup to pid_t pid
635 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")]; in set_pid_cgroup()
649 sizeof(cgroup_path) - strlen(cgroup_path)); in set_pid_cgroup()
656 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); in set_pid_cgroup()
671 err_msg("Error setting cgroup attributes for pid:%s - %s\n", in set_pid_cgroup()
682 * set_comm_cgroup - Set cgroup to threads starting with char *comm_prefix
693 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")]; in set_comm_cgroup()
714 sizeof(cgroup_path) - strlen(cgroup_path)); in set_comm_cgroup()
721 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); in set_comm_cgroup()
744 retval = write(cg_fd, proc_entry->d_name, strlen(proc_entry->d_name)); in set_comm_cgroup()
746 err_msg("Error setting cgroup attributes for pid:%s - %s\n", in set_comm_cgroup()
747 proc_entry->d_name, strerror(errno)); in set_comm_cgroup()
751 debug_msg("Set cgroup attributes for pid:%s\n", proc_entry->d_name); in set_comm_cgroup()
766 * auto_house_keeping - Automatically move rtla out of measurement threads
779 if (retval == -1) { in auto_house_keeping()
784 /* then check if the existing setup is already good. */ in auto_house_keeping()
788 debug_msg("Skipping auto house-keeping\n"); in auto_house_keeping()
800 debug_msg("Could not find any CPU for auto house-keeping\n"); in auto_house_keeping()
805 if (retval == -1) { in auto_house_keeping()
806 debug_msg("Could not set affinity for auto house-keeping\n"); in auto_house_keeping()
810 debug_msg("rtla automatically moved to an auto house-keeping cpu set\n"); in auto_house_keeping()