summary refs log tree commit diff stats
path: root/doc/tools
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tools')
-rwxr-xr-xdoc/tools/performance_test.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/tools/performance_test.py b/doc/tools/performance_test.py
new file mode 100755
index 00000000..0fe629fe
--- /dev/null
+++ b/doc/tools/performance_test.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# pylint: disable=wrong-import-position
+import sys
+import time
+
+sys.path.insert(0, '../..')
+sys.path.insert(0, '.')
+
+
+def main():
+    import ranger.container.directory
+    import ranger.core.shared
+    import ranger.container.settings
+    import ranger.core.fm
+    from ranger.ext.openstruct import OpenStruct
+    ranger.args = OpenStruct()
+    ranger.args.clean = True
+    ranger.args.debug = False
+
+    settings = ranger.container.settings.Settings()
+    ranger.core.shared.SettingsAware.settings_set(settings)
+    fm = ranger.core.fm.FM()
+    ranger.core.shared.FileManagerAware.fm_set(fm)
+
+    time1 = time.time()
+    fm.initialize()
+    try:
+        usr = ranger.container.directory.Directory('/usr')
+        usr.load_content(schedule=False)
+        for fileobj in usr.files:
+            if fileobj.is_directory:
+                fileobj.load_content(schedule=False)
+    finally:
+        fm.destroy()
+    time2 = time.time()
+    print("%dms" % ((time2 - time1) * 1000))
+
+
+if __name__ == '__main__':
+    main()