d.py 1010 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. trace/generated-tracers.dtrace (DTrace only).
  5. """
  6. __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
  7. __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
  8. __license__ = "GPL version 2 or (at your option) any later version"
  9. __maintainer__ = "Stefan Hajnoczi"
  10. __email__ = "stefanha@linux.vnet.ibm.com"
  11. from tracetool import out
  12. def generate(events, backend):
  13. events = [e for e in events
  14. if "disable" not in e.properties]
  15. out('/* This file is autogenerated by tracetool, do not edit. */'
  16. '',
  17. 'provider qemu {')
  18. for e in events:
  19. args = str(e.args)
  20. # DTrace provider syntax expects foo() for empty
  21. # params, not foo(void)
  22. if args == 'void':
  23. args = ''
  24. # Define prototype for probe arguments
  25. out('',
  26. 'probe %(name)s(%(args)s);',
  27. name=e.name,
  28. args=args)
  29. out('',
  30. '};')