Skip to content

Instantly share code, notes, and snippets.

@ebarcikowski
Created April 28, 2017 20:56

Revisions

  1. ebarcikowski created this gist Apr 28, 2017.
    27 changes: 27 additions & 0 deletions irq_prio.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    def set_system_rt_priorities():
    prio_table = {
    'irq/8-rtc0': 90,
    'ktimersoftd/0': 85,
    'ktimersoftd/1': 85,
    'ktimersoftd/2': 85,
    'ktimersoftd/3': 85,
    'irq/88-eth0': 85,
    'irq/89-eth0-TxR': 85,
    'irq/90-eth0-TxR': 85,
    'irq/91-eth0-TxR': 85,
    'irq/92-eth0-TxR': 85
    }

    for key in prio_table:
    try:
    cmd, pid, prio = lookup_prio(key)
    new_prio = prio_table[key]
    if prio < new_prio :
    print("adjusting priority: {}, {}, {}->{}".format(
    cmd, pid, prio, new_prio))
    chrt_cmd = "chrt -fp {} {}".format(new_prio, pid)
    subprocess.call(chrt_cmd, shell=True)
    except subprocess.CalledProcessError:
    pass