eris/eris.py
def mon_metric_cycle(ctx):
    """
    Platform metrics monitor timer function
        ctx - agent context
    """
    containers = ctx.docker_client.containers.list()
    cgroups = []
    cids = []
    bes = []
    lcs = []
    newcon = False
    newbe = False
    remove_finished_containers({c.id for c in containers}, ctx.metric_cons)

    for container in containers:
        cid = container.id
        name = container.name
        pids = list_pids(container)
        key = cid if ctx.args.key_cid else name
        if cid in ctx.metric_cons:
            con = ctx.metric_cons[cid]
            con.update_pids(pids)
        else:
            thresh = ctx.thresh_map.get(key, [])
            tdp_thresh = ctx.tdp_thresh_map.get(key, [])
            con = Container(ctx.cgroup_driver, cid, name, pids,
                            ctx.args.verbose, thresh, tdp_thresh)
            ctx.metric_cons[cid] = con
            con.update_cpu_usage()
            if ctx.args.control and not ctx.args.disable_cat:
                newcon = True
                if key in ctx.be_set:
                    newbe = True
        if key in ctx.lc_set:
            if ctx.args.exclusive_cat:
                lcs.append(con)
            cids.append(cid)
            cgroups.append('/sys/fs/cgroup/perf_event/' +
                           con.parent_path + con.con_path)
        if key in ctx.be_set:
            bes.append(con)
    if newbe or newcon and bes and ctx.args.exclusive_cat:
        ctx.llc.budgeting(bes, lcs)

    if cgroups:
        period = str(ctx.args.metric_interval - 2)
        args = [
            './pgos',
            '-cids', ','.join(cids),
            '-cgroup', ','.join(cgroups),
            '-period', period,
            '-frequency', period,
            '-cycle', '1',
            '-core', str(cpu_count()),
        ]
        if ctx.args.verbose:
            print(' '.join(args))
        output = subprocess.check_output(args, stderr=subprocess.STDOUT)
        data = output.decode('utf-8').splitlines()
        if ctx.args.verbose:
            print(output.decode('utf-8'))
        set_metrics(ctx, data)

    Platform metrics monitor timer function
        ctx - agent context
    
Platform metrics monitor timer function
ctx - agent context
Platform metrics monitor timer function ctx - agent context
def mon_metric_cycle(ctx):
    containers = ctx.docker_client.containers.list()
    cgroups = []
    cids = []
    bes = []
    lcs = []
    newcon = False
    newbe = False
    remove_finished_containers({c.id for c in containers}, ctx.metric_cons)
    for container in containers:
        cid = container.id
        name = container.name
        pids = list_pids(container)
        key = cid if ctx.args.key_cid else name
        if cid in ctx.metric_cons:
            con = ctx.metric_cons[cid]
            con.update_pids(pids)
        else:
            thresh = ctx.thresh_map.get(key, [])
            tdp_thresh = ctx.tdp_thresh_map.get(key, [])
            con = Container(ctx.cgroup_driver, cid, name, pids,
                            ctx.args.verbose, thresh, tdp_thresh)
            ctx.metric_cons[cid] = con
            con.update_cpu_usage()
            if ctx.args.control and not ctx.args.disable_cat:
                newcon = True
                if key in ctx.be_set:
                    newbe = True
        if key in ctx.lc_set:
            if ctx.args.exclusive_cat:
                lcs.append(con)
            cids.append(cid)
            cgroups.append('/sys/fs/cgroup/perf_event/' +
                           con.parent_path + con.con_path)
        if key in ctx.be_set:
            bes.append(con)
    if newbe or newcon and bes and ctx.args.exclusive_cat:
        ctx.llc.budgeting(bes, lcs)
    if cgroups:
        period = str(ctx.args.metric_interval - 2)
        args = [
            './pgos',
            '-cids', ','.join(cids),
            '-cgroup', ','.join(cgroups),
            '-period', period,
            '-frequency', period,
            '-cycle', '1',
            '-core', str(cpu_count()),
        ]
        if ctx.args.verbose:
            print(' '.join(args))
        output = subprocess.check_output(args, stderr=subprocess.STDOUT)
        data = output.decode('utf-8').splitlines()
        if ctx.args.verbose:
            print(output.decode('utf-8'))
        set_metrics(ctx, data)
def mon_metric_cycle ( ctx ) : containers = ctx . docker_client . containers . list ( ) cgroups = [ ] cids = [ ] bes = [ ] lcs = [ ] newcon = False newbe = False remove_finished_containers ( { c . id for c in containers } , ctx . metric_cons ) for container in containers : cid = container . id name = container . name pids = list_pids ( container ) key = cid if ctx . args . key_cid else name if cid in ctx . metric_cons : con = ctx . metric_cons [ cid ] con . update_pids ( pids ) else : thresh = ctx . thresh_map . get ( key , [ ] ) tdp_thresh = ctx . tdp_thresh_map . get ( key , [ ] ) con = Container ( ctx . cgroup_driver , cid , name , pids , ctx . args . verbose , thresh , tdp_thresh ) ctx . metric_cons [ cid ] = con con . update_cpu_usage ( ) if ctx . args . control and not ctx . args . disable_cat : newcon = True if key in ctx . be_set : newbe = True if key in ctx . lc_set : if ctx . args . exclusive_cat : lcs . append ( con ) cids . append ( cid ) cgroups . append ( '/sys/fs/cgroup/perf_event/' + con . parent_path + con . con_path ) if key in ctx . be_set : bes . append ( con ) if newbe or newcon and bes and ctx . args . exclusive_cat : ctx . llc . budgeting ( bes , lcs ) if cgroups : period = str ( ctx . args . metric_interval - 2 ) args = [ './pgos' , '-cids' , ',' . join ( cids ) , '-cgroup' , ',' . join ( cgroups ) , '-period' , period , '-frequency' , period , '-cycle' , '1' , '-core' , str ( cpu_count ( ) ) , ] if ctx . args . verbose : print ( ' ' . join ( args ) ) output = subprocess . check_output ( args , stderr = subprocess . STDOUT ) data = output . decode ( 'utf-8' ) . splitlines ( ) if ctx . args . verbose : print ( output . decode ( 'utf-8' ) ) set_metrics ( ctx , data )
Platform metrics monitor timer function
ctx - agent context
Platform metrics monitor timer function ctx - agent context
"""
    Platform metrics monitor timer function
        ctx - agent context
    """
ctx