libosmovty 1.11.0.24-ece60
Osmocom VTY library
|
CPU Scheduling related VTY API. More...
Files | |
file | cpu_sched_vty.c |
Implementation to CPU / Threading / Scheduler properties from VTY configuration. | |
Data Structures | |
struct | cpu_affinity_it |
struct | sched_vty_opts |
Enumerations | |
enum | sched_vty_thread_id { SCHED_VTY_THREAD_SELF , SCHED_VTY_THREAD_ALL , SCHED_VTY_THREAD_ID , SCHED_VTY_THREAD_NAME , SCHED_VTY_THREAD_UNKNOWN } |
Functions | |
static int | get_num_cpus (void) |
static int | parse_cpu_hex_mask (const char *str, cpu_set_t *cpuset, size_t cpuset_size) |
static int | generate_cpu_hex_mask (char *str, size_t str_buf_size, cpu_set_t *cpuset, size_t cpuset_size) |
static bool | proc_tid_exists (pid_t tid) |
static bool | proc_name_exists (const char *name, pid_t *res_pid) |
static enum sched_vty_thread_id | procname2pid (pid_t *res_pid, const char *str, bool applynow) |
static int | my_sched_setaffinity (enum sched_vty_thread_id tid_type, pid_t pid, cpu_set_t *cpuset, size_t cpuset_size) |
DEFUN_ATTR (cfg_sched_cpu_affinity, cfg_sched_cpu_affinity_cmd, "cpu-affinity (self|all|<0-4294967295>|THREADNAME) CPUHEXMASK [delay]", "Set CPU affinity mask on a (group of) thread(s)\n" "Set CPU affinity mask on thread running the VTY\n" "Set CPU affinity mask on all process' threads\n" "Set CPU affinity mask on a thread with specified PID\n" "Set CPU affinity mask on a thread with specified thread name\n" "CPU affinity mask\n" "If set, delay applying the affinity mask now and let the app handle it at a later point\n", CMD_ATTR_IMMEDIATE) | |
static int | set_sched_rr (unsigned int prio) |
DEFUN_ATTR (cfg_sched_policy, cfg_sched_policy_cmd, "policy rr <1-32>", "Set the scheduling policy to use for the process\n" "Use the SCHED_RR real-time scheduling algorithm\n" "Set the SCHED_RR real-time priority\n", CMD_ATTR_IMMEDIATE) | |
DEFUN (cfg_sched, cfg_sched_cmd, "cpu-sched", "Configure CPU Scheduler related settings") | |
DEFUN (show_sched_threads, show_sched_threads_cmd, "show cpu-sched threads", SHOW_STR "Show Sched section information\n" "Show information about running threads)\n") | |
static int | config_write_sched (struct vty *vty) |
int | osmo_cpu_sched_vty_init (void *tall_ctx) |
Initialize sched VTY nodes. More... | |
int | osmo_cpu_sched_vty_apply_localthread (void) |
Apply cpu-affinity on calling thread based on VTY configuration. More... | |
Variables | |
static struct sched_vty_opts * | sched_vty_opts |
static struct cmd_node | sched_node |
CPU Scheduling related VTY API.
enum sched_vty_thread_id |
|
static |
References cpu_affinity_it::bufname, CMD_SUCCESS, sched_vty_opts::cpu_affinity_li, cpu_affinity_it::cpuset, cpu_affinity_it::cpuset_size, cpu_affinity_it::delay, entry, generate_cpu_hex_mask(), llist_empty(), llist_for_each_entry, OSMO_STRLCPY_ARRAY, sched_vty_opts::sched_rr_prio, VTY_NEWLINE, and vty_out().
Referenced by osmo_cpu_sched_vty_init().
DEFUN | ( | cfg_sched | , |
cfg_sched_cmd | , | ||
"cpu-sched" | , | ||
"Configure CPU Scheduler related settings" | |||
) |
References CMD_SUCCESS, vty::index, L_CPU_SCHED_NODE, and vty::node.
DEFUN | ( | show_sched_threads | , |
show_sched_threads_cmd | , | ||
"show cpu-sched threads" | , | ||
SHOW_STR "Show Sched section information\n" "Show information about running | threads | ||
) |
References CMD_SUCCESS, CMD_WARNING, entry, fd, generate_cpu_hex_mask(), get_num_cpus(), name, VTY_NEWLINE, and vty_out().
DEFUN_ATTR | ( | cfg_sched_cpu_affinity | , |
cfg_sched_cpu_affinity_cmd | , | ||
"cpu-affinity (self|all|<0-4294967295>|THREADNAME) CPUHEXMASK " | [delay], | ||
"Set CPU affinity mask on a (group of) thread(s)\n" "Set CPU affinity mask on thread running the VTY\n" "Set CPU affinity mask on all process' threads\n" "Set CPU affinity mask on a thread with specified PID\n" "Set CPU affinity mask on a thread with specified thread name\n" "CPU affinity mask\n" "If | set, | ||
delay applying the affinity mask now and let the app handle it at a later point\n" | , | ||
CMD_ATTR_IMMEDIATE | |||
) |
References argc, argv, cpu_affinity_it::bufname, CMD_SUCCESS, CMD_WARNING, sched_vty_opts::cpu_affinity_li, sched_vty_opts::cpu_affinity_li_mutex, cpu_affinity_it::cpuset, cpu_affinity_it::cpuset_size, cpu_affinity_it::delay, entry, cpu_affinity_it::entry, get_num_cpus(), llist_add_tail(), llist_del(), llist_for_each_entry_safe, my_sched_setaffinity(), OSMO_STRLCPY_ARRAY, parse_cpu_hex_mask(), pid, procname2pid(), SCHED_VTY_THREAD_ALL, SCHED_VTY_THREAD_ID, SCHED_VTY_THREAD_NAME, SCHED_VTY_THREAD_SELF, SCHED_VTY_THREAD_UNKNOWN, sched_vty_opts::tall_ctx, cpu_affinity_it::tid_type, VTY_NEWLINE, and vty_out().
DEFUN_ATTR | ( | cfg_sched_policy | , |
cfg_sched_policy_cmd | , | ||
"policy rr <1-32>" | , | ||
"Set the scheduling policy to use for the process\n" "Use the SCHED_RR real-time scheduling algorithm\n" "Set the SCHED_RR real-time priority\n" | , | ||
CMD_ATTR_IMMEDIATE | |||
) |
References argv, CMD_SUCCESS, CMD_WARNING, sched_vty_opts::sched_rr_prio, set_sched_rr(), VTY_NEWLINE, and vty_out().
|
static |
Referenced by config_write_sched(), DEFUN(), my_sched_setaffinity(), and osmo_cpu_sched_vty_apply_localthread().
|
static |
References DLGLOBAL, LOGL_ERROR, and LOGP.
Referenced by DEFUN(), DEFUN_ATTR(), and osmo_cpu_sched_vty_init().
|
static |
References DLGLOBAL, entry, generate_cpu_hex_mask(), LOGL_NOTICE, LOGP, pid, and SCHED_VTY_THREAD_ALL.
Referenced by DEFUN_ATTR(), and osmo_cpu_sched_vty_apply_localthread().
int osmo_cpu_sched_vty_apply_localthread | ( | void | ) |
Apply cpu-affinity on calling thread based on VTY configuration.
References cpu_affinity_it::bufname, sched_vty_opts::cpu_affinity_li, sched_vty_opts::cpu_affinity_li_mutex, cpu_affinity_it::cpuset, cpu_affinity_it::cpuset_size, DLGLOBAL, entry, generate_cpu_hex_mask(), llist_for_each_entry, LOGL_FATAL, LOGP, my_sched_setaffinity(), name, OSMO_ASSERT, SCHED_VTY_THREAD_ALL, SCHED_VTY_THREAD_NAME, SCHED_VTY_THREAD_SELF, and cpu_affinity_it::tid_type.
int osmo_cpu_sched_vty_init | ( | void * | tall_ctx | ) |
Initialize sched VTY nodes.
[in] | tall_ctx | Talloc context to use internally by vty_sched subsystem. |
References CONFIG_NODE, config_write_sched(), sched_vty_opts::cpu_affinity_li, sched_vty_opts::cpu_affinity_li_mutex, get_num_cpus(), INIT_LLIST_HEAD, install_lib_element(), install_lib_element_ve(), install_node(), L_CPU_SCHED_NODE, OSMO_ASSERT, sched_node, and sched_vty_opts::tall_ctx.
|
static |
Referenced by DEFUN_ATTR().
|
static |
References entry, fd, and name.
Referenced by procname2pid().
|
static |
References entry.
Referenced by procname2pid().
|
static |
References len(), osmo_str_to_int64(), proc_name_exists(), proc_tid_exists(), SCHED_VTY_THREAD_ALL, SCHED_VTY_THREAD_ID, SCHED_VTY_THREAD_NAME, SCHED_VTY_THREAD_SELF, and SCHED_VTY_THREAD_UNKNOWN.
Referenced by DEFUN_ATTR().
|
static |
References DLGLOBAL, LOGL_ERROR, LOGL_NOTICE, and LOGP.
Referenced by DEFUN_ATTR().
|
static |
Referenced by osmo_cpu_sched_vty_init().
|
static |