Skip to content
Browse files

ulatency tree: fix when requested or default hierarchy is unavailable

- print human readable error if there is no cgroup hierarchy available
- print human readable error if the requested hierarchy is unavailable
- if no hierarchy was specified and the default one (cpu) is
unavailable, select first available

Fixes issue #44
  • Loading branch information...
1 parent 219100f commit d8f82ee6206180308b19f148be304d977f0495bb @gajdusek gajdusek committed Mar 24, 2013
Showing with 15 additions and 1 deletion.
  1. +15 −1 client/ulatency
View
16 client/ulatency
@@ -417,9 +417,23 @@ class Tree(object):
file = u(" ") ),
}
- def __init__(self, tree=DEFAULT_TREE, processes=True, show_all=True,
+ def __init__(self, tree=None, processes=True, show_all=True,
utf = True, color = False, flags = False, cmdline = False,
group_values=True):
+ if not CGROUP_MOUNTS:
+ prnt("No CGroup subsystem hierarchy available.\n"
+ "This means that no controller hierarchy with correspondent "
+ "ulatencyd private hierarchy is mounted.")
+ sys.exit(2)
+ if tree and tree not in CGROUP_MOUNTS:
+ prnt("CGroup '%(tree)s' subsystem hierarchy unavailable.\n"
+ "This means that '%(tree)s' controller hierarchy or "
+ "'%(tree)s' ulatencyd private hierarchy is not mounted." %{'tree': tree})
+ sys.exit(2)
+ if not tree:
+ tree = DEFAULT_TREE
+ if tree not in CGROUP_MOUNTS:
+ tree = sorted(CGROUP_MOUNTS.keys())[0]
self.tree = tree
self.processes = processes
self.show_all = show_all

0 comments on commit d8f82ee

Please sign in to comment.
Something went wrong with that request. Please try again.