dot2k 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python3
  2. # SPDX-License-Identifier: GPL-2.0-only
  3. #
  4. # Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org>
  5. #
  6. # dot2k: transform dot files into a monitor for the Linux kernel.
  7. #
  8. # For further information, see:
  9. # Documentation/trace/rv/da_monitor_synthesis.rst
  10. if __name__ == '__main__':
  11. from dot2.dot2k import dot2k
  12. import argparse
  13. import ntpath
  14. import os
  15. import platform
  16. import sys
  17. parser = argparse.ArgumentParser(description='transform .dot file into kernel rv monitor')
  18. parser.add_argument('-d', "--dot", dest="dot_file", required=True)
  19. parser.add_argument('-t', "--monitor_type", dest="monitor_type", required=True)
  20. parser.add_argument('-n', "--model_name", dest="model_name", required=False)
  21. parser.add_argument("-D", "--description", dest="description", required=False)
  22. params = parser.parse_args()
  23. print("Opening and parsing the dot file %s" % params.dot_file)
  24. try:
  25. monitor=dot2k(params.dot_file, params.monitor_type)
  26. except Exception as e:
  27. print('Error: '+ str(e))
  28. print("Sorry : :-(")
  29. sys.exit(1)
  30. # easier than using argparse action.
  31. if params.model_name != None:
  32. print(params.model_name)
  33. print("Writing the monitor into the directory %s" % monitor.name)
  34. monitor.print_files()
  35. print("Almost done, checklist")
  36. print(" - Edit the %s/%s.c to add the instrumentation" % (monitor.name, monitor.name))
  37. print(" - Edit include/trace/events/rv.h to add the tracepoint entry")
  38. print(" - Move it to the kernel's monitor directory")
  39. print(" - Edit kernel/trace/rv/Makefile")
  40. print(" - Edit kernel/trace/rv/Kconfig")