The exprofile and excallgraph Statements
any valid filename, besides `default`. If `default` is given, Maple reads the input from the standard input. This is useful for piping output from one maple session to another running exprofile or excallgraph.
The exprofile and excallgraph functions are used to display profile information for Maple procedures and libraries.
The filename can be any valid maple output that was generated with kernelopts(profile=true) set. The preferred method for creating the output file is with writeto() and/or appendto(). If `default` is given for the filename, then input is read from the standard input instead. This is useful with certain operating systems that support piping.
Depending on the function being profiled, the generated file can become quite large. Some operating systems support piping and to save disk space one can pipe the standard output of one maple session (generating the profile information with kernelopts(profile=true) to the standard input of a second maple session (running exprofile or callgraph). With UNIX systems, this can be achieved with the following command:
# Unix shell script for generating profile information on functions
( echo "interface(quiet=true); exprofile(default);"
echo "kernelopts(profile=true); read myfunct; myfunct(100);" | maple
) | maple;
Not all operating systems support pipes.
A command-line utility is provided for all platforms for processing of large profile files. See nprofile for more information.
The function exprofile creates a table of information which displays how much time a procedure took to execute, how much memory space it used, and how many times the procedure was called.
The procedure excallgraph is a complement of exprofile. excallgraph displays which calls each procedure made, how many times the procedure made the call, how long each call took to execute, and how much memory was used for each call.
The optional argument, sortflag, may be one of the following:
- sort table alphabetically by name of function
- sort table reverse alphabetically by name of function
- sort table by increasing usage of cpu time
- sort table by decreasing usage of cpu time
- sort table by increasing usage of memory
- sort table by decreasing usage of memory
- sort table by increasing number of calls to each function
- sort table by decreasing number of calls to each function
- sort table by increasing memory^2*time
- sort table by decreasing memory^2*time
If the optional argument, sortflag, is not specified, the default is rload.
exprofile can interpret its own output and excallgraph's output as well. The advantage of this is that when dealing with limited diskspace, you can concatenate exprofile's output with a second run to get the total runtime information for the two sessions in one table--without having to concatenate two large session files and then run exprofile on the result.
excallgraph can use its output for input as well. However, excallgraph cannot use exprofile's output as input.
a:=proc(); b(100); end proc:
if n>0 then c(n-2); end if;
if n>0 then b(n+1); end if;
4 different functions, using 1.210 secs and 750K words
name #calls cpu words
==== ====== === =====
Main_Routine 1 1.110 ( 91.7%) 728757 ( 97.2%)
a 1 0.000 ( 0.0%) 107 ( .0%)
b 99 0.050 ( 4.1%) 10648 ( 1.4%)
c 99 0.050 ( 4.1%) 10404 ( 1.4%)
used by callee
Caller Callee #calls time words
====== ====== ====== ==== =====
++ <start> calls Main_Routine 1, 1.210, 749916
++ Main_Routine calls a 1, .100, 21159
++ a calls b 1, .100, 21052
++ b calls c 99, .100, 20894
++ c calls b 98, .100, 20809
Download Help Document
What kind of issue would you like to report? (Optional)