summary refs log tree commit diff stats
path: root/doc/tools
diff options
context:
space:
mode:
authorhut <hut@hut.pm>2017-07-16 04:31:48 +0200
committerhut <hut@hut.pm>2017-07-16 04:31:48 +0200
commite7d4bef97a22234f885c301b05c2a4ce122b06f4 (patch)
tree9aa1c76234ee13550a0200ef3a33c07bc9e0cec3 /doc/tools
parent712291259682b8a4dc282fd9748ba44482eecbe5 (diff)
downloadranger-e7d4bef97a22234f885c301b05c2a4ce122b06f4.tar.gz
add doc/tools/performance_test.py
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()