Recent changes (master)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit 44834c57f944074684c1b58604cc44199cf5e633:

  examples: add missing fiograph diagram for sg_write_same_ndob.fio (2023-01-11 15:22:40 -0500)

are available in the Git repository at:

  git://git.kernel.dk/fio.git master

for you to fetch changes up to 69bb4b00b20047e7b5af9a6e35cc872cae605071:

  tools/fiograph: improve default config file search (2023-01-18 19:52:15 -0500)

----------------------------------------------------------------
Vincent Fu (3):
      tools/fiograph: add link to file formats
      tools/fiograph: improve default output file name
      tools/fiograph: improve default config file search

 tools/fiograph/fiograph.py | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

---

Diff of recent changes:

diff --git a/tools/fiograph/fiograph.py b/tools/fiograph/fiograph.py
index 384decda..86ed40a8 100755
--- a/tools/fiograph/fiograph.py
+++ b/tools/fiograph/fiograph.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python3
+import errno
 from graphviz import Digraph
 import argparse
 import configparser
@@ -274,7 +275,7 @@ def setup_commandline():
     parser.add_argument('--format', action='store',
                         type=str,
                         default='png',
-                        help='the output format')
+                        help='the output format (see https://graphviz.org/docs/outputs/)')
     parser.add_argument('--view', action='store_true',
                         default=False,
                         help='view the graph')
@@ -283,7 +284,6 @@ def setup_commandline():
                         help='keep the graphviz script file')
     parser.add_argument('--config', action='store',
                         type=str,
-                        default='fiograph.conf',
                         help='the configuration filename')
     args = parser.parse_args()
     return args
@@ -292,13 +292,26 @@ def setup_commandline():
 def main():
     global config_file
     args = setup_commandline()
+
     if args.output is None:
         output_file = args.file
-        output_file = output_file.replace('.fio', '')
+        if output_file.endswith('.fio'):
+            output_file = output_file[:-4]
     else:
         output_file = args.output
+
+    if args.config is None:
+        if os.path.exists('fiograph.conf'):
+            config_filename = 'fiograph.conf'
+        else:
+            config_filename = os.path.join(os.path.dirname(__file__), 'fiograph.conf')
+            if not os.path.exists(config_filename):
+                raise FileNotFoundError("Cannot locate configuration file")
+    else:
+        config_filename = args.config
     config_file = configparser.RawConfigParser(allow_no_value=True)
-    config_file.read(args.config)
+    config_file.read(config_filename)
+
     fio_to_graphviz(args.file, args.format).render(output_file, view=args.view)
     if not args.keep:
         os.remove(output_file)



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux