def get_stats_action(cachespec, interval):
    """Action for getting bcache statistics for a given cachespec.
    Cachespec can either be a device name, eg. 'sdb', which will retrieve
    cache stats for the given device, or 'global', which will retrieve stats
    for all cachesets
    """
    if cachespec == 'global':
        caches = get_bcache_fs()
    else:
        caches = [Bcache.fromdevice(cachespec)]
    res = dict((c.cachepath, c.get_stats(interval)) for c in caches)
    return json.dumps(res, indent=4, separators=(',', ': '))
def get_stats_action ( cachespec , interval ) : if cachespec == 'global' : caches = get_bcache_fs ( ) else : caches = [ Bcache . fromdevice ( cachespec ) ] res = dict ( ( c . cachepath , c . get_stats ( interval ) ) for c in caches ) return json . dumps ( res , indent = 4 , separators = ( ',' , ': ' ) )
Action for getting bcache statistics for a given cachespec.
    Cachespec can either be a device name, eg. 'sdb', which will retrieve
    cache stats for the given device, or 'global', which will retrieve stats
    for all cachesets