Commit Graph

33 Commits

Author SHA1 Message Date
Zoltan Somogyi
c02eb5163e Carve io.{call_system,environment}.m out of io.m.
library/io.call_system.m:
    Move the code in the "system access predicates" section of io.m
    to this new module.

library/io.environment.m:
    Move the predicates dealing with environment variables in io.m
    to this new module.

library/io.m:
    Delete the code moved to the new modules.

    Leave behind in io.m "forwarding predicates", predicates that do nothing
    except call the moved predicates in the new modules, to provide backward
    compatibility. But do mark the forwarding predicates as obsolete,
    to tell people to update their (at their leisure, since the obsoleteness
    warning can be turned off).

    Also leave behind in io.m the definitions of the types used
    by some parameters of some of the moved predicates.

library/MODULES_DOC:
    List the new modules among the documented modules.

library/library.m:
    List the new modules, including io.file.m (added in a previous change)
    among the documented standard library modules.

NEWS:
    Announce the changes.

browser/browse.m:
browser/interactive_query.m:
compiler/fact_table.m:
compiler/handle_options.m:
compiler/make.module_target.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/optimize.m:
compiler/options_file.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
library/io.file.m:
mdbcomp/trace_counts.m:
ssdb/ssdb.m:
tests/general/environment.m:
tests/hard_coded/closeable_channel_test.m:
tests/hard_coded/setenv.m:
tests/hard_coded/system_sort.m:
    Call the moved predicates directly in their new modules,
    not indirectly through io.m.
