[tor-commits] [onionperf/develop] Only try to load analysis files in an input directory

karsten at torproject.org karsten at torproject.org
Wed Sep 16 15:15:08 UTC 2020


commit d21d41e4d504b48ac5617530830da320a89a9eed
Author: Ana Custura <ana at netstat.org.uk>
Date:   Sat Aug 29 15:10:32 2020 +0100

    Only try to load analysis files in an input directory
---
 onionperf/onionperf | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/onionperf/onionperf b/onionperf/onionperf
index 7c16aea..e3f49c8 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -458,11 +458,12 @@ def filter(args):
         output_dir, output_file = os.path.split(output_path)
         filtering.apply_filters(input_path=input_path, output_dir=output_dir, output_file=output_file)
     else:
-        for dirpath, dirnames, filenames in os.walk(input_path):
-            for filename in filenames:
-                input_file = os.path.join(dirpath, filename)
-                output_dir = os.path.join(output_path, os.path.relpath(dirpath, input_path))
-                filtering.apply_filters(input_path=input_file, output_dir=output_dir, output_file=filename)
+        from onionperf import reprocessing
+        analyses = reprocessing.collect_logs(input_path, '*onionperf.analysis.*')
+        for analysis in analyses:
+            full_output_path = os.path.join(output_path, os.path.relpath(analysis, input_path))
+            output_dir, output_file = os.path.split(full_output_path)
+            filtering.apply_filters(input_path=analysis, output_dir=output_dir, output_file=output_file)
 
 def visualize(args):
     from onionperf.visualization import TGenVisualization





More information about the tor-commits mailing list