QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.profiling.data.ProgramData Class Reference

Represents the program data needed to analyse it. More...

Public Member Functions

 __init__ (self, int total_time_nanoseconds, str entry_point="<spontaneous>", bool register_base_subroutine_calls=True)
 
None add_subroutine (self, str subroutine_name)
 Add a subroutine to the program.
 
 add_subroutine_call (self, str caller, str called_routine, int number, int self_nano_seconds, int subroutines_nano_seconds)
 Add the information about called_routine being called by caller.
 
 add_entry_point_call (self, str called_routine, int number, int self_nano_seconds, int subroutines_nano_seconds)
 Add the information about called_routine being called by the entry point.
 
str __repr__ (self)
 
ty.Dict to_dict (self)
 
None add_base_subroutine_call (self, str caller, str called_routine, int number, int self_nano_seconds, int subroutines_nano_seconds)
 Add the information about called_based_routine being called by caller.
 

Public Attributes

int max_index = 0
 
ty.Dict[str, int] indices = dict()
 
ty.Dict[str, RoutineDataroutines_data = dict()
 
int total_time_nanoseconds = total_time_nanoseconds
 
str entry_point = entry_point
 
bool register_base_subroutine_calls = register_base_subroutine_calls
 

Protected Member Functions

None _add_subroutine_no_index (self, str subroutine_name)
 Add a subroutine to the program, without adding it to the internal index.
 

Detailed Description

Represents the program data needed to analyse it.

Attributes: max_index: maximum index found in indices indices: a dictionary-like structure linking subroutines names with an index. The program entry-point (i.e. a "virtual" routine that has a standard name and that acts as the entry point of the program) is not included in this attribute. routines_data: a dictionary-like structure linking subroutines name with their call data. The program entry-point (i.e. a "virtual" routine that has a standard name and that acts as the entry point of the program) is included in this attribute. total_time_nanoseconds: total execution time of the program in nano-seconds

Constructor & Destructor Documentation

◆ __init__()

pyqpanda3.profiling.data.ProgramData.__init__ ( self,
int total_time_nanoseconds,
str entry_point = "<spontaneous>",
bool register_base_subroutine_calls = True )

Member Function Documentation

◆ __repr__()

str pyqpanda3.profiling.data.ProgramData.__repr__ ( self)

◆ _add_subroutine_no_index()

None pyqpanda3.profiling.data.ProgramData._add_subroutine_no_index ( self,
str subroutine_name )
protected

Add a subroutine to the program, without adding it to the internal index.

This method should only be used internally. It is used to add the entry point routine without messing with the indices stored.

:param subroutine_name: name of the subroutine to register.

◆ add_base_subroutine_call()

None pyqpanda3.profiling.data.ProgramData.add_base_subroutine_call ( self,
str caller,
str called_routine,
int number,
int self_nano_seconds,
int subroutines_nano_seconds )

Add the information about called_based_routine being called by caller.

Whenever a registered base subroutine is called by another registered subroutine, this method should be called in order to update the stored data.

This method should only be called when the called subroutine is a base subroutine.

:param caller: name of the routine calling called_routine. :param called_routine: name of the routine called by caller. :param number: number of times caller calls called_routine. For example if caller is called 3 times and calls in turn called_routine twice, this parameter should be 6 = 3 * 2 = the number of times called_routine has been called from caller. :param self_nano_seconds: total self time spent by the number calls (time spent in subroutines is excluded). :param subroutines_nano_seconds: total time spent in subroutines called by the number calls to called_routine.

◆ add_entry_point_call()

pyqpanda3.profiling.data.ProgramData.add_entry_point_call ( self,
str called_routine,
int number,
int self_nano_seconds,
int subroutines_nano_seconds )

Add the information about called_routine being called by the entry point.

This method should only be called once for the main routine of the program, i.e. the routine that is called when starting the program.

:param called_routine: name of the routine called by caller. :param number: number of times caller calls called_routine. For example if caller is called 3 times and calls in turn called_routine twice, this parameter should be 6 = 3 * 2 = the number of times called_routine has been called from caller. :param self_nano_seconds: total self time spent by the number calls (time spent in subroutines is excluded). :param subroutines_nano_seconds: total time spent in subroutines called by the number calls to called_routine.

◆ add_subroutine()

None pyqpanda3.profiling.data.ProgramData.add_subroutine ( self,
str subroutine_name )

Add a subroutine to the program.

This method should be called for each new subroutine. Calling any other method of the class with a subroutine that has not been added with this method will result in an exception.

:param subroutine_name: name of the subroutine to register.

◆ add_subroutine_call()

pyqpanda3.profiling.data.ProgramData.add_subroutine_call ( self,
str caller,
str called_routine,
int number,
int self_nano_seconds,
int subroutines_nano_seconds )

Add the information about called_routine being called by caller.

Whenever a registered subroutine is called by another registered subroutine, this method should be called in order to update the stored data.

:param caller: name of the routine calling called_routine. :param called_routine: name of the routine called by caller. :param number: number of times caller calls called_routine. For example if caller is called 3 times and calls in turn called_routine twice, this parameter should be 6 = 3 * 2 = the number of times called_routine has been called from caller. :param self_nano_seconds: total self time spent by the number calls (time spent in subroutines is excluded). :param subroutines_nano_seconds: total time spent in subroutines called by the number calls to called_routine.

◆ to_dict()

ty.Dict pyqpanda3.profiling.data.ProgramData.to_dict ( self)

Member Data Documentation

◆ entry_point

pyqpanda3.profiling.data.ProgramData.entry_point = entry_point

◆ indices

pyqpanda3.profiling.data.ProgramData.indices = dict()

◆ max_index

pyqpanda3.profiling.data.ProgramData.max_index = 0

◆ register_base_subroutine_calls

pyqpanda3.profiling.data.ProgramData.register_base_subroutine_calls = register_base_subroutine_calls

◆ routines_data

pyqpanda3.profiling.data.ProgramData.routines_data = dict()

◆ total_time_nanoseconds

pyqpanda3.profiling.data.ProgramData.total_time_nanoseconds = total_time_nanoseconds

The documentation for this class was generated from the following file: