From e7d4bef97a22234f885c301b05c2a4ce122b06f4 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 16 Jul 2017 04:31:48 +0200 Subject: add doc/tools/performance_test.py --- doc/tools/performance_test.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 doc/tools/performance_test.py 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() -- cgit 1.4.1-2-gfad0