# Path: misc/cpu.py
# CPU_PREFIX = '/sys/devices/system/cpu/'
# def save():
# def change(governor, freq=None):
# def available_freq():
# def min_freq():
# def max_freq():
# def dump():
# 
# Path: misc/buggers.py
# def silence():
#     def noise():


import argparse
import sys
import asyncio as aio
import os
import statistics
import uvloop
import psutil
from asyncio.subprocess import PIPE, STDOUT
from misc import cpu
from misc import buggers
            line = line.decode('utf-8')
            lines.append(line)
            if line.startswith('Requests/sec:'):
                rps = float(line.split()[-1])
        else:
            break

    retcode = loop.run_until_complete(wrk.wait())
    if retcode != 0:
        print('\r\n'.join(lines))

    return rps


def cpu_usage(p):
    return p.cpu_percent() + sum(c.cpu_percent() for c in p.children())


def connections(process):
    return len(
        set(c.fd for c in process.connections()) |
        set(c.fd for p in process.children() for c in p.connections()))


def memory(p):
    return p.memory_percent('uss') \
        + sum(c.memory_percent('uss') for c in p.children())


if __name__ == '__main__':

# Path: misc/cpu.py
# CPU_PREFIX = '/sys/devices/system/cpu/'
# def save():
# def change(governor, freq=None):
# def available_freq():
# def min_freq():
# def max_freq():
# def dump():
# 
# Path: misc/buggers.py
# def silence():
#     def noise():


# Path: do_wrk.py
import argparse
import sys
import asyncio as aio
import os
import statistics
import uvloop
import psutil
from asyncio.subprocess import PIPE, STDOUT
from misc import cpu
from misc import buggers

            line = line.decode('utf-8')
            lines.append(line)
            if line.startswith('Requests/sec:'):
                rps = float(line.split()[-1])
        else:
            break

    retcode = loop.run_until_complete(wrk.wait())
    if retcode != 0:
        print('\r\n'.join(lines))

    return rps


def cpu_usage(p):
    return p.cpu_percent() + sum(c.cpu_percent() for c in p.children())


def connections(process):
    return len(
        set(c.fd for c in process.connections()) |
        set(c.fd for p in process.children() for c in p.connections()))


def memory(p):
    return p.memory_percent('uss') \
        + sum(c.memory_percent('uss') for c in p.children())


if __name__ == '__main__':

    buggers.silence()