Module: check_mk
Branch: master
Commit: 175d9a35f2e63d49ada4d1afa1d0bdceffe8b54b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=175d9a35f2e63d…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jan 31 13:51:43 2018 +0100
Updated 'Testing time.clock in structured_data tests'
Change-Id: Ic42a0ea769eb0cc69967ac1b0f0ab2875d4f8344
---
tests/cmk/structured_data/test_structured_data.py | 72 +++++++++++++++--------
1 file changed, 46 insertions(+), 26 deletions(-)
diff --git a/tests/cmk/structured_data/test_structured_data.py
b/tests/cmk/structured_data/test_structured_data.py
index f5208f0..dd4fb17 100644
--- a/tests/cmk/structured_data/test_structured_data.py
+++ b/tests/cmk/structured_data/test_structured_data.py
@@ -550,7 +550,7 @@ def test_structured_data_StructuredDataTree_building_tree():
((0, 16272, 0), (16270, 0, 16272)),
),
])
-def test_structured_data_StructuredDataTree_cpu_tracking_load_from(trees, stats, entries,
results):
+def test_structured_data_StructuredDataTree_performance(trees, stats, entries, results):
tree_old_name, tree_new_fixed_name, tree_new_variable_name = trees
time_loading_tree, time_delta_tree, time_count_entries = stats
tree_old_entries, tree_new_fixed_entries, tree_new_variable_entries = entries
@@ -596,50 +596,70 @@ def
test_structured_data_StructuredDataTree_cpu_tracking_load_from(trees, stats,
# ---count entries--------------------------------------------------------
- cpu_tracking.start("busy")
+ #TODO testing
+ start = time.clock()
entries_old = tree_old.count_entries()
- cpu_tracking.end()
- phase_times = cpu_tracking.get_times()
- total_times = phase_times["TOTAL"]
- run_time = total_times[4]
+ run_time = time.clock() - start
+ #cpu_tracking.start("busy")
+ #entries_old = tree_old.count_entries()
+ #cpu_tracking.end()
+ #phase_times = cpu_tracking.get_times()
+ #total_times = phase_times["TOTAL"]
+ #run_time = total_times[4]
assert run_time < time_count_entries
assert tree_old_entries == entries_old
- cpu_tracking.start("busy")
+ #TODO testing
+ start = time.clock()
entries_new_fixed = tree_new_fixed.count_entries()
- cpu_tracking.end()
- phase_times = cpu_tracking.get_times()
- total_times = phase_times["TOTAL"]
- run_time = total_times[4]
+ run_time = time.clock() - start
+ #cpu_tracking.start("busy")
+ #entries_new_fixed = tree_new_fixed.count_entries()
+ #cpu_tracking.end()
+ #phase_times = cpu_tracking.get_times()
+ #total_times = phase_times["TOTAL"]
+ #run_time = total_times[4]
assert run_time < time_count_entries
assert tree_new_fixed_entries == entries_new_fixed
- cpu_tracking.start("busy")
+ #TODO testing
+ start = time.clock()
entries_new_variable = tree_new_variable.count_entries()
- cpu_tracking.end()
- phase_times = cpu_tracking.get_times()
- total_times = phase_times["TOTAL"]
- run_time = total_times[4]
+ run_time = time.clock() - start
+ #cpu_tracking.start("busy")
+ #entries_new_variable = tree_new_variable.count_entries()
+ #cpu_tracking.end()
+ #phase_times = cpu_tracking.get_times()
+ #total_times = phase_times["TOTAL"]
+ #run_time = total_times[4]
assert run_time < time_count_entries
assert tree_new_variable_entries == entries_new_variable
# ---delta tree computation-----------------------------------------------
- cpu_tracking.start("busy")
+ #TODO testing
+ start = time.clock()
n,c,r,d = tree_new_fixed.compare_with(tree_old)
- cpu_tracking.end()
- phase_times = cpu_tracking.get_times()
- total_times = phase_times["TOTAL"]
- run_time = total_times[4]
+ run_time = time.clock() - start
+ #cpu_tracking.start("busy")
+ #n,c,r,d = tree_new_fixed.compare_with(tree_old)
+ #cpu_tracking.end()
+ #phase_times = cpu_tracking.get_times()
+ #total_times = phase_times["TOTAL"]
+ #run_time = total_times[4]
assert compare_fixed_result == (n,c,r)
assert run_time < time_delta_tree
- cpu_tracking.start("busy")
+ #TODO testing
+ start = time.clock()
n,c,r,d = tree_new_variable.compare_with(tree_old)
- cpu_tracking.end()
- phase_times = cpu_tracking.get_times()
- total_times = phase_times["TOTAL"]
- run_time = total_times[4]
+ run_time = time.clock() - start
+ #cpu_tracking.start("busy")
+ #n,c,r,d = tree_new_variable.compare_with(tree_old)
+ #cpu_tracking.end()
+ #phase_times = cpu_tracking.get_times()
+ #total_times = phase_times["TOTAL"]
+ #run_time = total_times[4]
assert compare_variable_result == (n,c,r)
assert run_time < time_delta_tree