Module: check_mk
Branch: master
Commit: 8455bc94151d50bd458b279c59c8c76319541037
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8455bc94151d50…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Aug 7 14:24:29 2011 +0200
Speedup of cmk -C by using file cache
---
ChangeLog | 2 +-
modules/check_mk.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e46d300..d8afd80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
1.1.11i2:
Core, Setup, etc.:
* FIX: sort output of cmk --list-hosts alphabetically
- * Great speed up of cmk -N, especially when number of hosts is
+ * Great speed up of cmk -N/-C/-U/-R, especially when number of hosts is
large.
Checks & Agents:
diff --git a/modules/check_mk.py b/modules/check_mk.py
index f75c2ea..48fbcba 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2055,12 +2055,16 @@ def precompile_hostchecks():
sys.exit(5)
# read python file and strip comments
+g_stripped_file_cache = {}
def stripped_python_file(filename):
+ if filename in g_stripped_file_cache:
+ return g_stripped_file_cache[filename]
a = ""
for line in file(filename):
l = line.strip()
if l == "" or l[0] != '#':
a += line # not stripped line because of indentation!
+ g_stripped_file_cache[filename] = a
return a
def precompile_hostcheck(hostname):