2022-11-13 02:15:47 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright (C) 2017 Intel Corporation.
|
|
|
|
# All rights reserved.
|
|
|
|
|
2019-09-19 21:13:36 +00:00
|
|
|
def spdk_kill_instance(client, sig_name):
|
2018-05-21 20:07:12 +00:00
|
|
|
"""Send a signal to the SPDK process.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
sig_name: signal to send ("SIGINT", "SIGTERM", "SIGQUIT", "SIGHUP", or "SIGKILL")
|
|
|
|
"""
|
|
|
|
params = {'sig_name': sig_name}
|
2019-09-19 21:13:36 +00:00
|
|
|
return client.call('spdk_kill_instance', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
2018-02-14 21:34:55 +00:00
|
|
|
|
2019-09-18 08:12:48 +00:00
|
|
|
def framework_monitor_context_switch(client, enabled=None):
|
2018-05-21 20:07:12 +00:00
|
|
|
"""Query or set state of context switch monitoring.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
enabled: True to enable monitoring; False to disable monitoring; None to query (optional)
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Current context switch monitoring state (after applying enabled flag).
|
|
|
|
"""
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {}
|
2018-05-21 20:07:12 +00:00
|
|
|
if enabled is not None:
|
|
|
|
params['enabled'] = enabled
|
2019-09-18 08:12:48 +00:00
|
|
|
return client.call('framework_monitor_context_switch', params)
|
2019-03-02 08:32:19 +00:00
|
|
|
|
|
|
|
|
2019-12-17 22:32:51 +00:00
|
|
|
def framework_get_reactors(client):
|
|
|
|
"""Query list of all reactors.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
List of all reactors.
|
|
|
|
"""
|
|
|
|
return client.call('framework_get_reactors')
|
|
|
|
|
|
|
|
|
2022-02-07 12:19:24 +00:00
|
|
|
def framework_set_scheduler(client, name, period=None, load_limit=None, core_limit=None,
|
|
|
|
core_busy=None):
|
2020-11-26 10:18:16 +00:00
|
|
|
"""Select threads scheduler that will be activated and its period.
|
2020-08-27 17:06:35 +00:00
|
|
|
|
|
|
|
Args:
|
|
|
|
name: Name of a scheduler
|
2020-11-26 10:18:16 +00:00
|
|
|
period: Scheduler period in microseconds
|
2020-08-27 17:06:35 +00:00
|
|
|
Returns:
|
|
|
|
True or False
|
|
|
|
"""
|
|
|
|
params = {'name': name}
|
2020-11-26 10:18:16 +00:00
|
|
|
if period is not None:
|
|
|
|
params['period'] = period
|
2022-02-07 12:19:24 +00:00
|
|
|
if load_limit is not None:
|
|
|
|
params['load_limit'] = load_limit
|
|
|
|
if core_limit is not None:
|
|
|
|
params['core_limit'] = core_limit
|
|
|
|
if core_busy is not None:
|
|
|
|
params['core_busy'] = core_busy
|
2020-08-27 17:06:35 +00:00
|
|
|
return client.call('framework_set_scheduler', params)
|
|
|
|
|
|
|
|
|
2021-01-14 14:11:56 +00:00
|
|
|
def framework_get_scheduler(client):
|
|
|
|
"""Query currently set scheduler.
|
|
|
|
|
|
|
|
Returns:
|
2021-11-25 01:40:59 +00:00
|
|
|
Name, period (in microseconds) of currently set scheduler and name of currently set governor.
|
2021-01-14 14:11:56 +00:00
|
|
|
"""
|
|
|
|
return client.call('framework_get_scheduler')
|
|
|
|
|
|
|
|
|
2019-03-02 08:32:19 +00:00
|
|
|
def thread_get_stats(client):
|
|
|
|
"""Query threads statistics.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Current threads statistics.
|
|
|
|
"""
|
|
|
|
return client.call('thread_get_stats')
|
2020-02-20 22:50:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
def thread_set_cpumask(client, id, cpumask):
|
|
|
|
"""Set the cpumask of the thread whose ID matches to the specified value.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
id: thread ID
|
|
|
|
cpumask: cpumask for this thread
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
True or False
|
|
|
|
"""
|
|
|
|
params = {'id': id, 'cpumask': cpumask}
|
|
|
|
return client.call('thread_set_cpumask', params)
|
2020-02-06 07:26:33 +00:00
|
|
|
|
|
|
|
|
2020-08-26 11:19:15 +00:00
|
|
|
def log_enable_timestamps(client, enabled):
|
|
|
|
"""Enable or disable timestamps.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
value: on or off
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
None
|
|
|
|
"""
|
|
|
|
params = {'enabled': enabled}
|
|
|
|
return client.call('log_enable_timestamps', params)
|
|
|
|
|
|
|
|
|
2020-02-06 07:26:33 +00:00
|
|
|
def thread_get_pollers(client):
|
|
|
|
"""Query current pollers.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Current pollers.
|
|
|
|
"""
|
|
|
|
return client.call('thread_get_pollers')
|
2020-02-13 12:19:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def thread_get_io_channels(client):
|
|
|
|
"""Query current IO channels.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Current IO channels.
|
|
|
|
"""
|
|
|
|
return client.call('thread_get_io_channels')
|