Exemplo n.º 1
0
def summarize_subroutines(funcnames, title=None):
    subpids = _funcpids(funcnames)
    # funcnames are specified using | operator
    if (not subpids):
        return
    if (len(subpids) < 100):
        verifyFastSet(subpids, funcnames)
    if (not subpids):
        return
    d = defaultdict(int)
    total = 0
    for pid in subpids:
        t = T_table.getByTid(pid)
        d[t.state] += 1
        total += 1
    # Print
    if (title):
        header = "There are {} threads {}".format(total, title)
    else:
        header = "There are {} threads doing {}".format(total, funcnames)
    print_header(header)
    for k, v in d.items():
        print("  {:3d} in {}".format(v, k))
    print_pidlist(subpids,
                  maxpids=_MAXPIDS,
                  verbose=_VERBOSE,
                  sortbytime=_SORTBYTIME)
Exemplo n.º 2
0
def check_throttle_direct_reclaim(tasksrem):
    pids = _funcpids(__tdr_func)
    verifyFastSet(pids, __tdr_func)
    if (pids):
        print_header("Waiting for kswapd")
        print_pidlist(pids,
                      maxpids=_MAXPIDS,
                      verbose=_VERBOSE,
                      sortbytime=_SORTBYTIME,
                      statefilter=('UN', ))
        remove_pidlist(tasksrem, pids)
Exemplo n.º 3
0
def check_stack_and_print(funcname, tasksrem, txt=None):
    pids = _funcpids(funcname) & tasksrem
    verifyFastSet(pids, funcname)
    if (not pids):
        return
    if (txt is None):
        txt = funcname
    print_header("Waiting in {}".format(txt))
    print_pidlist(pids,
                  maxpids=_MAXPIDS,
                  verbose=_VERBOSE,
                  sortbytime=_SORTBYTIME)
    add_resource_pid(txt, set(pids))
    remove_pidlist(tasksrem, pids)
Exemplo n.º 4
0
def check_console_sem(tasksrem):
    console_sem_addr = sym2addr("console_sem")
    if (not console_sem_addr):
        return
    pidcomms = decode_semaphore(console_sem_addr, 0)
    if (pidcomms):
        print_header("Waiting on console_sem")
        for pid, comm in pidcomms:
            print("\t{:8d}  {}".format(pid, comm))
    remove_pidlist(tasksrem, [pid for pid, comm in pidcomms])
    # Try to find a possible owner
    __testfunc = "__console_unlock"
    pids = _funcpids(__testfunc)
    verifyFastSet(pids, __testfunc)
    if (pids):
        print("    Possible owners: {}".format(pids))
Exemplo n.º 5
0
def check_memory_pressure(_funcpids):
    subpids = _funcpids(__mp_names)
    if (not subpids):
        return False
    if (len(subpids) < 100):
        verifyFastSet(subpids, __mp_names)
    d = defaultdict(int)
    total = 0
    T_table = TaskTable()
    for pid in subpids:
        t = T_table.getByTid(pid)
        d[t.state] += 1
        total += 1
    if ("TASK_UNINTERRUPTIBLE" in d or total > 20):
        pylog.warning("Memory pressure detected")
        print("  *** {} ***".format(__mp_names))
        for k, v in d.items():
            print("   {:4d} in {} state".format(v, k))
        return True