@@ -967,6 +967,7 @@ class Inspector:
967967 def __init__ (
968968 self ,
969969 etdump_path : Optional [str ] = None ,
970+ etdump_data : Optional [bytes ] = None ,
970971 etrecord : Optional [Union [ETRecord , str ]] = None ,
971972 source_time_scale : TimeScale = TimeScale .NS ,
972973 target_time_scale : TimeScale = TimeScale .MS ,
@@ -980,11 +981,12 @@ def __init__(
980981 enable_module_hierarchy : bool = False ,
981982 ) -> None :
982983 r"""
983- Initialize an `Inspector` instance with the underlying `EventBlock`\ s populated with data from the provided ETDump path
984+ Initialize an `Inspector` instance with the underlying `EventBlock`\ s populated with data from the provided ETDump path or binary,
984985 and optional ETRecord path.
985986
986987 Args:
987- etdump_path: Path to the ETDump file.
988+ etdump_path: Path to the ETDump file. Either this parameter or etdump_data should be provided.
989+ etdump_data: ETDump binary. Either this parameter or etdump_path should be provided.
988990 etrecord: Optional ETRecord object or path to the ETRecord file.
989991 source_time_scale: The time scale of the performance data retrieved from the runtime. The default time hook implentation in the runtime returns NS.
990992 target_time_scale: The target time scale to which the users want their performance data converted to. Defaults to MS.
@@ -1025,8 +1027,13 @@ def __init__(
10251027 else :
10261028 raise TypeError ("Unsupported ETRecord type" )
10271029
1030+ if (etdump_path is None ) == (etdump_data is None ):
1031+ raise ValueError (
1032+ "Expecting exactly one of etdump_path or etdump_data to be specified."
1033+ )
1034+
10281035 # Create EventBlocks from ETDump
1029- etdump = gen_etdump_object (etdump_path = etdump_path )
1036+ etdump = gen_etdump_object (etdump_path = etdump_path , etdump_data = etdump_data )
10301037 if debug_buffer_path is not None :
10311038 with open (debug_buffer_path , "rb" ) as f :
10321039 output_buffer = f .read ()
0 commit comments