![]() |
QPanda3
Supported by OriginQ
|
Represents the program data needed to analyse it. 更多...
Public 成员函数 | |
| __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 属性 | |
| int | max_index = 0 |
| ty.Dict[str, int] | indices = dict() |
| ty.Dict[str, RoutineData] | routines_data = dict() |
| int | total_time_nanoseconds = total_time_nanoseconds |
| str | entry_point = entry_point |
| bool | register_base_subroutine_calls = register_base_subroutine_calls |
Protected 成员函数 | |
| None | _add_subroutine_no_index (self, str subroutine_name) |
| Add a subroutine to the program, without adding it to the internal index. | |
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
| pyqpanda3.profiling.data.ProgramData.__init__ | ( | self, | |
| int | total_time_nanoseconds, | ||
| str | entry_point = "<spontaneous>", | ||
| bool | register_base_subroutine_calls = True ) |
| str pyqpanda3.profiling.data.ProgramData.__repr__ | ( | self | ) |
|
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.
| 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.
| 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.
| 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.
| 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.
| ty.Dict pyqpanda3.profiling.data.ProgramData.to_dict | ( | self | ) |
| pyqpanda3.profiling.data.ProgramData.entry_point = entry_point |
| pyqpanda3.profiling.data.ProgramData.indices = dict() |
| pyqpanda3.profiling.data.ProgramData.max_index = 0 |
| bool pyqpanda3.profiling.data.ProgramData.register_base_subroutine_calls = register_base_subroutine_calls |
| ty.Dict[str, RoutineData] pyqpanda3.profiling.data.ProgramData.routines_data = dict() |
| pyqpanda3.profiling.data.ProgramData.total_time_nanoseconds = total_time_nanoseconds |