libosmovty UNKNOWN
Osmocom VTY library
Loading...
Searching...
No Matches
Cpu_sched_vty

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.
int osmo_cpu_sched_vty_apply_localthread (void)
 Apply cpu-affinity on calling thread based on VTY configuration.

Variables

static struct sched_vty_opts * sched_vty_opts
static struct cmd_node sched_node

Detailed Description

CPU Scheduling related VTY API.

Enumeration Type Documentation

◆ sched_vty_thread_id

Enumerator
SCHED_VTY_THREAD_SELF 
SCHED_VTY_THREAD_ALL 
SCHED_VTY_THREAD_ID 
SCHED_VTY_THREAD_NAME 
SCHED_VTY_THREAD_UNKNOWN 

Function Documentation

◆ config_write_sched()

◆ DEFUN() [1/2]

DEFUN ( cfg_sched ,
cfg_sched_cmd ,
"cpu-sched" ,
"Configure CPU Scheduler related settings"  )

◆ DEFUN() [2/2]

DEFUN ( show_sched_threads ,
show_sched_threads_cmd ,
"show cpu-sched threads" ,
SHOW_STR "Show Sched section information\n" "Show information about running threads )

◆ DEFUN_ATTR() [1/2]

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  )

◆ DEFUN_ATTR() [2/2]

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  )

◆ generate_cpu_hex_mask()

int generate_cpu_hex_mask ( char * str,
size_t str_buf_size,
cpu_set_t * cpuset,
size_t cpuset_size )
static

◆ get_num_cpus()

int get_num_cpus ( void )
static

◆ my_sched_setaffinity()

int my_sched_setaffinity ( enum sched_vty_thread_id tid_type,
pid_t pid,
cpu_set_t * cpuset,
size_t cpuset_size )
static

◆ osmo_cpu_sched_vty_apply_localthread()

◆ osmo_cpu_sched_vty_init()

int osmo_cpu_sched_vty_init ( void * tall_ctx)

Initialize sched VTY nodes.

Parameters
[in]tall_ctxTalloc context to use internally by vty_sched subsystem.
Returns
0 on success, non-zero on error.

References CONFIG_NODE, config_write_sched(), sched_vty_opts::cpu_affinity_li, sched_vty_opts::cpu_affinity_li_mutex, get_num_cpus(), install_lib_element(), install_lib_element_ve(), install_node(), L_CPU_SCHED_NODE, sched_node, and sched_vty_opts::tall_ctx.

◆ parse_cpu_hex_mask()

int parse_cpu_hex_mask ( const char * str,
cpu_set_t * cpuset,
size_t cpuset_size )
static

Referenced by DEFUN_ATTR().

◆ proc_name_exists()

bool proc_name_exists ( const char * name,
pid_t * res_pid )
static

Referenced by procname2pid().

◆ proc_tid_exists()

bool proc_tid_exists ( pid_t tid)
static

Referenced by procname2pid().

◆ procname2pid()

enum sched_vty_thread_id procname2pid ( pid_t * res_pid,
const char * str,
bool applynow )
static

◆ set_sched_rr()

int set_sched_rr ( unsigned int prio)
static

Referenced by DEFUN_ATTR().

Variable Documentation

◆ sched_node

struct cmd_node sched_node
static
Initial value:
= {
"%s(config-cpu-sched)# ",
1,
}
@ L_CPU_SCHED_NODE
CPU Sched related options node.
Definition command.h:102

Referenced by osmo_cpu_sched_vty_init().

◆ sched_vty_opts

struct sched_vty_opts* sched_vty_opts
static