2022-03-08 09:38:27 +11:00
Zoltan Somogyi
3c07fc2121 Use explicit streams in deep_profiler/*.m.
deep_profiler/analysis_utils.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/autopar_reports.m:
deep_profiler/autopar_search_callgraph.m:
deep_profiler/autopar_search_goals.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/cliques.m:
deep_profiler/coverage.m:
deep_profiler/dump.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/profile.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/startup.m:
deep_profiler/var_use_analysis.m:
    Replace implicit streams with explicit streams.

    In some places, simplify some code, often using constructs such as
    string.format that either did not exist or were too expensive to use
    when the original code was written.

    Consistenly use the spelling StdErr over Stderr.

    In mdbprof_dump.m, put filename and reason-for-failing-to-open-that-file
    in the right order in an error message.

deep_profiler/DEEP_FLAGS.in:
    Turn on --warn-implicit-stream-calls for the entire deep_profiler
    directory.

mdbcomp/program_representation.m:
mdbcomp/trace_counts.m:
    Replace implicit streams with explicit streams. These are the two mdbcomp
    modules that (a) used to use implicit streams, and (2) are used by the
    deep profiler.

mdbcomp/Mercury.options:
    Turn on --warn-implicit-stream-calls for these two modules.

slice/mcov.m:
slice/mtc_union.m:
    Conform to the changes in mdbcomp.
2021-03-06 18:30:50 +11:00
Zoltan Somogyi
409cbcb6a3 Unify getopt.m and getopt_io.m ...
... using an approach proposed by Peter, with an extra twist from Julien.

Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.

The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.

Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.

library/getopt.m:
library/getopt_io.m:
    Make the changes described above.

library/Mmakefile:
    Instead of building both getopt_io.m and getopt.m from getopt_template,
    build getopt.m from getopt_io.m.

tools/bootcheck:
    Delete references to getopt_template.

compiler/typecheck_errors.m:
    When a type error involves one of the getopt/getopt_io predicates
    whose interfaces are changed by this diff, tell the user about
    how these changes could have caused the error, and thus what the
    probable fix is.

compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
    Use the updated getopt interface.

compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
    Replace references to getopt_io.m with references to getopt.m.

tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
    New test cases for the extra help

tests/invalid/Mmakefile:
    Enable the new test cases.
2020-10-09 19:30:46 +11:00
Zoltan Somogyi
9095985aa8 Fix more warnings from --warn-inconsistent-pred-order-clauses.
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.
2017-04-30 15:48:13 +10:00
Zoltan Somogyi
270170416d Bring the style of deep_profiler/* up-to-date.
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.
2015-07-15 15:30:22 +02:00
Zoltan Somogyi
aa60524d71 Eliminate redundant output from tools/bootcheck.
runtime/mercury_goto.h:
    Cast the "const MR_LabelLayout *" argument of calls
    MR_insert_internal_label, since without this cast, we get C compiler
    warnings in the bootcheck output when the caller passes a
    "const MR_LabelLayoutNoVarInfo *" for this argument.

tests/hard_coded/Mmakefile:
    Redirect the output of the weak_ptr test to a file instead of including it
    in the output of bootcheck itself. The output is maybe be needed in a rare
    cases, but is not needed most of the time.

tests/hard_coded/weak_ptr.m:
    Fix white space.

tests/feedback/Mmakefile:
    Specify verbosity level 0 when invoking mdprof_create_feedback.

deep_profiling/mdprof_create_feedback.m:
    Record the verbosity level when we postprocess the options. We used to
    record it *after* creating the feedback file, and before printing the
    messages gathered during this process. This *mostly* worked, but some
    messages are printed using trace goals *during* the creation of the
    feedback file, and these ignored the specified verbosity level.

deep_profiling/query.m:
    Remove the IO arguments from exec and try_exec, since they do not use them.

deep_profiling/var_use_analysis.m:
    Eliminate some ambiguities by renaming two predicates.

    Simplify some overly complex code.

deep_profiling/autopar_costs.m:
deep_profiling/create_report.m:
deep_profiling/mdprof_cgi.m:
deep_profiling/mdprof_test.m:
    Conform to the above changes.

mdbcomp/feedback.m:
    Fix a typo.
2015-01-22 02:18:08 +11:00
Paul Bone
8f6bbc437c Print version information more succinctly
In the Mercury compiler itself, and in a number of tools we print a version
string on one line,

    $ mmc --version
    Mercury Compiler, version rotd-2013-10-01, configured for x86_64-unknown-linux-gnu
    Copyright (C) 1993-2013 The University of Melbourne

When the version number is sufficiently long, such as for an ROTD release, this
will wrap on 80 column terminals.  This change splits these strings into two
parts: the version and the architecture string.  These can then either be
printed more succinctly on one line

    $ mmc --version
    Mercury Compiler, version rotd-2013-10-01, on x86_64-unknown-linux-gnu
    Copyright (C) 1993-2013 The University of Melbourne

Or when written to a file such as the .c files that mmc generates, can be
written out onto two lines:

    XXX

library/library.m:
    Make the version predicate return two values, one for the version number
    and the other for the architecture name.  This makes it easier to format
    the version information in the various places it is used.

compiler/handle_options.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
    Format this as shown above for the Mercury compiler and other tools.

compiler/c_util.m:
compiler/elds_to_erlang.m:
compiler/export.m:
compiler/fact_table.m:
compiler/llds_out_file.m:
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/write_deps_file.m:
    Format version information on two lines when it is used in the
    compiler's various output files.
2014-03-10 19:01:22 +11:00
Zoltan Somogyi
2d0bfc0674 The algorithm that decides whether the order independent state update
Estimated hours taken: 120
Branches: main

The algorithm that decides whether the order independent state update
transformation is applicable in a given module needs access to the list
of oisu pragmas in that module, and to information about the types
of variables in the procedures named in those pragmas. This diff
puts this information in Deep.procrep files, to make them available
to the autoparallelization feedback program, to which that algorithm
will later be added.

Compilers that have this diff will generate Deep.procrep files in a new,
slightly different format, but the deep profiler will be able to read
Deep.procrep files not just in the new format, but in the old format as well.

runtime/mercury_stack_layout.h:
	Add to module layout structures the fields holding the new information
	we want to put into Deep.procrep files. This means three things:

	- a bytecode array in module layout structures encoding the list
	  of oisu pragmas in the module;
	- additions to the bytecode arrays in procedure layout structures
	  mapping the procedure's variables to their types; and
	- a bytecode array containing the encoded versions of those types
	  themselves in the module layout structure. This allows us to
	  represent each type used in the module just once.

	Since there is now information in module layout structures that
	is needed only for deep profiling, as well as information that is
	needed only for debugging, the old arrangement that split a module's
	information between two structures, MR_ModuleLayout (debug specific
	info) and MR_ModuleCommonLayout (info used by both debugging and
	profiling), is no longer approriate. We could add a third structure
	containing profiling-specific info, but it is simpler to move
	all the info into just one structure, some of whose fields
	may not be used. This wastes only a few words of memory per module,
	but allows the runtime system to avoid unnecessary indirections.

runtime/mercury_types.h:
	Remove the type synonym for the deleted type.

runtime/mercury_grade.h:
	The change in mercury_stack_layout.h destroys binary compatibility
	with previous versions of Mercury for debug and deep profiling grades,
	so bump their grade-component-specific version numbers.

runtime/mercury_deep_profiling.c:
	Write out the information in the new fields in module layout
	structures, if they are filled in.

	Since this changes the format of the Deep.procrep file, bump
	its version number.

runtime/mercury_deep_profiling.h:
runtime/mercury_stack_layout.c:
	Conform to the change to mercury_stack_layout.h.

mdbcomp/program_representation.m:
	Add to module representations information about the oisu pragmas
	defined in that module, and the type table of the module.
	Optionally add to procedure representations a map mapping
	the variables of the procedure to their types.

	Rename the old var_table type to be the var_name_table type,
	since it contains just names. Make the var to type map separate,
	since it will be there only for selected procedures.

	Modify the predicates reading in module and procedure representations
	to allow them to read in the new representation, while still accepting
	the old one. Use the version number in the Deep.procrep file to decide
	which format to expect.

mdbcomp/rtti_access.m:
	Add functions to encode the data representations that this module
	also decodes.

	Conform to the changes above.

mdbcomp/feedback.automatic_parallelism.m:
	Conform the changes above.

mdbcomp/prim_data.m:
	Fix layout.

compiler/layout.m:
	Update the compiler's representation of layout structures
	to conform to the change to runtime/mercury_stack_layout.h.

compiler/layout_out.m:
	Output the new parts of module layout structures.

compiler/opt_debug.m:
	Allow the debugging of code referring to the new parts of
	module layout structures.

compiler/llds_out_file.m:
	Conform to the move to a single module layout structure.

compiler/prog_rep_tables.m:
	This new module provided mechanisms for building the string table
	and the type table components of module layouts. The string table
	part is old (it is moved here from stack_layout.m); the type table
	part is new.

	Putting this code in a module of its own allows us to remove
	a circular dependency between prog_rep.m and stack_layout.m;
	instead, both now just depend on prog_rep_tables.m.

compiler/ll_backend.m:
	Add the new module.

compiler/notes/compiler_design.html:
	Describe the new module.

compiler/prog_rep.m:
	When generating the representation of a module for deep profiling,
	include the information needed by the order independent state update
	analysis: the list of oisu pragmas in the module, if any, and
	information about the types of variables in selected procedures.

	To avoid having these additions increasing the size of the bytecode
	representation too much, convert some fixed 32 bit numbers in the
	bytecode to use variable sized numbers, which will usually be 8 or 16
	bits.

	Do not use predicates from bytecode_gen.m to encode numbers,
	since there is nothing keeping these in sync with the code that
	reads them in mdbcomp/program_representation.m. Instead, use
	new predicates in program_representation.m itself.

compiler/stack_layout.m:
	Generate the new parts of module layouts.

	Remove the code moved to prog_rep_tables.m.

compiler/continuation_info.m:
compiler/proc_gen.m:
	Make some more information available to stack_layout.m.

compiler/prog_data.m:
	Fix some formatting.

compiler/introduce_parallelism.m:
	Conform to the renaming of the var_table type.

compiler/follow_code.m:
	Fix the bug that used to cause the failure of the
	hard_coded/mode_check_clauses test case in deep profiling grades.

deep_profiler/program_representation_utils.m:
	Output the new parts of module and procedure representations,
	to allow the correctness of this change to be tested.

deep_profiler/mdprof_create_feedback.m:
	If we cannot read the Deep.procrep file, print a single error message
	and exit, instead of continuing with an analysis that will generate
	a whole bunch of error messages, one for each attempt to access
	a procedure's representation.

deep_profiler/mdprof_procrep.m:
	Give this program an option that specifies what file it is to
	look at; do not hardwire in "Deep.procrep" in the current directory.

deep_profiler/report.m:
	Add a report type that just prints the representation of a module.
	It returns the same information as mdprof_procrep, but from within
	the deep profiler, which can be more convenient.

deep_profiler/create_report.m:
deep_profiler/display_report.m:
	Respectively create and display the new report type.

deep_profiler/query.m:
	Recognize a query asking for the new report type.

deep_profiler/autopar_calc_overlap.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/autopar_reports.m:
deep_profiler/autopar_search_callgraph.m:
deep_profiler/autopar_search_goals.m:
deep_profiler/autopar_types.m:
deep_profiler/branch_and_bound.m:
deep_profiler/coverage.m:
deep_profiler/display.m:
deep_profiler/html_format.m:
deep_profiler/mdprof_test.m:
deep_profiler/measurements.m:
deep_profiler/query.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/top_procs.m:
deep_profiler/top_procs.m:
	Conform to the changes above.

	Fix layout.

tests/debugger/declarative/dependency.exp2:
	Add this file as a possible expected output. It contains the new
	field added to module representations.
2012-10-24 04:59:55 +00:00
Zoltan Somogyi
59b0edacbe New module for calculating the overlap between the conjuncts of a
Estimated hours taken: 2

deep_profiler/autopar_calc_overlap.m:
	New module for calculating the overlap between the conjuncts of a
	parallelised conjunction. Its contents are taken from the old
	autopar_search_callgraph.m.

deep_profiler/autopar_costs.m:
	New module for calculating the costs of goals. Its contents
	are taken from the old autopar_search_callgraph.m.

deep_profiler/autopar_reports.m:
	New module for creating reports. Its contents are taken from
	the old autopar_search_callgraph.m.

deep_profiler/autopar_search_goals.m:
	New module for searching goals for parallelizable conjunctions.
	Its contents are taken from the old autopar_search_callgraph.m.

deep_profiler/autopar_search_callgraph.m:
	Remove the code moved to other modules.

deep_profiler/mdprof_fb.automatic_parallelism.m:
	Add the new modules.

deep_profiler/*.m:
	Remove unnecessary imports.
	Fix copyright years on the new modules.

browser/*.m:
compiler/*.m:
mdbcomp/*.m:
	Remove unnecessary imports.

library/Mercury.options:
	Make it possible to compile a whole workspace with
	--warn-unused-imports by turning that option off for type_desc.m
	(which has a necessary import that --warn-unused-imports thinks
	is unused).
2011-01-27 08:03:54 +00:00
Zoltan Somogyi
8a28e40c9b Add the predicates sorry, unexpected and expect to library/error.m.
Estimated hours taken: 2
Branches: main

Add the predicates sorry, unexpected and expect to library/error.m.

compiler/compiler_util.m:
library/error.m:
	Move the predicates sorry, unexpected and expect from compiler_util
	to error.

	Put the predicates in error.m into the same order as their
	declarations.

compiler/*.m:
	Change imports as needed.

compiler/lp.m:
compiler/lp_rational.m:
	Change imports as needed, and some minor cleanups.

deep_profiler/*.m:
	Switch to using the new library predicates, instead of calling error
	directly. Some other minor cleanups.

NEWS:
	Mention the new predicates in the standard library.
2010-12-15 06:30:36 +00:00
Paul Bone
cb03062118 Fix a coverage propagation bug.
Coverage propagation only relies on coverage points for code that it cannot
infer coverage from call site port counts alone.  However since using dynamic
coverage points I had not updated this code to also use port counts from
dynamic call sites rather than static call sites.

This patch fixes this by using port counts from dynamic call sites when doing
coverage propagation with dynamic coverage points.

deep_profiler/coverage.m:
    Introduce a new type calls_and_exits which stores the number of calls and
    exits for a given call site.

    procrep_annotate_with_coverage now uses calls_and_exits rather than
    own_prof_info structures to represent call sites.

deep_profiler/create_report.m:
    Use port counts from dynamic call sites when creating dynamic coverage
    reports.

deep_profiler/mdprof_test.m:
    Add functionality that allows us to test creation of dynamic call site
2010-09-23 04:33:19 +00:00
Paul Bone
067934f008 Start using the new dynamic coverage information in the deep profiler.
This patch separates the coverage annotated procedure report into two
reports, one with dynamic coverage data and one with static coverage data.
This restores the functionality of the static coverage report since my last
change, and provides access to the dynamic report via new controls only
visible to developers.

deep_profiler/query.m:
    In the cmd data-type:

        Rename deep_cmd_procrep_coverage constructor to
        deep_cmd_static_procrep_coverage.

        Add deep_cmd_procrep_dynamic_coverage.

    In the preferences data-type:

        Add a new field pref_developer_mode which indicates if developer-only
        options are visible or not.

    Add code to parse and print the new command and preference option.

deep_profiler/create_report.m:
    Specialise create_procrep_coverage_report/3 into
    create_{static,dynamic}_coverage_report/4.

    Created a new exported function deep_get_maybe_procrep.  This is useful for
    getting a procedure representation from the deep data-structure in one
    step.

deep_profiler/display.m:
    Add a new display item, display_developer.  This wraps another display
    item but is only displayed when developer mode is active.

deep_profiler/display_report.m:
    Add a control to the main screen that enables or disabled developer mode.
    This control has been placed at the bottom of the screen so that it's out
    of the way.

    Put the developer controls on the main screen into their own list (there's
    only one at the moment).

    For now the coverage-annotated procedure representation link on a (static)
    procedure's page is not a developer option.  Should this be a developer
    option?

    Added a link to the dynamic coverage annotated procedure representation
    report from the dump proc dynamic report.

    Added a link to the clique dump report from the clique report, the dynamic
    coverage annotated procedure representation report can be accessed
    transitively through this link.

    Added a link the variable use analysis report and proc static report to the
    procedure report and static coverage annotated procedure representation
    report.

deep_profiler/html_format.m:
    Support the new display_developer item.

    Refactor the item_to_html code for lists.

deep_profiler/profile.m:
    Include a new field in the deep data-structure for storing coverage data
    that is indexed by a proc_static_ptr.  When dynamic coverage information is
    used this field is populated by adding per ProcDynamic data for each static
    procedure.

deep_profiler/startup.m:
    Fill in the per ProcStatic coverage data when the deep profiler starts up.

deep_profiler/measurements.m:
    Create a new data type static_coverage_info which represents per ProcStatic
    coverage information.

    Include functions that are used when calculating per ProcStatic coverage
    information from per ProcDynamic coverage information.

deep_profiler/mdprof_cgi.m:
    Remove rarely used command line option rather making it conform to changes
    in query.m.

deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
    Conform to changes in query.m.

deep_profiler/mdprof_test.m:
deep_profiler/mdprof_fb.automatic_parallelism.m:
deep_profiler/recursion_patterns.m:
deep_profiler/var_use_analysis.m:
    Conform to changes in create_report.

deep_profiler/array_util.m:
    Add a new predicate, array_foldl3_from_1 to support propagation of coverage
    information from proc dynamics to proc statics.
2010-09-22 12:56:54 +00:00
Paul Bone
699663e5e2 Deep profiler enhancements.
Create two new deep profiler reports: the first calculates the costs of
recursive calls at any depth of recursion for a clique.  The second summarises
the types of recursion seen in a program.

deep_profiler/query.m:
    Introduce new cmd types.

    Conform to changes of the cmd type.

    Add a new preference: the maximum number of proc statics to display for
    each recursion type.

    Memoize the creation of the recursion types histogram report as it can take
    a while to generate, 39 minutes on a Core 4 when generating a report for
    the compiler it's self.

deep_profiler/report.m:
    Define the new report structures.

deep_profiler/create_report.m:
    Handle creation of the new reports.

    Export describe_proc and own_and_inherit_to_perf_row_data so that the
    recursion_patterns module can use them.

    Write a find_clique_first_and_other_procs predicate to find the first
    procedure in a clique, it also returns a list of the remaining procedures.
    This is exported so that recursion_patterns can use it but it belongs here
    as it is generally used for creating reports.

    Refactor the retrieval of the progrep data from the deep data structure.

    Make a note about a change that could be made to speed up large analyses.

deep_profiler/profile.m:
    Refactor the retrieval of the progrep data from the deep data structure.

deep_profiler/display_report.m:
    Handle translation of the new reports to the display data type.

    Link to this report from clique reports, and to clique reports from the new
    clique recursion costs report.

    Refactor the code that constructs the lists of related reports.

deep_profiler/recursion_patterns.m:
    Create a new module to contain the recursion pattern analysis code.

deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
    Conform to changes in query.m

deep_profiler/mdprof_fb.automatic_parallelism.m:
    Remove add_call_site_to_map it is a duplicate of add_call_site_report_to_map.

    Move add_call_site_report_to_map and proc_label_from_proc_desc to report.m

deep_profiler/measurement_units.m:
    Include functions to manipulate probabilities of conjoint and disjoint events.

    Allow percentages to be greater than 100% and less than 0% this can occur
    legitimately in some cases.

deep_profiler/measurements.m:
deep_profiler/var_use_analysis.m:
    Move weighted_average/3 from var_use_analysis.m to measurements.m where it
    can be used globally.

deep_profiler/mdprof_test.m:
    Modify the mdprof_test program so that it can generate the recursion types
    histogram report, this is useful for profiling and debugging.
2010-08-26 06:29:27 +00:00
Zoltan Somogyi
c91f385afc Put the program representation inside the deep profiler's main data structure,
Estimated hours taken: 1
Branches: main

Put the program representation inside the deep profiler's main data structure,
since this simplifies things. (We already handled the contents of the
exclusion threshold file this way.)

deep_profiler/profile.m:
	Change the data structure's type definition as above.

deep_profiler/create_report.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/query.m:
	Conform to the change above.

deep_profiler/startup.m:
	Conform to the change above.

	Rename a predicate to avoid ambiguity.
2008-10-03 07:39:04 +00:00
Paul Bone
8658fc1cc9 Introduce a new report type in the deep profiler tools.
Branches: main

Introduce a new report type in the deep profiler tools.  The procedure
representation coverage report displays a representation of the procedure,
annotated with determinism and coverage information.  This allows a programmer
to view the most frequently taken execution paths through a procedure,

This report is available when the program has been compiled for coverage
profiling, and when a Deep.procrep file is available.

deep_profiler/report.m:
	The coverage profiling dump report is now a coverage_information annotated
	procedure representation structure.
    Add a goal_path field to the call_site_perf type.

deep_profiler/program_representation_utils.m:
    Create procrep_annotate_with_coverage/5 predicate to annotate a procedure
    representation structure with coverage information.
    Use type classes to convert goal annotations to strings used with the
    procedure representation structures.

deep_profiler/create_report.m:
    Call procrep_annotate_with_coverage to build the coverage-annotated
    procedure representation report.

deep_profiler/display_report.m:
    Conform to changes in deep_profiler/report.m
    Implement a goal_annotation typeclass for coverage_info for displaying the
    coverage information.
	Display a link to the procrep_coverage report from the Procedure report.

deep_profiler/mdprof_cgi.m:
	Add the ability to generate a procrep_coverage report to the command line
	interface for debugging.

deep_profiler/mdprof_test.m:
	Add the ability to generate all the procrep coverage reports possible from
	a Deep.data file.
	Make compressing the result (using a separate gzip process) optional,
	since it can slow down the test for a negligible gain.
2008-09-17 03:26:29 +00:00
Paul Bone
cfe35c9cb7 Modify the deep profiling tools, in particular mdprof_cgi, to make use of
Estimated Hours Taken: 10
Branches: main

Modify the deep profiling tools, in particular mdprof_cgi, to make use of
program representation files, and begin implementing the procrep coverage
report.

The mdprof coverage report is incomplete, however it is convenient to post
this for review now.  Currently it can display a pretty-printed procrep
structure without coverage annotations.

mdbcomp/program_representation.m:
	Modified program representation data structures to allow goals to be
	annotated with another type.

deep_profiler/query.m:
	Create new deep profiling command, to display a coverage-annotated
	procedure representation.
	Support use of program representation information by new-style report
	generating code.
	Centralised command parsing to code within this module.
	Created constants for strings shared between cmd_to_string and
	string_to_maybe_cmd.

deep_profiler/report.m:
	Add new report, report_procrep_coverage_dump.
	Modified the proc_static dump report to include the number of coverage
	points in the proc_static.

deep_profiler/create_report.m:
	create_report now accepts an optional program representation structure,
	making it possible for report generation code to use the program
	representation structure.
	Support the new procrep coverage report, which is incomplete.
	Modify the proc static dump report, to display the number of coverage
	points within a proc_static structure.

deep_profiler/display.m:
	Introduce display_verbatim, a new display element that is able to display
	verbatim text, such as source code.

deep_profiler/display_report.m:
	Add support for displaying the new mdbcomp_coverage report.
	Modify the proc static dump display to show the number of coverage points,
	conforming to a change in report.m

deep_profiler/html_format.m:
	Support the display_verbatim element.
	Use query_to_string from query.m to create the query part of a URL.
	Conform to changes in deep_profiler/query.m

deep_profiler/startup.m:
	Modify read_and_startup to also read the program representation data if
	available.

deep_profiler/mdprof_cgi.m:
	Use string_to_maybe_query from query.m to parse a query string.
	Renamed some variables.
	Modified command-loop to pass program representation between commands.

deep_profiler/program_representation_utils.m:
	A new module to hold utilities from working with program representation
	data.
	Pretty printing code from mdprof_procrep has been moved here and modified
	to output a cord of strings rather than write to standard output.

deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
	Conform to changes in query.m

deep_profiler/mdprof_procrep.m:
	Move proc_rep pretty-printing code to program_representation_utils.m

browser/declarative_tree.m:
	Conform to changes in mdbcomp/program_representation.m
2008-08-28 10:26:15 +00:00
Zoltan Somogyi
f637aa2458 Move three deep profiler commands to the new framework: the one that reports
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.
2008-08-25 07:19:39 +00:00
Zoltan Somogyi
03035ad2e6 Convert Paul's new code to use cords of strings to represent HTML.
Estimated hours taken: 6
Branches: main

Convert Paul's new code to use cords of strings to represent HTML.

deep_profiler/html_format.m:
	Convert to using cords. Restructure the code in a couple of places
	to always put start and end tags around HTML fragments together.

	Fix a missing "=" in a tag.

deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/read_profile.m:
	Provide better diagnostics.

deep_profiler/create_report.m:
deep_profiler/display.m:
deep_profiler/display_report.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/measurement_units.m:
deep_profiler/query.m:
deep_profiler/report.m:
mdbcomp/feedback.m:
	Misc cleanups. They can be considered my post-commit review of Paul's
	diff.

	In mdprof_feedback.m, delete a strange test that prevented the program
	from being used from the command line.

deep_profiler/dump.m:
deep_profiler/mdprof_dump.m:
deep_profiler/timeout.m:
deep_profiler/util.m:
	Misc cleanups of old code.
2008-08-04 03:17:55 +00:00
Paul Bone
1c64a93ac1 Improved mdprof_dump's command line parsing.
Estimated hours taken: 2

Branch: main

Improved mdprof_dump's command line parsing.  It's behaviour is now more
obvious.  Major changes include The "-D restrict" option is now "--restrict",
and is no-longer affected by other -D options.  Silently ignored -D options
have now been documented as unimplemented.

deep_profiler/dump.m:
	use a structured representation of command line parameters used to control
	deep_dump/4 and deep_initial_dump/4.

deep_profiler/startup.m:
	Conform to changes in dump.m, read_and_startup now takes a deep_options
	type rather than a list of strings.  A new version of read_and_startup has
	been created that doesn't take any deep_options and assumes the defaults.

deep_profiler/mdprof_dump.m:
	Modified command line options, The '-D' option is now only used to specify
	what arrays to dump.  A new option, '--restrict', controls whether to
	print unreferenced call_site_statics and proc_statics.

deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
	Conform to changes in startup.m, now makes use of dump.m.
2008-02-17 06:48:38 +00:00
Peter Wang
5ed14375b1 Respect the CGI environment variables SERVER_NAME, SERVER_PORT and
Branches: main

deep_profiler/conf.m:
deep_profiler/html_format.m:
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/profile.m:
deep_profiler/startup.m:
	Respect the CGI environment variables SERVER_NAME, SERVER_PORT and
	SCRIPT_NAME.  This allows the mdprof_cgi to be used with any web
	server, on an arbitrary port, at any URL.
2007-04-02 02:42:33 +00:00
Julien Fischer
b4c3bb1387 Clean up in unused module imports in the Mercury system detected
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.
2006-12-01 15:04:40 +00:00
Zoltan Somogyi
c262737998 Include call sequence numbers in the pages generated by the deep profiler
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.
2006-10-12 06:30:23 +00:00
Zoltan Somogyi
b7dffa1bf5 Minor style fix.
Estimated hours taken: 0.1
Branches: main

deep/mdprof_test.m:
	Minor style fix.
2006-10-11 05:51:30 +00:00
Julien Fischer
459847a064 Move the univ, maybe, pair and unit types from std_util into their own
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.
2006-03-29 08:09:58 +00:00
Zoltan Somogyi
a9a2825ace Replace __ with . as the module qualifier everywhere in all the modules
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.
2006-03-09 04:56:47 +00:00
Julien Fischer
8b45307164 Add a new mode of operation, '--verify-profile', to mdprof_test.
Estimated hours taken: 0.5
Branches: main

Add a new mode of operation, '--verify-profile', to mdprof_test.
When run in this mode, mdprof_test reads in a deep profile and
tests that it is well-formed by running the usual startup
procedure on it.  It does not create a server process.

The intention is to use this in the test suite when testing
the .profdeep grades, e.g to prevent the situation where a
test case is passing but the Deep.data file contains rubbish.

deep_profiler/mdprof_test.m:
	Add an option '--verify-profile' that causes to
	mdprof_test to run in verification mode.
2005-08-12 02:49:54 +00:00
Julien Fischer
4083fe5bf2 Cleanup the deep profiler.
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.
2005-06-23 08:21:29 +00:00
Zoltan Somogyi
d8694dc1aa Significantly enhance the infrastructure for debugging problems with the deep
Estimated hours taken: 8
Branches: main

Significantly enhance the infrastructure for debugging problems with the deep
profiler by providing facilities for dumping out some of the main data
structures. These were needed for my recent fix of mercury_deep_profiling.c
in the runtime.

There are no algorithmic changes in the non-debugging parts of the code.

deep_profiler/dump.m:
	New module for containing predicates that dump data structures.
	The first draft was by Julien.

deep_profiler/mdprof_dump.m:
	New program for dumping out the contents of Deep.data files.
	The first draft was by Julien.

deep_profiler/startup.m:
	Provide a mechanism for dumping out the main data structures at three
	stages.

deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
	Pass the options to startup to control these dumps.

deep_profiler/measurements.m:
	Provide a mechanism for getting all the counts of a measurement at
	once.

deep_profiler/array_util.m:
	Provide extra modes of some predicates for use in the other modules.

deep_profiler/read_profile.m:
	Fix Julien's fix: handle init predicates as well as the other uci
	predicates.

deep_profiler/profile.m:
	Reorder the arguments of predicates as required to enable the use
	of state variable notation in the callers.

deep_profiler/*.m:
	Conform to the change in profile.m, and use state variable notation
	where this is advantageous.

	Convert some modules to four-space indentation where this eliminates
	excessive indentation or bad line breaks.

deep_profiler/Mmakefile:
	Handle the new mdprof_dump program.
2005-04-25 06:51:58 +00:00
Zoltan Somogyi
69d84ff1bb Import only one module per line. Misc other updates to bring these
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.
2005-03-24 01:10:34 +00:00
Zoltan Somogyi
9c488dd2b3 A bunch of small improvements to the library.
Estimated hours taken: 4
Branches: main

A bunch of small improvements to the library.

library/getopt.m:
	Allow the determinism of the the option_defaults predicate
	passed by users to getopt__process_options to be multi as well as
	nondet. The natural determinism of such predicates is multi;
	the nondet determinism dates from before the time the compiler
	supported multi.

	Add a version of process_options that allows it to be run more
	than once (by allowing it to start with an option table returned
	by a previous invocation) and returns the set of options set by
	each invocation, so that the caller can tell which invocation
	(if any) has set any given option.

	Switch to 4-space indentation to reduce the number of bad line breaks.

library/svset.m:
	This new module svset makes it easier to work with sets in
	code that uses state variables. For every predicate in set.m that
	updates sets, svset.m contains a predicate doing the same thing
	with an argument order conducive to the use of state variables.

	This module is now used in getopt.m.

library/library.m:
	Mention the new module.

library/map.m:
library/tree234.m:
	Add new mode to map__map_foldl that I found I needed in elk.

library/map.m:
library/svmap.m:
	Apply type specialization to all the most frequently used predicates
	for updating maps.

NEWS:
	Mention the functionality in getopt.m, and the new module.

	Group all the items related to getopt.m.

browser/parse.m:
compiler/options.m:
profiler/mercury_profile.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
	Conform to the new determinism in getopt.m.
2004-12-16 03:17:30 +00:00
Zoltan Somogyi
3c82dc3867 Switch to using state variable notation where this is beneficial.
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.
2004-01-12 04:29:23 +00:00
Julien Fischer
4192cc64d7 Add some missing newlines to mdprof_test's help message.
From juliensf@students.cs.mu.OZ.AU Tue Jul 15 14:33:52 2003
Date: Mon, 14 Jul 2003 14:50:20 +1000 (EST)
From: Julien Fischer <juliensf@students.cs.mu.OZ.AU>
Reply-To: mercury-reviews@cs.mu.OZ.AU
To: mercury-reviews@cs.mu.OZ.AU
Subject: [m-rev.] trivial diff: fix mdprof_test help message


Estimated hours taken: 0.1
Branches: main

deep_profiler/mdprof_test.m:
	Add some missing newlines to mdprof_test's help message.

Index: mdprof_test.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/mdprof_test.m,v
retrieving revision 1.2
diff -u -r1.2 mdprof_test.m
--- mdprof_test.m	2 Dec 2002 11:24:34 -0000	1.2
+++ mdprof_test.m	14 Jul 2003 04:44:30 -0000
@@ -103,11 +103,11 @@
 	io__format("Usage: %s [<options>] <filename>\n", [s(ProgName)]),
 	io__format("<filename> must name a deep profiling data file.\n", []),
 	io__format("You should specify one of the following options:\n", []),
-	io__format("--help      Generate this help message.", []),
-	io__format("--version   Report the program's version number.", []),
-	io__format("--test   	Test the deep profiler, generating all\n", []),
-	io__format("            possible web pages of the popular types.", []),
-	io__format("You may also specify the following options:.", []),
+	io__format("--help      Generate this help message.\n", []),
+	io__format("--version   Report the program's version number.\n", []),
+	io__format("--test      Test the deep profiler, generating all\n", []),
+	io__format("            possible web pages of the popular types.\n", []),
+	io__format("You may also specify the following options:.\n", []),
 	io__format("--test-dir <dirname>\n", []),
 	io__format("            Put the generated web pages into <dirname>.\n",
 					[]).

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews@cs.mu.oz.au
administrative address: owner-mercury-reviews@cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request@cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request@cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
2003-07-15 04:35:24 +00:00
Fergus Henderson
e86057942c Apply Zoltan's deep profiler changes to the main branch.
Estimated hours taken: 2
Branches: main

Apply Zoltan's deep profiler changes to the main branch.  Zoltan committed
these changes to the release branch, but forgot to commit them to the main
branch.

Mmakefile:
NEWS:
configure.in:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
doc/user_guide.texi:
library/exception.m:
library/io.m:
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
runtime/mercury_misc.c:
runtime/mercury_misc.h:
scripts/Mmakefile:
deep_profiler/.nocopyright:
deep_profiler/Mercury.options:
deep_profiler/Mmakefile:
deep_profiler/callgraph.m:
deep_profiler/cliques.m:
deep_profiler/conf.m:
deep_profiler/html_format.m:
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/query.m:
deep_profiler/startup.m:
deep_profiler/timeout.m:
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
	Merge in changes from the release branch.
	Enclosed below is Zoltan's original log message.

----------

Estimated hours taken: 0.3 (on release branch)
Branches: release

Make the deep profiler work again.

The existing process structure of the deep profiler made it very hard to debug,
mainly because the Mercury debugger is confused by forks and stymied by execs.
This change completely replaces the process structure. The old structure had
two separate programs, mdprof_cgi and mdprof_server, the first always acting
as client and the second always acting as server. The new structure has only
one program, mdprof_cgi, which acts as a server if there is no existing server
for the relevant profiling data file, and as a client otherwise.

Although mdprof_cgi normally forks when it becomes a server to let the parent
exit and let the web server know that the web page it has generated is
complete, the fork can be disabled for debugging via an option. This allows
the communication between client and server to be debugged by running two
instances of mdprof_cgi in different windows, one or both under mdb.

deep_profiler/DESIGN:
	New file describing the new process structure, its race conditions,
	and their solutions.

deep_profiler/.nocopyright:
	Add DESIGN.

deep_profiler/mdprof_cgi.m:
	A complete rewrite of this module to enable it act as both client and
	server.

deep_profiler/mdprof_test.m:
	A new module to hold the testing functionality of mdprof_server.m.

deep_profiler/mdprof_server.m:
deep_profiler/server.m:
	Delete these now unnecessary modules.

Mmakefile:
	Replace references to mdprof_server with references to mdprof_test.

deep_profiler/Mmakefile:
	Replace references to mdprof_server with references to mdprof_test.

	Move the include of Mmake.deep.params, to allow it to override
	top level parameter settings.

deep_profiler/Mercury.options:
	Work around a compiler bug by turning off the offending optimization.

deep_profiler/timeout.m:
	A rewrite of major parts of this module to support the new design
	of mdprof_cgi.m, and to make unexpected signals easier to debug.

deep_profiler/interface.m:
	Implement the mechanisms needed by the new process structure.

	Change the characters we use to separate components of the URL.
	The old ones were special to the shell, and screwed up command lines.
	(As double insurance, we ignore the command line anyway when invoked
	by the web server.)

	Change some names to be more expressive.

deep_profiler/conf.m:
	Add a new function, getpid, for use by interface.m.

	Rewrite some code to use streams explicitly, not implicitly.

deep_profiler/callgraph.m:
deep_profiler/cliques.m:
	Add (now commented out) code to help debug these modules, for use
	in cases where mdb doesn't help, because the program works perfectly
	with debugging enabled :-(

deep_profiler/query.m:
	Move the predicate try_exec here from the deleted file server.m.

deep_profiler/html_format.m:
	Trivial change to conform to name change in interface.m.

deep_profiler/startup.m:
	Generate debugging output to a caller specified stream, not to
	stdout and stderr.

	Disable the generation of statistics temporarily, since the diff
	to make statistics reporting routines write to a specified stream
	instead of stdout and stderr won't be committed on the release branch.
	Currently, they always write to stdout, which in the new design
	goes to the web page, not to the startup file.

configure.in:
	Detect the presence of opendir, readdir and closedir, and the header
	file they need, dirent.h. Enable the deep profiler only if all exist,
	since the deep profiler now needs them.

runtime/mercury_conf.h.in:
	Support the changes to configure.in.

runtime/mercury_misc.[ch]:
	Add a mechanism for registering cleanup functions to be executed when
	we terminate the program due to an uncaught exception.

library/exception.m:
	Invoke the registered cleanup functions just before terminating
	the program due to an uncaught exception.
2002-12-02 11:25:47 +00:00