Lines Matching +full:p +full:- +full:states

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
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
104 const char *p; in parse_cpu_set() local
114 for (p = cpu_list; *p; ) { in parse_cpu_set()
115 cpu = atoi(p); in parse_cpu_set()
116 if (cpu < 0 || (!cpu && *p != '0') || cpu >= nr_cpus) in parse_cpu_set()
119 while (isdigit(*p)) in parse_cpu_set()
120 p++; in parse_cpu_set()
121 if (*p == '-') { in parse_cpu_set()
122 p++; in parse_cpu_set()
123 end_cpu = atoi(p); in parse_cpu_set()
124 if (end_cpu < cpu || (!end_cpu && *p != '0') || end_cpu >= nr_cpus) in parse_cpu_set()
126 while (isdigit(*p)) in parse_cpu_set()
127 p++; in parse_cpu_set()
141 if (*p == ',') in parse_cpu_set()
142 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
208 return -1; in parse_ns_duration()
256 * procfs_is_workload_pid - check if a procfs entry contains a comm_prefix* comm
272 if (proc_entry->d_type != DT_DIR) in procfs_is_workload_pid()
275 if (*proc_entry->d_name == '.') in procfs_is_workload_pid()
279 for (t_name = proc_entry->d_name; t_name; t_name++) { in procfs_is_workload_pid()
287 snprintf(buffer, MAX_PATH, "/proc/%s/comm", proc_entry->d_name); in procfs_is_workload_pid()
305 debug_msg("Found workload pid:%s comm:%s", proc_entry->d_name, buffer); in procfs_is_workload_pid()
311 * set_comm_sched_attr - set sched params to threads starting with char *comm_prefix
343 retval = __set_sched_attr(atoi(proc_entry->d_name), attr); in set_comm_sched_attr()
345 err_msg("Error setting sched attributes for pid:%s\n", proc_entry->d_name); in set_comm_sched_attr()
349 debug_msg("Set sched attributes for pid:%s\n", proc_entry->d_name); in set_comm_sched_attr()
366 return -1; in get_long_ns_after_colon()
382 return -1; in get_long_after_colon()
413 sched_param->size = sizeof(*sched_param); in parse_prio()
420 return -1; in parse_prio()
424 return -1; in parse_prio()
428 return -1; in parse_prio()
431 return -1; in parse_prio()
433 sched_param->sched_policy = SCHED_DEADLINE; in parse_prio()
434 sched_param->sched_runtime = runtime; in parse_prio()
435 sched_param->sched_deadline = period; in parse_prio()
436 sched_param->sched_period = period; in parse_prio()
443 return -1; in parse_prio()
446 return -1; in parse_prio()
448 return -1; in parse_prio()
450 sched_param->sched_policy = SCHED_FIFO; in parse_prio()
451 sched_param->sched_priority = prio; in parse_prio()
458 return -1; in parse_prio()
461 return -1; in parse_prio()
463 return -1; in parse_prio()
465 sched_param->sched_policy = SCHED_RR; in parse_prio()
466 sched_param->sched_priority = prio; in parse_prio()
473 return -1; in parse_prio()
476 return -1; in parse_prio()
478 return -1; in parse_prio()
480 sched_param->sched_policy = SCHED_OTHER; in parse_prio()
481 sched_param->sched_nice = prio; in parse_prio()
484 return -1; in parse_prio()
490 * set_cpu_dma_latency - set the /dev/cpu_dma_latecy
506 return -1; in set_cpu_dma_latency()
513 return -1; in set_cpu_dma_latency()
526 * save_cpu_idle_state_disable - save disable for all idle states of a cpu
528 * Saves the current disable of all idle states of a cpu, to be subsequently
549 return -1; in save_cpu_idle_disable_state()
554 return -1; in save_cpu_idle_disable_state()
568 * restore_cpu_idle_disable_state - restore disable for all idle states of a cpu
570 * Restores the current disable state of all idle states of a cpu that was
588 return -1; in restore_cpu_idle_disable_state()
592 return -1; in restore_cpu_idle_disable_state()
601 saved_cpu_idle_disable_state_alloc_ctr--; in restore_cpu_idle_disable_state()
611 * free_cpu_idle_disable_states - free saved idle state disable for all cpus
614 * and states.
640 * set_deepest_cpu_idle_state - limit idle state of cpu
642 * Disables all idle states deeper than the one given in
643 * deepest_state (assuming states with higher number are deeper).
646 * set_cpu_dma_latency, it can disable idle states per cpu.
672 * find_mount - find a the mount point of a given fs
700 strncpy(mp, mount_point, sizeof_mp - 1); in find_mount()
707 * get_self_cgroup - get the current thread cgroup path
711 * 0::/user.slice/user-0.slice/session-3.scope'\n'
770 * set_comm_cgroup - Set cgroup to pid_t pid
781 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")]; in set_pid_cgroup()
795 sizeof(cgroup_path) - strlen(cgroup_path)); in set_pid_cgroup()
802 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); in set_pid_cgroup()
817 err_msg("Error setting cgroup attributes for pid:%s - %s\n", in set_pid_cgroup()
828 * set_comm_cgroup - Set cgroup to threads starting with char *comm_prefix
839 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")]; in set_comm_cgroup()
860 sizeof(cgroup_path) - strlen(cgroup_path)); in set_comm_cgroup()
867 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); in set_comm_cgroup()
890 retval = write(cg_fd, proc_entry->d_name, strlen(proc_entry->d_name)); in set_comm_cgroup()
892 err_msg("Error setting cgroup attributes for pid:%s - %s\n", in set_comm_cgroup()
893 proc_entry->d_name, strerror(errno)); in set_comm_cgroup()
897 debug_msg("Set cgroup attributes for pid:%s\n", proc_entry->d_name); in set_comm_cgroup()
912 * auto_house_keeping - Automatically move rtla out of measurement threads
925 if (retval == -1) { in auto_house_keeping()
934 debug_msg("Skipping auto house-keeping\n"); in auto_house_keeping()
946 debug_msg("Could not find any CPU for auto house-keeping\n"); in auto_house_keeping()
951 if (retval == -1) { in auto_house_keeping()
952 debug_msg("Could not set affinity for auto house-keeping\n"); in auto_house_keeping()
956 debug_msg("rtla automatically moved to an auto house-keeping cpu set\n"); in auto_house_keeping()