Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
CodeTools[Profiling][SortBy] - analyze and display profiling data
Calling Sequence
SortBy(proc1, proc2, ..., tab1, tab2, ..., opts)
Parameters
proc1, proc2, ...
-
(optional) procedure
tab1, tab2, ...
(optional) table
opts
(optional) equation(s) of the form option=value where option is one of 'number', 'order', or 'statements'; specify options for the SortBy command
Description
The SortBy() command analyzes the profiling data for all the procedures for which data is available and prints the results.
The SortBy(proc1, proc2, ...) command analyzes the profiling data for the specified procedures and prints the results.
The SortBy(proc1, proc2, ..., tab1, tab2, ...) command analyzes the profiling data for the specified procedures and tables and prints the results.
The opts parameter can contain any of the following equations that specify options for the SortBy command.
'number' = nonnegative integer
Specifies the number of items displayed. The number option can be used to control the maximum number of items displayed. If , the top n elements are selected after the items have been sorted.
'order' = value
Specifies how to sort the table. If order is not specified, then the default is rload.
The optional argument order can be any one of the following:
alpha - sort table alphabetically by function name
ralpha - sort table reverse alphabetically by function name
time - sort table by increasing cpu time usage
rtime - sort table by decreasing cpu time usage
words - sort table by increasing memory usage
rwords - sort table by decreasing memory usage
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
'statements' = true or false
Specifies whether to analyze procedures or statements. If statements=true is specified, then the SortBy function analyzes the statements instead of procedures. All the statements of the procedures are considered.
When displaying statements, the procedure name, statement number, and an abbreviation of the statement are provided with the profiling information.
It is possible that the total number of words used or the total time taken is zero. In this case, the percent times and percent words are always zero, and the total percent time and the total percent words is 100%. If either of these events occur, SortBy prints a warning message.
Examples
a := proc( ) local i; for i to 25 do int( sin(exp(x^i)), x ); end do; end proc:
b := proc( ) local i; for i to 30 do int( tan(exp(x^i)), x ); end do; end proc:
c := proc( ) a(); b(); end proc:
function calls time time% words words% --------------------------------------------------------------------------- c 1 0.000 0.00 12 0.00 b 1 0.842 50.21 4041338 47.71 a 1 0.835 49.79 4429516 52.29 --------------------------------------------------------------------------- total: 3 1.677 100.00 8470866 100.00
function calls time time% words words% --------------------------------------------------------------------------- b 1 0.842 50.21 4041338 47.71 a 1 0.835 49.79 4429516 52.29 c 1 0.000 0.00 12 0.00 --------------------------------------------------------------------------- total: 3 1.677 100.00 8470866 100.00
function calls time time% words words% --------------------------------------------------------------------------- a 1 0.835 49.79 4429516 52.29 b 1 0.842 50.21 4041338 47.71 c 1 0.000 0.00 12 0.00 --------------------------------------------------------------------------- total: 3 1.677 100.00 8470866 100.00
function calls time time% words words% --------------------------------------------------------------------------- a 25 0.835 49.79 4429516 52.29 stat 2) 2 int(sin(exp(x^i)),x) b 30 0.842 50.21 4041338 47.71 stat 2) 2 int(tan(exp(x^i)),x) c 1 0.000 0.00 6 0.00 stat 2) 2 b() b 1 0.000 0.00 0 0.00 stat 1) 1 for i to 30 do a 1 0.000 0.00 0 0.00 stat 1) 1 for i to 25 do c 1 0.000 0.00 6 0.00 stat 1) 1 a(); --------------------------------------------------------------------------- total: 59 1.677 100.00 8470866 100.00
function calls time time% words words% --------------------------------------------------------------------------- a 25 0.835 49.79 4429516 52.29 stat 2) 2 int(sin(exp(x^i)),x) b 30 0.842 50.21 4041338 47.71 stat 2) 2 int(tan(exp(x^i)),x) c 1 0.000 0.00 6 0.00 stat 2) 2 b() --------------------------------------------------------------------------- total: 59 1.677 100.00 8470860 100.00
See Also
CodeTools[Profiling], CodeTools[Profiling][Build], CodeTools[Profiling][GetProfileTable], CodeTools[Profiling][Merge], CodeTools[Profiling][PrintProfiles], CodeTools[Profiling][Profile]
Download Help Document