summaryrefslogtreecommitdiffstats
path: root/src/spdk/scripts/rpc/app.py
blob: 9412de17d64b1e9b03a00f366793d6d63d3980e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from .helpers import deprecated_alias


@deprecated_alias('kill_instance')
def spdk_kill_instance(client, sig_name):
    """Send a signal to the SPDK process.

    Args:
        sig_name: signal to send ("SIGINT", "SIGTERM", "SIGQUIT", "SIGHUP", or "SIGKILL")
    """
    params = {'sig_name': sig_name}
    return client.call('spdk_kill_instance', params)


@deprecated_alias('context_switch_monitor')
def framework_monitor_context_switch(client, enabled=None):
    """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).
    """
    params = {}
    if enabled is not None:
        params['enabled'] = enabled
    return client.call('framework_monitor_context_switch', params)


def framework_get_reactors(client):
    """Query list of all reactors.

    Returns:
        List of all reactors.
    """
    return client.call('framework_get_reactors')


def thread_get_stats(client):
    """Query threads statistics.

    Returns:
        Current threads statistics.
    """
    return client.call('thread_get_stats')


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)


def thread_get_pollers(client):
    """Query current pollers.

    Returns:
        Current pollers.
    """
    return client.call('thread_get_pollers')


def thread_get_io_channels(client):
    """Query current IO channels.

    Returns:
        Current IO channels.
    """
    return client.call('thread_get_io_channels')