[m-rev.] diff: apply mdprof changes to main branch

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Dec 2 22:23:27 AEDT 2002


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.

[I'm not going to post the 4700-line diff, since the code has already
been reviewed.  But it is at ~fjh/ws/ceres2/CHANGES.zs.diff if anyone
is interested.]

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list