You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

container.py 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. """The container of metadata used in profiler parser."""
  2. class HWTSContainer:
  3. """
  4. HWTS output container.
  5. Args:
  6. split_list (list): The split list of metadata in HWTS output file.
  7. """
  8. def __init__(self, split_list):
  9. self._op_name = ''
  10. self._duration = None
  11. self._status = split_list[0]
  12. self._task_id = split_list[6]
  13. self._cycle_counter = float(split_list[7])
  14. self._stream_id = split_list[8]
  15. @property
  16. def status(self):
  17. """Get the status of the operator, i.e. Start or End."""
  18. return self._status
  19. @property
  20. def task_id(self):
  21. """Get the task id of the operator."""
  22. return self._task_id
  23. @property
  24. def cycle_counter(self):
  25. """Get the cycle counter."""
  26. return self._cycle_counter
  27. @property
  28. def stream_id(self):
  29. """Get the stream id of the operator."""
  30. return self._stream_id
  31. @property
  32. def op_name(self):
  33. """Get the name of the operator."""
  34. return self._op_name
  35. @op_name.setter
  36. def op_name(self, name):
  37. """Set the name of the operator."""
  38. self._op_name = name
  39. @property
  40. def duration(self):
  41. """Get the duration of the operator execution."""
  42. return self._duration
  43. @duration.setter
  44. def duration(self, value):
  45. """Set the duration of the operator execution."""
  46. self._duration = value
  47. class TimelineContainer:
  48. """
  49. A container of operator computation metadata.
  50. Args:
  51. split_list (list): The split list of metadata in op_compute output file.
  52. """
  53. def __init__(self, split_list):
  54. self._op_name = split_list[0]
  55. self._stream_id = int(split_list[1])
  56. self._start_time = float(split_list[2])
  57. self._duration = float(split_list[3])
  58. @property
  59. def op_name(self):
  60. """Get the name of the operator."""
  61. return self._op_name
  62. @property
  63. def stream_id(self):
  64. """Get the stream id of the operator."""
  65. return self._stream_id
  66. @property
  67. def start_time(self):
  68. """Get the execution start time of the operator."""
  69. return self._start_time
  70. @property
  71. def duration(self):
  72. """Get the duration of the operator execution."""
  73. return self._duration