getMethodProfileInfo(jdo: JadeDynamicObject input; truncated: Boolean output);
The getMethodProfileInfo method of the Process class retrieves method profiling information for the process specified as the method receiver.
The method receiver can be any current process, including the requesting process itself or a process executing on another node.
The retrieved information is presented as a set of dynamic objects in the children collection of the dynamic object instance specified by the jdo parameter; that is, the information is contained in the collection jdo.children.
The calling process is responsible for creating and deleting the
For details about the properties of the JadeDynamicObject instances in the children collection, see "
Time spent in recursive method calls is correctly accounted for as time spent executing the method.
The truncated parameter indicates if the amount of method profile information to be retrieved exceeded an internal buffer limit so was truncated. If the truncated parameter returns false, all method profiling information is present in the
Truncation occurs when the amount of profiling information to be returned exceeds 1,000 entries.
Truncation occurs only when method profiling information is retrieved for processes running on remote nodes.
The CPU time has a granularity of 10 or 15 milliseconds. This means that the CPU time figures for methods of short duration are subject to inaccuracy due to the large granularity. However, the clock times have a much smaller granularity and are therefore more accurate.
Clock times may fluctuate, depending on other activity on the same machine. The total clock times include time spent waiting; for example, to wait for a Window event, to lock an object, or for a user response to a modal form.
The children collection of the jdo parameter passed to getMethodProfileInfo is purged each time the method is called.
When displaying method profiling results, you can use the qualifiedName method of the corresponding Method instance to obtain the name of a profiled method, and the isKindOf method to determine if the method is an external method or a JADE method.
The removeMethodProfileInfo method can be called to remove profiling information.
If you call the getMethodProfileInfo method on a target process that has terminated, an exception is raised.
The following example shows the use of the getMethodProfileInfo method.
tryProfiling(); vars jdo : JadeDynamicObject; child : JadeDynamicObject; mth : Method; calls : Integer64; clockTime : Integer64; mthType : String; truncated : Boolean; begin create jdo transient; process.profileMethod(JadeScript::updateAnAnimal, true); process.beginMethodProfiling(2); updateAnAnimal; process.endMethodProfiling(); process.getMethodProfileInfo(jdo, truncated); foreach child in jdo.children do mth := child.getPropertyValue("method").Method; calls := child.getPropertyValue("calls").Integer64; clockTime := child.getPropertyValue("clockTimeInMethod").Integer64; if mth.isKindOf(ExternalMethod) then mthType := "EXTERNAL METHOD "; elseif mth.isKindOf(JadeMethod) then mthType := "JADE METHOD "; else mthType := "OTHER METHOD"; endif; write mthType & " " & mth.qualifiedName & " Calls=" & calls.String & " ClockTime=" & clockTime.String; endforeach; process.removeMethodProfileInfo(); epilog jdo.children.purge; delete jdo; end;
The output from the getMethodProfileInfo method shown in the previous example is as follows.
EXTERNAL METHOD Type::getMethod Calls=8 ClockTime=84 EXTERNAL METHOD List::_values Calls=8 ClockTime=30 EXTERNAL METHOD Class::firstInstance Calls=1 ClockTime=570 JADE METHOD JadeScript::updateAnAnimal Calls=1 ClockTime=1793308 EXTERNAL METHOD Dictionary::getAtKey Calls=84 ClockTime=911 EXTERNAL METHOD Schema::getClassByNumber Calls=5 ClockTime=4512 EXTERNAL METHOD ArrayBlock::_loadValues Calls=3 ClockTime=9 EXTERNAL METHOD Btree::_values Calls=143 ClockTime=463 EXTERNAL METHOD SetBlock::_loadValues Calls=5 ClockTime=10 EXTERNAL METHOD DbFile::path Calls=4 ClockTime=24 EXTERNAL METHOD DictBlock::_loadValues Calls=38 ClockTime=76 EXTERNAL METHOD DictBlock::_search Calls=100 ClockTime=187