deep_profiler/*.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
In query.m, put the various commands in the same sensible order
as the code processing them.
In html_format.m, merge two exported functions together, since
they can't be used separately.
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
deep_profiler/DEEP_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
deep_profiler/*.m:
Replace ( C -> T ; E ) if-then-elses with (if C then T else E ).
Replace calls to error/1 with calls to unexpected/3.
Add some module qualifications where this makes the code easier to read.
Estimated hours taken: 8
Branches: main
Fix some usability problems in the deep profiler.
deep_profiler/exclude.m:
Provide a better, more explicit representation of the contour exclusion
file. This representation allows the application of contour exclusion
even if the contour exclusion file contains some unrecognized module
names. This is useful, because some modules of the Mercury standard
library, such as profiling_builtin and mer_std, are unrecognized.
They are unrecognized because either they export no predicates,
or because deep profiling is turned off for them.
deep_profiler/query.m:
Make a provision for controlling the number of a procedure's callers
displayed at a time.
deep_profiler/create_report.m:
Take advantage of the new capabilities listed above.
deep_profiler/display_report.m:
When listing a procedure's callers, print any warning messages
generated at startup about recognized modules.
When listing a procedure's callers, list the application of contour
exclusion among the links only if contour exclusion is in fact
applicable.
When listing a procedure's callers, allow the user to control how
many callers are shown at a time. Make the default bunch size 20,
instead of previous hardwired (and too small) 5.
Fix some counterintuitive behavior. When clicking on one of the fields
in the header of a table, in all but one of the displayed reports, this
sorts the data being displayed on the selected column. The exception
was top_procs, in which it changed the criterion on which the top_procs
were selected, and thus changed the procedures being displayed as well.
This diff eliminates the exception. The links in the header cells now
do the expected thing, obeying the law of least astonishment. The
criterion for selected what procs are top can still be changed using
the already existing (and previously mostly redundant) links below
the table.
deep_profiler/startup.m:
Look for contour exclusion files not in Deep.data.contour, but in
Deep.contour, since this is more consistent with what we do for other
auxiliary files, like Data.procrep.
Make the reading of the exclusion file and the program representation
file part of the normal startup process, instead of setting their
fields to dummies and filling them in with real values later.
If there is a program representation file, make sure that the names
of the modules in it are not unrecognized by contour exclusion.
Fix a minor old bug: don't count the time spent reading Deep.contour
as part of the propagation pass.
Print meaningful messages (to the log file in /var/tmp) about
any problems in reading Deep.contour files.
deep_profiler/apply_exclusion.m:
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
deep_profiler/profile.m:
deep_profiler/report.m:
Conform to the changes above.
doc/user_guide.texi:
Document contour exclusion, and to make this possible, expand
considerably the documentation of the deep profiler as a whole.
doc/Mmakefile:
Ensure that invocations of latex cannot hang waiting for user input.
Estimated hours taken: 16
Branches: main
Move three deep profiler commands to the new framework: the one that reports
all of a procedure's callers, the one that lists all the modules, and the one
that lists all the procedures in a module.
deep_profiler/report.m:
Add report structures for the three newly handled commands.
Modify the perf_row_data type to allow the representation of rows
in which the self measures are meaningful, but the self_and_desc
measures aren't, since this is true for module summaries.
Remove a redundant field from an existing report structure.
deep_profiler/query.m:
Change the cmd type slightly to (a) make command names more distinct,
(b) make it less error prone by replacing ints with purpose-specific
wrapper types, and (c) to specify whether contour exclusion should be
applied in the proc_callers command. Change (c) is needed because
we contour exclusion alters the report we want to generate for the
proc_callers command, but we don't want to pass the preferences to the
code that computes reports.
deep_profiler/create_report.m:
Add code for computing the new report structures.
Conform to the change to perf_row_data.
deep_profiler/display_report.m:
Add code for displaying the new report structures.
Conform to the change to perf_row_data.
deep_profiler/display.m:
Avoid the need for a number-of-columns field in most table cells
by having separate function symbols for single- and multi-column cells.
Add a mechanism that allows us to avoid artifically nested lists
(horizontal list inside a vertical list).
Add the column classes needed by the newly implemented commands.
deep_profiler/html_format.m:
Conform to the changes in display.m and query.m.
deep_profiler/profile.m:
We used to read in the contour exclusion file just before computing
and displaying a HTML page whose contents required it. We cannot do
this with the report framework (since the predicate that computes
report structures does not take I/O states as arguments), and it is
better to read the contour exclusion file just once anyway. This diff
therefore adds a field to the deep structure for holding the result
of reading in the contour exclusion file (if any).
deep_profiler/startup.m:
Add code to fill in this new field.
Switch to using state variables.
deep_profiler/apply_exclusion.m:
New module. It contains some code that used to be in query.m, but
is now also needed by create_report.m, slightly modified. The
modifications are to add some code that used to be in the callers
of the moved predicates. This code used to be needed only once,
but is now needed twice (since each predicate now has two callers).
The reason why I didn't put all this into the existing exclude.m
is that that would have required profile.m and exclude.m to import
each other.
deep_profiler/exclude.m:
Change the return value to separate the case of a non-existent contour
exclusion file from a file that exists but whose reading yields an
error.
Give variables better names.
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
Conform to the changes in query.m.
deep_profiler/apply_exclusion.m:
New module. It contains some code that used to be in query.m, but
is now also needed by create_report.m, slightly modified. The
modifications are to add some code that used to be in the callers
of the moved predicates. This code used to be needed only once,
but is now needed twice (since each predicate now has two callers).
The reason why I didn't put all this into the existing exclude.m
is that that would have required profile.m and exclude.m to import
each other.
deep_profiler/exclude.m:
Give variables better names.
deep_profiler/measurements.m:
Turn a semidet predicate into a function.
Estimated hours taken: 3
Branches: main
Clean up in unused module imports in the Mercury system detected
by --warn-unused-imports.
analysis/*.m:
browser/*.m:
deep_profiler/*.m:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
profiler/*.m:
slice/*.m:
Remove unused module imports.
Fix some minor departures from our coding standards.
analysis/Mercury.options:
browser/Mercury.options:
deep_profiler/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
profiler/Mercury.options:
slice/Mercury.options:
Set --no-warn-unused-imports for those modules that are used as
packages or otherwise break --warn-unused-imports, e.g. because they
contain predicates with both foreign and Mercury clauses and some of
the imports only depend on the latter.
Estimated hours taken: 16
Branches: main
Include call sequence numbers in the pages generated by the deep profiler
(if the user's preferences ask for this).
NEWS:
Announce the new capability.
deep_profiler/measurements.m:
Standardize on one spelling of call sequence numbers (callseqs).
Add some utility predicates for use in dump.m.
Fix a bug in the calculation of the number of calls: redos enter
procedure invocations, not leave them.
deep_profiler/profile.m:
Fix a bug: the num_callseqs field was in the wrong place.
deep_profiler/html_format.m:
When generating a line of the clique description, include call sequence
number information if requested.
Do likewise when generating other HTML fragments that have to match
the contents of those lines (e.g. the table headers).
Generate the links that allow the users to sort rows by call
sequence numbers.
Generate the links that allow the users to toggle the switches
controlling the display of call sequence number information.
Do not show the toggles relevant to the display of times if times are
not being displayed.
deep_profiler/interface.m:
Extend the preferences to allow requests for call sequence number
information.
Include the display of call sequence numbers in the default set of
preferences. However, include the display of time information in the
default only of the profiling run lasted long enough for this
information to have some hope of being useful.
Rename some function symbols to avoid ambiguities.
deep_profiler/query.m:
Extend the menu to include links for the most expensive
cliques/procedures as measured by call sequence numbers.
Include the links for the most expensive cliques/procedures as
measured by clock ticks in the menu only if the profiling run
lasted long enough for this to be useful.
Print out the total number of call sequence numbers with the other
statistics.
Use call sequence numbers instead of time to decide where the "action"
begins, since this works even for short profiling runs.
deep_profiler/top_procs.m:
Provide the capability of sorting on call sequence numbers.
deep_profiler/dump.m:
Provide the capability to dump out several more fields of the top level
structure (profile.deep), including the cliques, the reverse links and
the propagated measurement information.
deep_profiler/startup.m:
Dump out the cliques, the reverse links and the propagated measurement
information when computed.
deep_profiler/mdprof_cgi.m:
Add an option for setting the hostname in the generated links to
"localhost". This is useful on laptops temporarily disconnected
from the Domain Name System (e.g. my laptop).
Set this option automatically if the name of the file in the initial
query has a ".localhost" suffix added to it.
Add some tracing hooks.
deep_profiler/mdprof_test.m:
Add an option to specify what info to dump during startup.
deep_profiler/mdprof_dump.m:
Switch to using the compiler's method of specifying what to dump,
since this is more maintainable.
deep_profiler/exclude.m:
Rename some function symbols to avoid ambiguities.
deep_profiler/timeout.m:
Add conditionally compiled code to help debug lock management.
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/cliques.m:
deep_profiler/conf.m:
deep_profiler/read_profile.m:
Minor cleanups.
Estimated hours taken: 8
Branches: main
Get rid of a bunch more ambiguities by renaming predicates, mostly
in polymorphism.m, {abstract,build,ordering}_mode_constraints.m, prog_type.m,
and opt_debug.m in the compiler directory and term_io.m, term.m, parser.m,
and string.m in the library.
In some cases, when the library and the compiler defined the same predicate
with the same code, delete the compiler's copy and give it access to the
library's definition by exporting the relevant predicate (in the undocumented
part of the library module's interface).
NEWS:
Mention that the names of some library functions have changed.
library/*.m:
compiler/*.m:
mdbcomp/*.m:
browser/*.m:
Make the changes mentioned above, and conform to them.
test/general/string_test.m:
test/hard_coded/string_strip.m:
test/hard_coded/string_strip.exp:
Conform to the above changes.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 0.5
Branches: main
profiler/*.m:
deep_profiler/*.m:
compiler/*.m:
Replace __ with . as the module qualifier everywhere in all the modules
of the profiler and deep profiler and in some modules of the compiler.
Estimated hours taken: 1.5
Branches: main
Convert the rest of the deep profiler to four-space indentation.
There are no changes to any algorithms (other than introducing state
variables in a few spots).
Remove an old bug workaround.
deep_profiler/*.m:
Convert to four-space indentation where that has not already
been done.
Fix some bad line breaks.
Use state variables in a few places.
Reposition comments according to our current coding standard.
deep_profiler/Mercury.options:
Remove some old bug workarounds.
Estimated hours taken: 1
Branches: main
Cleanup the deep profiler.
There are no changes to any algorithms.
deep_profiler/*.m:
Switch to state variable notation throughout. Rearrange
the order of some procedure arguments to facilitate this.
Remove some unnecessary module imports.
Reformat comments according to our current coding standard.
Update comments that refer to modules that no longer exist.
Estimated hours taken: 1
Branches: main
profiler/*.m:
deep_profiler/*.m:
Import only one module per line. Misc other updates to bring these
modules closer to being up to date with our current style guidelines.
Estimated hours taken: 0.5
Branches: main
deep_profiler/*.m:
Switch to using state variable notation where this is beneficial.
There are no changes in algorithms.
Estimated hours taken: 1.5
Branches: main
deep_profiler/exclude.m:
Simplify and document this module.
deep_profiler/query.m:
Minor update to conform to a simplification in the interface of
exclude.m.
Estimated hours taken: 80
Branches: main
Major enhancements of the deep profiler. The most important ones are:
- The addition of several new classes of preferences, including: the use of
colour, boxing, sorting, summarizing of higher order call sites, and time
formats.
- Making preferences persistent across different queries, so that once a
preference is set, it "sticks" until the user changes it. Previously,
preferences stuck during query sequences of the same command type.
- Several new command types:
- listing all the modules of the program
- listing all the procedures in a module
- listing all the callers of a procedure,
grouped by calling call site, procedure, module, or clique,
and filtering out certain classes of ancestors
- jumping into the call graph close to the action
- restarting the server (useful when the data file changes)
- New optional columns showing time per call, allocations per call and words
allocated per call.
- Can now display memory consumption in bytes as well as words.
- More robustness in the face of external events, e.g. machine shutdowns.
- Fix a bug reported by Tom in the summaries of procedures that make higher
order calls.
The new functionality required adding some fields to ProcStatic structures;
as a result, compilers and runtime systems that have this change are
incompatible with compilers and runtime systems before this change in deep
profiling grades. (They of course remain compatible in other grades.)
compiler/deep_profiling.m:
compiler/layout.m:
compiler/layout_out.m:
Add two new fields to ProcStatic structures, one giving the line number
of procedure's context and one stating whether the procedure is
exported from its module.
compiler/layout.m:
Be consistent about filename vs file_name in field names.
compiler/*.m:
Minor changes to handle the new fields.
deep_profiler/interface.m:
Define new command types, modify some of the parameters of existing
ones, and delete obsolete ones. Define the types and predicates used
by the new system of preferences, Update the predicates for recognizing
and generating queries accordingly.
Make the order of declarations and definitions more consistent.
deep_profiler/split.m:
Complete rewrite of the only predicate of this module. The old split
predicate deleted any empty substrings resulting from the breakup of
the original string. The new one preserves them, because they are
needed by the new encoding scheme used in interface.m.
deep_profiler/query.m:
New module, containing code dealing with the computational issues of
queries. Some of its code is old (from server.m), much of it is new.
deep_profiler/html_format.m:
New module, containing code dealing with HTML formatting. Some of its
code is old (from server.m), much of it is new.
deep_profiler/top_procs.m:
New module, containing code dealing with issues involving sorting
by various criteria. Some of its code is old (from server.m),
much of it is new.
deep_profiler/exclude.m:
New module to handle contour exclusion. This means that when listing
the callers of a procedure, we display the nearest parent that is *not*
excluded by virtue of being in a given module. The set of modules so
excluded forms a contour drawn through the program.
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
Minor changes to adapt to the new system of preferences.
deep_profiler/array_util.m:
Add a mode to foldl2.
deep_profiler/io_combinator.m:
Add predicates for reading in sequences of ten things.
deep_profiler/measurements.m:
Add a function needed by new code.
deep_profiler/timeout.m:
Make the profiler robust in the face of signals.
deep_profiler/canonical.m:
Some more work towards working canonicalization; not there yet.
Move some procedures to profile.m, since other modules also need them
now.
deep_profiler/profile.m:
Add the new fields to ProcStatic structures.
Record the word size.
Record more information about procedures whose activation counters are
ever zeroed, in order to allow query.m to avoid giving misleading
information in cases where a procedure calls itself through a higher
order call site.
Record information about the modules of the program.
Add a bunch of lookup predicates, some moved from canonical.m.
deep_profiler/call_graph.m:
Minor changes to conform to changes in profile.m.
deep_profiler/startup.m:
Fill in the new parts of the profile data structure.
deep_profiler/read_profile.m:
Read the new fields in ProcStatic structures.
Read in the id of the root node as a fixed part of the header,
not as a node.
Read in the word size.
Make it easier to find all the debugging output sites.
Record, for each call site which can call more than one procedure,
whether this causes the caller's ProcStatic structure's activation
count to be zeroed.
runtime/mercury_deep_profiling.h:
Add the new fields to ProcStatic structures.
runtime/mercury_deep_profiling.c:
Write out the new fields to ProcStatic structures.
Write out the id of the root node as a fixed part of the header,
not as a node.
Write out the word size.
Remove incorrect L suffixes on constants.
Record that the artificial procedure "parent of main" is called once,
not zero times, to avoid division by zero when computing per-call
statistics.
runtime/mercury_deep_profiling_hand.h:
Add the new fields to the macros for creating ProcStatic structures.
runtime/mercury_ho_call.c:
library/array.m:
library/builtin.m:
library/exception.m:
library/std_util.m:
Add the new fields to the invocations of those macros.