Permalink
Browse files

cache available cgroup names

  • Loading branch information...
poelzi committed Apr 1, 2011
1 parent e2d8e88 commit 1c3021f81f68751b42d5dc6697f46f35142bffa1
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/core.lua
View
@@ -187,16 +187,20 @@ function ulatency.tree_loaded(name)
return __CGROUP_LOADED[name]
end
-
+--! @brief returns boolean if name is available
+--! @param name name of subsystem to test
function ulatency.has_cgroup_subsystem(name)
if not __CGROUP_HAS then
ulatency.get_cgroup_subsystems()
end
return (__CGROUP_HAS[name] == true)
end
-
+--!@brief returns a table of available cgroup subsystems
function ulatency.get_cgroup_subsystems()
+ if __CGROUP_AVAIL then
+ return __CGROUP_AVAIL
+ end
__CGROUP_AVAIL = {}
__CGROUP_HAS = {}
for line in io.lines("/proc/cgroups") do

0 comments on commit 1c3021f

Please sign in to comment.