diff options
author | Philip Knirsch <pknirsch@hamburg.stuttgart.redhat.com> | 2009-02-02 12:33:41 +0100 |
---|---|---|
committer | Philip Knirsch <pknirsch@hamburg.stuttgart.redhat.com> | 2009-02-02 12:33:41 +0100 |
commit | 796739577264cd143b50dc7cd5302cd8ab49ca08 (patch) | |
tree | 04e4d293faa45c88fe4a88e8717ff160574b43c0 /tuned.py | |
download | tuned-796739577264cd143b50dc7cd5302cd8ab49ca08.tar.gz tuned-796739577264cd143b50dc7cd5302cd8ab49ca08.tar.xz tuned-796739577264cd143b50dc7cd5302cd8ab49ca08.zip |
- Initial stuff
Diffstat (limited to 'tuned.py')
-rw-r--r-- | tuned.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tuned.py b/tuned.py new file mode 100644 index 0000000..35604c5 --- /dev/null +++ b/tuned.py @@ -0,0 +1,38 @@ +import time,os,locale + +class Tuned: + def __init__(self): + self.mp = [] + self.tp = [] + + def __initplugins__(self, path, module, store): + _files = map(lambda v: v[:-3], filter(lambda v: v[-3:] == ".py" and \ + v != "__init__.py" and \ + v[0] != '.', \ + os.listdir(path+"/"+module))) + locale.setlocale(locale.LC_ALL, "C") + _files.sort() + locale.setlocale(locale.LC_ALL, "") + for _i in _files: + _cmd = "from %s.%s import _plugin" % (module, _i) + exec _cmd + store.append(_plugin) + + def init(self, path): + self.__initplugins__(path, "monitorplugins", self.mp) + self.__initplugins__(path, "tuningplugins", self.tp) + + def run(self): + print("Running...") + while True: + lh = {} + for p in self.mp: + lh.update(p.getLoad()) + for p in self.tp: + p.setTuning(lh) + time.sleep(10) + + def cleanup(self): + print("Cleanup...") + +tuned = Tuned() |