Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
The exprofile and excallgraph Statements
Calling Sequence
exprofile(filename, sortflag)
excallgraph(filename, sortflag)
Parameters
filename
-
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.
Description
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 upon 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:
#!/bin/sh
# 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:
alpha
- sort table alphabetically by name of function
ralpha
- sort table reverse alphabetically by name of function
time
- sort table by increasing usage of cpu time
rtime
- sort table by decreasing usage of cpu time
words
- sort table by increasing usage of memory
rwords
- sort table by decreasing usage of memory
calls
- sort table by increasing number of calls to each function
rcalls
- sort table by decreasing number of calls to each function
load
- sort table by increasing memory^2*time
rload
- 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.
Examples
a:=proc(); b(100); end proc:
b:=proc(n); if n>0 then c(n-2); end if; end proc:
c:=proc(n); if n>0 then b(n+1); end if; end proc:
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
See Also
appendto, kernelopts, nprofile, profile, writeto
Download Help Document