Skip to content

Commit

Permalink
added documentation stub for the profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud committed Feb 9, 2025
1 parent 0ca8e25 commit cff25c9
Showing 1 changed file with 34 additions and 27 deletions.
61 changes: 34 additions & 27 deletions M2/Macaulay2/packages/Macaulay2Doc/debugging.m2
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ doc ///
"dictionaryPath"
///

doc ///
Node
Key
"profile"
profileSummary
(profileSummary, Thing)
(profileSummary, String)
coverageSummary
(coverageSummary, Thing)
(coverageSummary, String)
Headline
profile a computation
Usage
profile f()
profileSummary f
coverageSummary f
Consequences
Item
The hash table @TT "ProfileTable"@ is updated with the profiling measurement data.
Description
Text
Running a computation with the @TT "profile"@ keyword enables the Macaulay2 profiler,
which measures and stores the frequency of particular instructions for aid in
analyzing and optimizing the computation.
Example
profile matrix table(4, 5, (i,j) -> i^j)
Text
Afterwards, running @TT "profileSummary"@ and @TT "coverageSummary"@ produces
easy to read tables summarizing the accumulated data so far in different ways.
Example
profileSummary
coverageSummary
///

document {
Key => "step",
Headline => "step by single lines in the debugger",
Expand Down Expand Up @@ -219,33 +253,6 @@ document {
}


-*
document {
Key => {profile,(profile, Function),(profile, String, Function)},
Headline => "profile a function",
TT "f = profile f", " -- replace a global function ", TT "f", " by a profiled version.",
PARA{},
"The new function is the same as the old one, except that when the new function is run, it will record the number of times it
is called and the total execution time. Use the command ", TO "profileSummary", " to display the data recorded so far.",
EXAMPLE lines ///
R = ZZ/31[x]
f = (x^110+1)*(x^13+1)
time factor f
g = () -> factor f
g = profile g
h = profile("h", () -> factor f)
for i to 10 do (g();h();h())
profileSummary
///}
document {
Key => profileSummary,
Headline => "display profiling data",
TT "profileSummary", " -- a command that will display the data
accumulated by running functions produced with ", TO "profile", "."
}
*-

document {
Key => uncurry,
Headline => "uncurry a function",
Expand Down

0 comments on commit cff25c9

Please sign in to comment.