summaryrefslogtreecommitdiff
path: root/utils/benchmark-verify.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-26 18:54:19 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-26 18:54:19 +0200
commit44dd7bdf6ca33d64650c60578b8a36e108ac2e95 (patch)
tree03ff170d93995e714000e0d17d1ba00f8775083d /utils/benchmark-verify.py
parent13c2f3115ac80e088855a54eeebc624d3c87b911 (diff)
downloadgemato-44dd7bdf6ca33d64650c60578b8a36e108ac2e95.tar.gz
Add utilities to create Manifest tree and verify it
Diffstat (limited to 'utils/benchmark-verify.py')
-rwxr-xr-xutils/benchmark-verify.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/benchmark-verify.py b/utils/benchmark-verify.py
new file mode 100755
index 0000000..d0b2259
--- /dev/null
+++ b/utils/benchmark-verify.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import os.path
+import sys
+import timeit
+
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
+
+import gemato.recursiveloader
+
+
+def benchmark(path):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(path)
+ print('load-dict: {}'.format(timeit.timeit(m.get_file_entry_dict, number=1)))
+ print('verify: {}'.format(timeit.timeit(m.assert_directory_verifies, number=1)))
+
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ print('Usage: {} <top-level-manifest>'.format(sys.argv[0]))
+ sys.exit(1)
+
+ benchmark(sys.argv[1])