[m-rev.] diff: profilers and import_module
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Mar 24 12:07:42 AEDT 2005
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.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
Index: deep_profiler/array_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/array_util.m,v
retrieving revision 1.4
diff -u -b -r1.4 array_util.m
--- deep_profiler/array_util.m 31 Jan 2002 02:44:08 -0000 1.4
+++ deep_profiler/array_util.m 23 Mar 2005 13:17:19 -0000
@@ -12,7 +12,8 @@
:- interface.
-:- import_module array, list.
+:- import_module array.
+:- import_module list.
% Perform a mode cast on the given array, making the compiler believe
% that the ground array is unique. Should be used only if the only use
@@ -103,12 +104,15 @@
:- implementation.
-:- import_module int, string.
+:- import_module int.
+:- import_module string.
-:- pragma foreign_proc("C", u(A::in) = (B::array_uo),
+:- pragma foreign_proc("C",
+ u(A::in) = (B::array_uo),
[will_not_call_mercury, thread_safe, promise_pure],
- "B = A;"
-).
+"
+ B = A;
+").
array_foldl_from_1(P, A, U0, U) :-
array__max(A, Max),
Index: deep_profiler/callgraph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/callgraph.m,v
retrieving revision 1.4
diff -u -b -r1.4 callgraph.m
--- deep_profiler/callgraph.m 12 Jan 2004 04:29:23 -0000 1.4
+++ deep_profiler/callgraph.m 23 Mar 2005 13:17:19 -0000
@@ -15,7 +15,9 @@
:- interface.
:- import_module profile.
-:- import_module array, list.
+
+:- import_module array.
+:- import_module list.
:- pred find_cliques(initial_deep::in, list(list(proc_dynamic_ptr))::out)
is det.
@@ -28,9 +30,16 @@
:- implementation.
-:- import_module profile, cliques, array_util.
-:- import_module int, set.
-% :- import_module io, string, unsafe, require.
+:- import_module array_util.
+:- import_module cliques.
+:- import_module int.
+:- import_module profile.
+:- import_module set.
+
+% :- import_module io.
+% :- import_module require.
+% :- import_module string.
+% :- import_module unsafe.
find_cliques(InitDeep, BottomUpPDPtrCliqueList) :-
make_graph(InitDeep, Graph),
@@ -141,14 +150,14 @@
% Predicates for use in debugging.
-% :- pred write_arc(int::in, int::in, int::in, io__state::di, io__state::uo)
+% :- pred write_arc(int::in, int::in, int::in, io::di, io::uo)
% is det.
%
% write_arc(FromPDI, ToPDI, CSDI, !IO) :-
% io__format("arc from pd %d to pd %d through csd %d\n",
% [i(FromPDI), i(ToPDI), i(CSDI)], !IO).
%
-% :- pred write_pdi_cn(int::in, int::in, io__state::di, io__state::uo) is det.
+% :- pred write_pdi_cn(int::in, int::in, io::di, io::uo) is det.
%
% write_pdi_cn(PDI, CN, !IO) :-
% io__write_string("pdi ", !IO),
Index: deep_profiler/canonical.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/canonical.m,v
retrieving revision 1.4
diff -u -b -r1.4 canonical.m
--- deep_profiler/canonical.m 14 Dec 2004 01:07:17 -0000 1.4
+++ deep_profiler/canonical.m 23 Mar 2005 13:17:19 -0000
@@ -21,8 +21,19 @@
:- implementation.
-:- import_module measurements, callgraph, array_util.
-:- import_module io, std_util, bool, int, array, list, map, set, require.
+:- import_module array.
+:- import_module array_util.
+:- import_module bool.
+:- import_module callgraph.
+:- import_module int.
+:- import_module io.
+:- import_module list.
+:- import_module map.
+:- import_module measurements.
+:- import_module require.
+:- import_module set.
+:- import_module std_util.
+
% :- import_module unsafe.
:- type merge_info
Index: deep_profiler/cliques.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/cliques.m,v
retrieving revision 1.4
diff -u -b -r1.4 cliques.m
--- deep_profiler/cliques.m 12 Jan 2004 04:29:23 -0000 1.4
+++ deep_profiler/cliques.m 23 Mar 2005 13:17:19 -0000
@@ -16,7 +16,8 @@
:- type graph.
-:- import_module list, set.
+:- import_module list.
+:- import_module set.
% Create a graph with no edges.
:- pred init(graph::out) is det.
@@ -34,9 +35,15 @@
:- implementation.
-:- import_module array_util, dense_bitset.
-:- import_module array, int.
-% :- import_module io, unsafe, string.
+:- import_module array_util.
+:- import_module dense_bitset.
+
+:- import_module array.
+:- import_module int.
+
+% :- import_module io.
+% :- import_module string.
+% :- import_module unsafe.
:- type graph
---> graph(
@@ -232,7 +239,7 @@
% Predicates to use in debugging.
-% :- pred write_graph(graph::in, io__state::di, io__state::uo)
+% :- pred write_graph(graph::in, io::di, io::uo)
% is det.
%
% write_graph(Graph, !IO) :-
@@ -241,7 +248,7 @@
% write_graph_nodes(0, Size, Array, !IO).
%
% :- pred write_graph_nodes(int::in, int::in, array(set(int))::in,
-% io__state::di, io__state::uo) is det.
+% io::di, io::uo) is det.
%
% write_graph_nodes(Cur, Max, Array, !IO) :-
% ( Cur =< Max ->
@@ -255,19 +262,19 @@
% true
% ).
%
-% :- pred write_dfs(list(int)::in, io__state::di, io__state::uo)
+% :- pred write_dfs(list(int)::in, io::di, io::uo)
% is det.
%
% write_dfs(Dfs, !IO) :-
% io__write_list(Dfs, "\n", io__write_int, !IO).
%
-% :- pred write_cliques(list(set(int))::in, io__state::di, io__state::uo)
+% :- pred write_cliques(list(set(int))::in, io::di, io::uo)
% is det.
%
% write_cliques(Cliques, !IO) :-
% io__write_list(Cliques, "\n", io__write, !IO).
%
-% :- pred write_clique(list(int)::in, io__state::di, io__state::uo)
+% :- pred write_clique(list(int)::in, io::di, io::uo)
% is det.
%
% write_clique(Nodes, !IO) :-
Index: deep_profiler/conf.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/conf.m,v
retrieving revision 1.4
diff -u -b -r1.4 conf.m
--- deep_profiler/conf.m 12 Jan 2004 04:29:23 -0000 1.4
+++ deep_profiler/conf.m 23 Mar 2005 13:17:19 -0000
@@ -21,13 +21,15 @@
:- func make_pipe_cmd(string) = string.
% The name of the server on which mdprof is being run.
-:- pred server_name(string::out, io__state::di, io__state::uo) is det.
+:- pred server_name(string::out, io::di, io::uo) is det.
:- func getpid = int.
:- implementation.
-:- import_module string, list, require.
+:- import_module list.
+:- import_module require.
+:- import_module string.
make_pipe_cmd(PipeName) = Cmd :-
mkfifo_cmd(CmdName),
Index: deep_profiler/dense_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/dense_bitset.m,v
retrieving revision 1.2
diff -u -b -r1.2 dense_bitset.m
--- deep_profiler/dense_bitset.m 20 Jun 2003 11:20:08 -0000 1.2
+++ deep_profiler/dense_bitset.m 23 Mar 2005 13:17:19 -0000
@@ -16,7 +16,8 @@
:- interface.
-:- import_module array, int.
+:- import_module array.
+:- import_module int.
% XXX should be abstract type; it is exported only as a workaround.
:- type dense_bitset == array(int).
@@ -52,7 +53,8 @@
:- implementation.
-:- import_module list, require.
+:- import_module list.
+:- import_module require.
init = array([0]).
Index: deep_profiler/exclude.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/exclude.m,v
retrieving revision 1.3
diff -u -b -r1.3 exclude.m
--- deep_profiler/exclude.m 12 Jan 2004 04:29:23 -0000 1.3
+++ deep_profiler/exclude.m 23 Mar 2005 13:17:19 -0000
@@ -40,12 +40,14 @@
:- interface.
:- import_module profile.
-:- import_module std_util, io.
+
+:- import_module std_util.
+:- import_module io.
:- type exclude_file.
:- pred read_exclude_file(string::in, deep::in, maybe_error(exclude_file)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
:- func apply_contour_exclusion(deep, exclude_file, call_site_dynamic_ptr)
= call_site_dynamic_ptr.
@@ -54,7 +56,13 @@
:- implementation.
-:- import_module bool, char, string, list, set, map, require.
+:- import_module bool.
+:- import_module char.
+:- import_module list.
+:- import_module map.
+:- import_module require.
+:- import_module set.
+:- import_module string.
:- type exclude_file == set(exclude_spec).
@@ -95,7 +103,7 @@
:- pred read_exclude_lines(string::in, io__input_stream::in,
list(exclude_spec)::in, maybe_error(list(exclude_spec))::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_exclude_lines(FileName, InputStream, RevSpecs0, Res, !IO) :-
io__read_line_as_string(InputStream, Res0, !IO),
@@ -142,10 +150,12 @@
validate_exclude_lines(FileName, Specs, Deep, Res) :-
list__filter(has_valid_module_name(Deep), Specs,
ValidSpecs, InvalidSpecs),
- ( InvalidSpecs = [] ->
+ (
+ InvalidSpecs = [],
set__list_to_set(ValidSpecs, ModuleSpecSet),
Res = ok(ModuleSpecSet)
;
+ InvalidSpecs = [_ | _],
InvalidModuleNames = list__map(spec_to_module_name,
InvalidSpecs),
BadNames = string__join_list(", ", InvalidModuleNames),
Index: deep_profiler/html_format.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/html_format.m,v
retrieving revision 1.3
diff -u -b -r1.3 html_format.m
--- deep_profiler/html_format.m 19 May 2004 03:59:40 -0000 1.3
+++ deep_profiler/html_format.m 23 Mar 2005 13:17:19 -0000
@@ -13,8 +13,14 @@
:- interface.
-:- import_module profile, interface, measurements, top_procs.
-:- import_module std_util, bool, list.
+:- import_module interface.
+:- import_module measurements.
+:- import_module profile.
+:- import_module top_procs.
+
+:- import_module bool.
+:- import_module list.
+:- import_module std_util.
:- func table_start(preferences) = string.
:- func table_end(preferences) = string.
@@ -121,7 +127,13 @@
:- implementation.
:- import_module top_procs.
-:- import_module int, float, char, string, map, require.
+
+:- import_module char.
+:- import_module float.
+:- import_module int.
+:- import_module map.
+:- import_module require.
+:- import_module string.
%-----------------------------------------------------------------------------%
Index: deep_profiler/interface.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/interface.m,v
retrieving revision 1.6
diff -u -b -r1.6 interface.m
--- deep_profiler/interface.m 12 Jan 2004 04:29:23 -0000 1.6
+++ deep_profiler/interface.m 23 Mar 2005 13:17:19 -0000
@@ -44,7 +44,10 @@
:- interface.
-:- import_module bool, char, std_util, io.
+:- import_module bool.
+:- import_module char.
+:- import_module io.
+:- import_module std_util.
% These functions derive the names of auxiliary files (or parts
% thereof) from the name of the profiling data file being explored.
@@ -78,28 +81,28 @@
% If Debug is `yes', write it to the file `/tmp/.send_term'
% as well.
:- pred send_term(string::in, bool::in, T::in,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
% send_string(ToFileName, Debug, Str):
% Write the string Str to ToFileName, making it is new contents.
% If Debug is `yes', write it to the file `/tmp/.send_string'
% as well.
:- pred send_string(string::in, bool::in, string::in,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
% recv_term(FromFileName, Debug, Term):
% Read the contents of FromFileName, which should be a single
% Mercury term. If Debug is `yes', write the result of the read
% to the file `/tmp/.recv_term' as well.
:- pred recv_term(string::in, bool::in, T::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
% recv_string(FromFileName, Debug, Str):
% Read the contents of FromFileName, and return it as Str.
% If Debug is `yes', write the result of the read to the file
% `/tmp/.recv_string' as well.
:- pred recv_string(string::in, bool::in, string::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
:- type resp
---> html(string).
@@ -269,8 +272,14 @@
:- implementation.
-:- import_module conf, util.
-:- import_module char, string, list, set, require.
+:- import_module conf.
+:- import_module util.
+
+:- import_module char.
+:- import_module list.
+:- import_module require.
+:- import_module set.
+:- import_module string.
default_preferences =
preferences(
Index: deep_profiler/io_combinator.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/io_combinator.m,v
retrieving revision 1.2
diff -u -b -r1.2 io_combinator.m
--- deep_profiler/io_combinator.m 3 Jul 2001 08:16:18 -0000 1.2
+++ deep_profiler/io_combinator.m 23 Mar 2005 13:17:19 -0000
@@ -34,16 +34,19 @@
%-----------------------------------------------------------------------------%
:- module io_combinator.
+
:- interface.
-:- import_module io, std_util.
+
+:- import_module io.
+:- import_module std_util.
%-----------------------------------------------------------------------------%
:- pred io_combinator__sequence_2(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
pred(T1, T2, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_2(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -51,11 +54,11 @@
out, di, uo) is det.
:- pred io_combinator__sequence_3(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
pred(T1, T2, T3, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_3(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -64,12 +67,12 @@
out, di, uo) is det.
:- pred io_combinator__sequence_4(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
pred(T1, T2, T3, T4, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_4(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -79,13 +82,13 @@
out, di, uo) is det.
:- pred io_combinator__sequence_5(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
- pred(io__result(T5), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
+ pred(io__result(T5), io, io),
pred(T1, T2, T3, T4, T5, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_5(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -96,14 +99,14 @@
out, di, uo) is det.
:- pred io_combinator__sequence_6(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
- pred(io__result(T5), io__state, io__state),
- pred(io__result(T6), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
+ pred(io__result(T5), io, io),
+ pred(io__result(T6), io, io),
pred(T1, T2, T3, T4, T5, T6, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_6(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -115,15 +118,15 @@
out, di, uo) is det.
:- pred io_combinator__sequence_7(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
- pred(io__result(T5), io__state, io__state),
- pred(io__result(T6), io__state, io__state),
- pred(io__result(T7), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
+ pred(io__result(T5), io, io),
+ pred(io__result(T6), io, io),
+ pred(io__result(T7), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_7(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -136,16 +139,16 @@
out, di, uo) is det.
:- pred io_combinator__sequence_8(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
- pred(io__result(T5), io__state, io__state),
- pred(io__result(T6), io__state, io__state),
- pred(io__result(T7), io__state, io__state),
- pred(io__result(T8), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
+ pred(io__result(T5), io, io),
+ pred(io__result(T6), io, io),
+ pred(io__result(T7), io, io),
+ pred(io__result(T8), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_8(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -159,17 +162,17 @@
out, di, uo) is det.
:- pred io_combinator__sequence_9(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
- pred(io__result(T5), io__state, io__state),
- pred(io__result(T6), io__state, io__state),
- pred(io__result(T7), io__state, io__state),
- pred(io__result(T8), io__state, io__state),
- pred(io__result(T9), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
+ pred(io__result(T5), io, io),
+ pred(io__result(T6), io, io),
+ pred(io__result(T7), io, io),
+ pred(io__result(T8), io, io),
+ pred(io__result(T9), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_9(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -184,18 +187,18 @@
out, di, uo) is det.
:- pred io_combinator__sequence_10(
- pred(io__result(T1), io__state, io__state),
- pred(io__result(T2), io__state, io__state),
- pred(io__result(T3), io__state, io__state),
- pred(io__result(T4), io__state, io__state),
- pred(io__result(T5), io__state, io__state),
- pred(io__result(T6), io__state, io__state),
- pred(io__result(T7), io__state, io__state),
- pred(io__result(T8), io__state, io__state),
- pred(io__result(T9), io__state, io__state),
- pred(io__result(T10), io__state, io__state),
+ pred(io__result(T1), io, io),
+ pred(io__result(T2), io, io),
+ pred(io__result(T3), io, io),
+ pred(io__result(T4), io, io),
+ pred(io__result(T5), io, io),
+ pred(io__result(T6), io, io),
+ pred(io__result(T7), io, io),
+ pred(io__result(T8), io, io),
+ pred(io__result(T9), io, io),
+ pred(io__result(T10), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, io__result(T)),
- io__result(T), io__state, io__state).
+ io__result(T), io, io).
:- mode io_combinator__sequence_10(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -213,10 +216,10 @@
%-----------------------------------------------------------------------------%
:- pred io_combinator__res_sequence_2(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
pred(T1, T2, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_2(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -224,11 +227,11 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_3(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
pred(T1, T2, T3, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_3(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -237,12 +240,12 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_4(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
pred(T1, T2, T3, T4, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_4(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -252,13 +255,13 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_5(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
- pred(io__res(T5), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
+ pred(io__res(T5), io, io),
pred(T1, T2, T3, T4, T5, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_5(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -269,14 +272,14 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_6(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
- pred(io__res(T5), io__state, io__state),
- pred(io__res(T6), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
+ pred(io__res(T5), io, io),
+ pred(io__res(T6), io, io),
pred(T1, T2, T3, T4, T5, T6, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_6(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -288,15 +291,15 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_7(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
- pred(io__res(T5), io__state, io__state),
- pred(io__res(T6), io__state, io__state),
- pred(io__res(T7), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
+ pred(io__res(T5), io, io),
+ pred(io__res(T6), io, io),
+ pred(io__res(T7), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_7(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -309,16 +312,16 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_8(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
- pred(io__res(T5), io__state, io__state),
- pred(io__res(T6), io__state, io__state),
- pred(io__res(T7), io__state, io__state),
- pred(io__res(T8), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
+ pred(io__res(T5), io, io),
+ pred(io__res(T6), io, io),
+ pred(io__res(T7), io, io),
+ pred(io__res(T8), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_8(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -332,17 +335,17 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_9(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
- pred(io__res(T5), io__state, io__state),
- pred(io__res(T6), io__state, io__state),
- pred(io__res(T7), io__state, io__state),
- pred(io__res(T8), io__state, io__state),
- pred(io__res(T9), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
+ pred(io__res(T5), io, io),
+ pred(io__res(T6), io, io),
+ pred(io__res(T7), io, io),
+ pred(io__res(T8), io, io),
+ pred(io__res(T9), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_9(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -357,18 +360,18 @@
out, di, uo) is det.
:- pred io_combinator__res_sequence_10(
- pred(io__res(T1), io__state, io__state),
- pred(io__res(T2), io__state, io__state),
- pred(io__res(T3), io__state, io__state),
- pred(io__res(T4), io__state, io__state),
- pred(io__res(T5), io__state, io__state),
- pred(io__res(T6), io__state, io__state),
- pred(io__res(T7), io__state, io__state),
- pred(io__res(T8), io__state, io__state),
- pred(io__res(T9), io__state, io__state),
- pred(io__res(T10), io__state, io__state),
+ pred(io__res(T1), io, io),
+ pred(io__res(T2), io, io),
+ pred(io__res(T3), io, io),
+ pred(io__res(T4), io, io),
+ pred(io__res(T5), io, io),
+ pred(io__res(T6), io, io),
+ pred(io__res(T7), io, io),
+ pred(io__res(T8), io, io),
+ pred(io__res(T9), io, io),
+ pred(io__res(T10), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, io__res(T)),
- io__res(T), io__state, io__state).
+ io__res(T), io, io).
:- mode io_combinator__res_sequence_10(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -386,10 +389,10 @@
%-----------------------------------------------------------------------------%
:- pred io_combinator__maybe_error_sequence_2(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
pred(T1, T2, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_2(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -397,11 +400,11 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_3(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
pred(T1, T2, T3, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_3(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -410,12 +413,12 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_4(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
pred(T1, T2, T3, T4, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_4(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -425,13 +428,13 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_5(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
- pred(maybe_error(T5), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
+ pred(maybe_error(T5), io, io),
pred(T1, T2, T3, T4, T5, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_5(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -442,14 +445,14 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_6(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
- pred(maybe_error(T5), io__state, io__state),
- pred(maybe_error(T6), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
+ pred(maybe_error(T5), io, io),
+ pred(maybe_error(T6), io, io),
pred(T1, T2, T3, T4, T5, T6, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_6(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -461,15 +464,15 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_7(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
- pred(maybe_error(T5), io__state, io__state),
- pred(maybe_error(T6), io__state, io__state),
- pred(maybe_error(T7), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
+ pred(maybe_error(T5), io, io),
+ pred(maybe_error(T6), io, io),
+ pred(maybe_error(T7), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_7(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -482,16 +485,16 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_8(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
- pred(maybe_error(T5), io__state, io__state),
- pred(maybe_error(T6), io__state, io__state),
- pred(maybe_error(T7), io__state, io__state),
- pred(maybe_error(T8), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
+ pred(maybe_error(T5), io, io),
+ pred(maybe_error(T6), io, io),
+ pred(maybe_error(T7), io, io),
+ pred(maybe_error(T8), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_8(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -505,17 +508,17 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_9(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
- pred(maybe_error(T5), io__state, io__state),
- pred(maybe_error(T6), io__state, io__state),
- pred(maybe_error(T7), io__state, io__state),
- pred(maybe_error(T8), io__state, io__state),
- pred(maybe_error(T9), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
+ pred(maybe_error(T5), io, io),
+ pred(maybe_error(T6), io, io),
+ pred(maybe_error(T7), io, io),
+ pred(maybe_error(T8), io, io),
+ pred(maybe_error(T9), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_9(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
@@ -530,18 +533,18 @@
out, di, uo) is det.
:- pred io_combinator__maybe_error_sequence_10(
- pred(maybe_error(T1), io__state, io__state),
- pred(maybe_error(T2), io__state, io__state),
- pred(maybe_error(T3), io__state, io__state),
- pred(maybe_error(T4), io__state, io__state),
- pred(maybe_error(T5), io__state, io__state),
- pred(maybe_error(T6), io__state, io__state),
- pred(maybe_error(T7), io__state, io__state),
- pred(maybe_error(T8), io__state, io__state),
- pred(maybe_error(T9), io__state, io__state),
- pred(maybe_error(T10), io__state, io__state),
+ pred(maybe_error(T1), io, io),
+ pred(maybe_error(T2), io, io),
+ pred(maybe_error(T3), io, io),
+ pred(maybe_error(T4), io, io),
+ pred(maybe_error(T5), io, io),
+ pred(maybe_error(T6), io, io),
+ pred(maybe_error(T7), io, io),
+ pred(maybe_error(T8), io, io),
+ pred(maybe_error(T9), io, io),
+ pred(maybe_error(T10), io, io),
pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, maybe_error(T)),
- maybe_error(T), io__state, io__state).
+ maybe_error(T), io, io).
:- mode io_combinator__maybe_error_sequence_10(
pred(out, di, uo) is det,
pred(out, di, uo) is det,
Index: deep_profiler/mdprof_cgi.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_cgi.m,v
retrieving revision 1.7
diff -u -b -r1.7 mdprof_cgi.m
--- deep_profiler/mdprof_cgi.m 16 Dec 2004 03:17:23 -0000 1.7
+++ deep_profiler/mdprof_cgi.m 23 Mar 2005 13:17:19 -0000
@@ -16,15 +16,31 @@
:- import_module io.
-:- pred main(io__state::di, io__state::uo) is cc_multi.
+:- pred main(io::di, io::uo) is cc_multi.
:- implementation.
-:- import_module profile, interface, startup, query, conf, timeout, util.
-:- import_module bool, char, string, int, array, list, set.
-:- import_module require, std_util, getopt.
-
-:- import_module int, string, list, array, map, exception, require, library.
+:- import_module profile.
+:- import_module interface.
+:- import_module startup.
+:- import_module query.
+:- import_module conf.
+:- import_module timeout.
+:- import_module util.
+
+:- import_module array.
+:- import_module bool.
+:- import_module char.
+:- import_module exception.
+:- import_module getopt.
+:- import_module int.
+:- import_module library.
+:- import_module list.
+:- import_module map.
+:- import_module require.
+:- import_module set.
+:- import_module std_util.
+:- import_module string.
% The web server should always set QUERY_STRING. It may also pass its contents
% as arguments, but if any characters specials to the shell occur in the query,
@@ -66,8 +82,7 @@
process_command_line(!IO)
).
-
-:- pred process_command_line(io__state::di, io__state::uo) is cc_multi.
+:- pred process_command_line(io::di, io::uo) is cc_multi.
process_command_line(!IO) :-
io__progname_base(mdprof_cgi_progname, ProgName, !IO),
@@ -109,7 +124,7 @@
mdprof_cgi_progname = "mdprof_cgi".
-:- pred write_version_message(string::in, io__state::di, io__state::uo) is det.
+:- pred write_version_message(string::in, io::di, io::uo) is det.
write_version_message(ProgName, !IO) :-
library__version(Version) ,
@@ -119,7 +134,7 @@
io__write_string(Version, !IO),
io__nl(!IO).
-:- pred write_help_message(string::in, io__state::di, io__state::uo) is det.
+:- pred write_help_message(string::in, io::di, io::uo) is det.
write_help_message(ProgName, !IO) :-
% The options are deliberately not documented; they change
@@ -133,7 +148,7 @@
%-----------------------------------------------------------------------------%
:- pred process_args(string::in, list(string)::in, option_table::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
process_args(ProgName, Args, Options, !IO) :-
( Args = [FileName] ->
@@ -151,7 +166,7 @@
% This predicate is for debugging the command line given to mdprof_cgi by the
% web server, should that be necessary
%
-% :- pred write_bracketed_string(string::in, io__state::di, io__state::uo)
+% :- pred write_bracketed_string(string::in, io::di, io::uo)
% is det.
%
% write_bracketed_string(S, !IO) :-
@@ -159,7 +174,7 @@
% io__write_string(S, !IO),
% io__write_string(">", !IO).
-:- pred write_html_header(io__state::di, io__state::uo) is det.
+:- pred write_html_header(io::di, io::uo) is det.
write_html_header(!IO) :-
io__write_string(html_header_text, !IO),
@@ -172,7 +187,7 @@
%-----------------------------------------------------------------------------%
:- pred process_query(cmd::in, maybe(string)::in, string::in,
- option_table::in, io__state::di, io__state::uo) is cc_multi.
+ option_table::in, io::di, io::uo) is cc_multi.
process_query(Cmd, MaybePrefStr, DataFileName, Options, !IO) :-
(
@@ -225,7 +240,7 @@
:- pred handle_query_from_existing_server(cmd::in, preferences::in,
string::in, string::in, string::in, string::in, option_table::in,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
handle_query_from_existing_server(Cmd, Pref, ToServerPipe, FromServerPipe,
MutexFile, WantFile, Options, !IO) :-
@@ -249,7 +264,7 @@
:- pred handle_query_from_new_server(cmd::in, preferences::in, string::in,
string::in, string::in, string::in, string::in, string::in,
- option_table::in, io__state::di, io__state::uo) is cc_multi.
+ option_table::in, io::di, io::uo) is cc_multi.
handle_query_from_new_server(Cmd, Pref, FileName, ToServerPipe, FromServerPipe,
StartupFile, MutexFile, WantFile, Options, !IO) :-
@@ -328,7 +343,7 @@
:- pred start_server(option_table::in, string::in, string::in,
maybe(io__output_stream)::in, string::in, string::in, deep::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
start_server(Options, ToServerPipe, FromServerPipe, MaybeStartupStream,
MutexFile, WantFile, Deep, !IO) :-
@@ -417,7 +432,7 @@
:- pred server_loop(string::in, string::in, int::in,
maybe(io__output_stream)::in, bool::in, bool::in, int::in, deep::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
server_loop(ToServerPipe, FromServerPipe, TimeOut0, MaybeStartupStream,
Debug, Canonical, QueryNum0, Deep0, !IO) :-
@@ -501,7 +516,7 @@
%-----------------------------------------------------------------------------%
-:- pred make_pipes(string::in, bool::out, io__state::di, io__state::uo) is det.
+:- pred make_pipes(string::in, bool::out, io::di, io::uo) is det.
make_pipes(FileName, Success, !IO) :-
ToServerPipe = to_server_pipe_name(FileName),
@@ -542,7 +557,7 @@
").
:- pred check_for_existing_fifos(string::in, string::in, int::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
:- pragma foreign_proc("C",
check_for_existing_fifos(Fifo1::in, Fifo2::in, FifoCount::out,
@@ -579,7 +594,7 @@
; fork_failed.
:- pred detach_process(detach_process_result::out,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
detach_process(Result, !IO) :-
raw_detach_process(ResCode, !IO),
@@ -602,7 +617,7 @@
%
% - a negative number in the parent (there is no child process).
-:- pred raw_detach_process(int::out, io__state::di, io__state::uo) is cc_multi.
+:- pred raw_detach_process(int::out, io::di, io::uo) is cc_multi.
:- pragma foreign_proc("C",
raw_detach_process(ResCode::out, S0::di, S::uo),
Index: deep_profiler/mdprof_test.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_test.m,v
retrieving revision 1.5
diff -u -b -r1.5 mdprof_test.m
--- deep_profiler/mdprof_test.m 16 Dec 2004 03:17:23 -0000 1.5
+++ deep_profiler/mdprof_test.m 23 Mar 2005 13:17:19 -0000
@@ -14,15 +14,30 @@
:- import_module io.
-:- pred main(io__state::di, io__state::uo) is cc_multi.
+:- pred main(io::di, io::uo) is cc_multi.
:- implementation.
-:- import_module profile, interface, startup, query, conf, timeout, util.
-:- import_module bool, char, string, int, array, list, set.
-:- import_module require, std_util, getopt.
-
-:- import_module int, string, list, array, exception, require, library.
+:- import_module conf.
+:- import_module interface.
+:- import_module profile.
+:- import_module query.
+:- import_module startup.
+:- import_module timeout.
+:- import_module util.
+
+:- import_module array.
+:- import_module bool.
+:- import_module char.
+:- import_module exception.
+:- import_module getopt.
+:- import_module int.
+:- import_module library.
+:- import_module list.
+:- import_module require.
+:- import_module set.
+:- import_module std_util.
+:- import_module string.
main(!IO) :-
io__progname_base("mdprof_test", ProgName, !IO),
@@ -45,7 +60,10 @@
;
Version = no
),
- ( Help = no, Version = no ->
+ (
+ Help = no,
+ Version = no
+ ->
main2(ProgName, Args, Options, !IO)
;
true
@@ -58,7 +76,7 @@
).
:- pred main2(string::in, list(string)::in, option_table::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
main2(ProgName, Args, Options, !IO) :-
( Args = [FileName] ->
@@ -88,7 +106,7 @@
write_help_message(ProgName, !IO)
).
-:- pred write_version_message(string::in, io__state::di, io__state::uo) is det.
+:- pred write_version_message(string::in, io::di, io::uo) is det.
write_version_message(ProgName, !IO) :-
library__version(Version),
@@ -98,7 +116,7 @@
io__write_string(Version, !IO),
io__nl(!IO).
-:- pred write_help_message(string::in, io__state::di, io__state::uo) is det.
+:- pred write_help_message(string::in, io::di, io::uo) is det.
write_help_message(ProgName) -->
io__format("Usage: %s [<options>] <filename>\n", [s(ProgName)]),
@@ -117,7 +135,7 @@
%-----------------------------------------------------------------------------%
:- pred test_server(string::in, preferences::in, deep::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
test_server(DirName, Pref, Deep, !IO) :-
string__format("test -d %s || mkdir -p %s",
@@ -129,7 +147,7 @@
test_procs(1, NumProcStatics, DirName, Pref, Deep, !IO).
:- pred test_cliques(int::in, int::in, string::in, preferences::in, deep::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
test_cliques(Cur, Max, DirName, Pref, Deep, !IO) :-
( Cur =< Max ->
@@ -141,7 +159,7 @@
).
:- pred test_procs(int::in, int::in, string::in, preferences::in, deep::in,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
test_procs(Cur, Max, DirName, Pref, Deep, !IO) :-
( Cur =< Max ->
@@ -153,7 +171,7 @@
).
:- pred write_test_html(string::in, string::in, int::in, string::in,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
write_test_html(DirName, BaseName, Num, HTML, !IO) :-
% For large programs such as the Mercury compiler, the profiler data
Index: deep_profiler/profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/profile.m,v
retrieving revision 1.5
diff -u -b -r1.5 profile.m
--- deep_profiler/profile.m 19 May 2004 03:59:40 -0000 1.5
+++ deep_profiler/profile.m 23 Mar 2005 13:17:19 -0000
@@ -21,7 +21,12 @@
:- interface.
:- import_module measurements.
-:- import_module bool, std_util, array, list, map.
+
+:- import_module array.
+:- import_module bool.
+:- import_module list.
+:- import_module map.
+:- import_module std_util.
:- type profile_stats --->
profile_stats(
@@ -428,7 +433,9 @@
:- implementation.
:- import_module array_util.
-:- import_module int, require.
+
+:- import_module int.
+:- import_module require.
decl_module(ProcId) = DeclModule :-
(
Index: deep_profiler/query.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/query.m,v
retrieving revision 1.5
diff -u -b -r1.5 query.m
--- deep_profiler/query.m 10 Jan 2003 05:03:27 -0000 1.5
+++ deep_profiler/query.m 23 Mar 2005 13:17:19 -0000
@@ -13,19 +13,36 @@
:- interface.
-:- import_module profile, interface.
+:- import_module profile.
+:- import_module interface.
+
:- import_module io.
:- pred try_exec(cmd::in, preferences::in, deep::in, string::out,
- io__state::di, io__state::uo) is cc_multi.
+ io::di, io::uo) is cc_multi.
%-----------------------------------------------------------------------------%
:- implementation.
-:- import_module measurements, top_procs, html_format, exclude.
-:- import_module std_util, bool, int, float, char, string.
-:- import_module array, list, assoc_list, set, map, exception, require.
+:- import_module exclude.
+:- import_module html_format.
+:- import_module measurements.
+:- import_module top_procs.
+
+:- import_module array.
+:- import_module assoc_list.
+:- import_module bool.
+:- import_module char.
+:- import_module exception.
+:- import_module float.
+:- import_module int.
+:- import_module list.
+:- import_module map.
+:- import_module require.
+:- import_module set.
+:- import_module std_util.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -49,7 +66,7 @@
).
:- pred exec(cmd::in, preferences::in, deep::in, string::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
exec(restart, _Pref, _Deep, _HTML, IO, IO) :-
% Our caller is supposed to filter out restart commands.
@@ -477,7 +494,7 @@
:- pred generate_proc_callers_page(cmd::in, proc_static_ptr::in,
caller_groups::in, int::in, preferences::in, deep::in, string::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
generate_proc_callers_page(Cmd, PSPtr, CallerGroups, BunchNum, Pref, Deep,
HTML, IO0, IO) :-
@@ -1394,7 +1411,7 @@
:- pred proc_callers_to_html(preferences::in, deep::in, proc_static_ptr::in,
caller_groups::in, int::in,
maybe_error({id_fields, string, string, string})::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
proc_callers_to_html(Pref, Deep, PSPtr, CallerGroups, BunchNum0, MaybePage,
IO0, IO) :-
Index: deep_profiler/read_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.8
diff -u -b -r1.8 read_profile.m
--- deep_profiler/read_profile.m 25 Aug 2004 08:15:35 -0000 1.8
+++ deep_profiler/read_profile.m 23 Mar 2005 13:17:19 -0000
@@ -1,4 +1,6 @@
%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
% Copyright (C) 2001, 2004 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
@@ -14,16 +16,26 @@
:- interface.
:- import_module profile.
-:- import_module io, std_util.
+
+:- import_module io.
+:- import_module std_util.
:- pred read_call_graph(string::in, maybe_error(initial_deep)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
:- implementation.
-:- import_module measurements, array_util.
-:- import_module bool, char, string, int, array, list, require.
+:- import_module array_util.
:- import_module io_combinator.
+:- import_module measurements.
+
+:- import_module array.
+:- import_module bool.
+:- import_module char.
+:- import_module int.
+:- import_module list.
+:- import_module require.
+:- import_module string.
:- type maybe_error2(T1, T2)
---> ok2(T1, T2)
@@ -90,7 +102,7 @@
).
:- pred read_id_string(maybe_error(string)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_id_string(Res, !IO) :-
read_n_byte_string(string__length(id_string), Res0, !IO),
@@ -134,8 +146,7 @@
make_dummy_pdptr,
zero_own_prof_info
)),
- array__init(MaxPD + 1,
- proc_dynamic(make_dummy_psptr, array([]))),
+ array__init(MaxPD + 1, proc_dynamic(make_dummy_psptr, array([]))),
array__init(MaxCSS + 1,
call_site_static(
make_dummy_psptr, -1,
@@ -147,7 +158,7 @@
).
:- pred read_nodes(initial_deep::in, maybe_error(initial_deep)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_nodes(InitDeep0, Res, !IO) :-
read_byte(Res0, !IO),
@@ -157,11 +168,9 @@
read_call_site_dynamic(Res1, !IO),
(
Res1 = ok2(CallSiteDynamic, CSDI),
- deep_insert(
- InitDeep0 ^ init_call_site_dynamics,
+ deep_insert(InitDeep0 ^ init_call_site_dynamics,
CSDI, CallSiteDynamic, CSDs),
- InitDeep1 = InitDeep0
- ^ init_call_site_dynamics := CSDs,
+ InitDeep1 = InitDeep0 ^ init_call_site_dynamics := CSDs,
read_nodes(InitDeep1, Res, !IO)
;
Res1 = error2(Err),
@@ -171,11 +180,9 @@
read_proc_dynamic(Res1, !IO),
(
Res1 = ok2(ProcDynamic, PDI),
- deep_insert(
- InitDeep0 ^ init_proc_dynamics,
+ deep_insert(InitDeep0 ^ init_proc_dynamics,
PDI, ProcDynamic, PDs),
- InitDeep1 = InitDeep0
- ^ init_proc_dynamics := PDs,
+ InitDeep1 = InitDeep0 ^ init_proc_dynamics := PDs,
read_nodes(InitDeep1, Res, !IO)
;
Res1 = error2(Err),
@@ -185,11 +192,9 @@
read_call_site_static(Res1, !IO),
(
Res1 = ok2(CallSiteStatic, CSSI),
- deep_insert(
- InitDeep0 ^ init_call_site_statics,
+ deep_insert(InitDeep0 ^ init_call_site_statics,
CSSI, CallSiteStatic, CSSs),
- InitDeep1 = InitDeep0
- ^ init_call_site_statics := CSSs,
+ InitDeep1 = InitDeep0 ^ init_call_site_statics := CSSs,
read_nodes(InitDeep1, Res, !IO)
;
Res1 = error2(Err),
@@ -199,11 +204,9 @@
read_proc_static(Res1, !IO),
(
Res1 = ok2(ProcStatic, PSI),
- deep_insert(
- InitDeep0 ^ init_proc_statics,
+ deep_insert(InitDeep0 ^ init_proc_statics,
PSI, ProcStatic, PSs),
- InitDeep1 = InitDeep0
- ^ init_proc_statics := PSs,
+ InitDeep1 = InitDeep0 ^ init_proc_statics := PSs,
read_nodes(InitDeep1, Res, !IO)
;
Res1 = error2(Err),
@@ -223,7 +226,7 @@
).
:- pred read_call_site_static(maybe_error2(call_site_static, int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_call_site_static(Res, !IO) :-
% DEBUGSITE
@@ -258,7 +261,7 @@
:- pred read_proc_static(maybe_error2(proc_static, int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_proc_static(Res, !IO) :-
% DEBUGSITE
@@ -313,7 +316,7 @@
).
:- pred read_proc_id(maybe_error(proc_id)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_proc_id(Res, !IO) :-
read_deep_byte(Res0, !IO),
@@ -326,8 +329,7 @@
; Byte = token_isa_function ->
read_proc_id_user_defined(function, Res, !IO)
;
- format("unexpected proc_id_kind %d",
- [i(Byte)], Msg),
+ format("unexpected proc_id_kind %d", [i(Byte)], Msg),
Res = error(Msg)
)
;
@@ -336,7 +338,7 @@
).
:- pred read_proc_id_uci_pred(maybe_error(proc_id)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_proc_id_uci_pred(Res, !IO) :-
io_combinator__maybe_error_sequence_6(
@@ -355,7 +357,7 @@
Res, !IO).
:- pred read_proc_id_user_defined(pred_or_func::in, maybe_error(proc_id)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_proc_id_user_defined(PredOrFunc, Res, !IO) :-
io_combinator__maybe_error_sequence_5(
@@ -398,8 +400,7 @@
; RawPredName = "__Index__" ->
PredName = "Index"
;
- string__append("unknown special predicate name ", RawPredName,
- Msg),
+ string__append("unknown special predicate name ", RawPredName, Msg),
error(Msg)
),
Name0 = string__append_list(
@@ -517,7 +518,7 @@
).
:- pred read_proc_dynamic(maybe_error2(proc_dynamic, int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_proc_dynamic(Res, !IO) :-
% DEBUGSITE
@@ -554,7 +555,7 @@
).
:- pred read_call_site_dynamic(maybe_error2(call_site_dynamic, int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_call_site_dynamic(Res, !IO) :-
% DEBUGSITE
@@ -594,7 +595,7 @@
).
:- pred read_profile(maybe_error(own_prof_info)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_profile(Res, !IO) :-
read_num(Res0, !IO),
@@ -644,7 +645,7 @@
:- pred maybe_read_num_handle_error(int::in, int::in, int::out,
maybe(string)::in, maybe(string)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
maybe_read_num_handle_error(MaskWord, MaskValue, Num, !MaybeError, !IO) :-
( MaskWord /\ MaskValue \= 0 ->
@@ -661,7 +662,7 @@
).
:- pred read_call_site_slot(maybe_error(call_site_array_slot)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_call_site_slot(Res, !IO) :-
% DEBUGSITE
@@ -715,7 +716,7 @@
).
:- pred read_multi_call_site_csdis(maybe_error(list(int))::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_multi_call_site_csdis(Res, !IO) :-
read_multi_call_site_csdis_2([], Res, !IO).
@@ -731,7 +732,7 @@
% anyway.
:- pred read_multi_call_site_csdis_2(list(int)::in,
- maybe_error(list(int))::out, io__state::di, io__state::uo) is det.
+ maybe_error(list(int))::out, io::di, io::uo) is det.
read_multi_call_site_csdis_2(CSDIs0, Res, !IO) :-
% DEBUGSITE
@@ -746,8 +747,7 @@
read_ptr(csd, Res1, !IO),
(
Res1 = ok(CSDI),
- read_multi_call_site_csdis_2([CSDI | CSDIs0],
- Res, !IO)
+ read_multi_call_site_csdis_2([CSDI | CSDIs0], Res, !IO)
;
Res1 = error(Err),
Res = error(Err)
@@ -759,7 +759,7 @@
).
:- pred read_call_site_kind(maybe_error(call_site_kind)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_call_site_kind(Res, !IO) :-
read_deep_byte(Res0, !IO),
@@ -791,7 +791,7 @@
:- pred read_call_site_kind_and_callee(
maybe_error(call_site_kind_and_callee)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_call_site_kind_and_callee(Res, !IO) :-
read_deep_byte(Res0, !IO),
@@ -804,9 +804,7 @@
read_string(Res2, !IO),
(
Res2 = ok(TypeSubst),
- Res = ok(normal_call(
- proc_static_ptr(
- CalleeProcStatic),
+ Res = ok(normal_call(proc_static_ptr(CalleeProcStatic),
TypeSubst))
;
Res2 = error(Err),
@@ -825,8 +823,7 @@
; Byte = token_callback ->
Res = ok(callback)
;
- format("unexpected call_site_kind %d",
- [i(Byte)], Msg),
+ format("unexpected call_site_kind %d", [i(Byte)], Msg),
Res = error(Msg)
)
% DEBUGSITE
@@ -840,7 +837,7 @@
%-----------------------------------------------------------------------------%
-:- pred read_n_things(int::in, pred(maybe_error(T), io__state, io__state)::
+:- pred read_n_things(int::in, pred(maybe_error(T), io, io)::
in(pred(out, di, uo) is det), maybe_error(list(T))::out,
io::di, io::uo) is det.
@@ -855,7 +852,7 @@
Res = error(Err)
).
-:- pred read_n_things(int::in, pred(maybe_error(T), io__state, io__state)::
+:- pred read_n_things(int::in, pred(maybe_error(T), io, io)::
in(pred(out, di, uo) is det), list(T)::in, maybe_error(list(T))::out,
io::di, io::uo) is det.
@@ -866,8 +863,7 @@
call(ThingReader, Res1, !IO),
(
Res1 = ok(Thing),
- read_n_things(N - 1, ThingReader, [Thing | Things0],
- Res, !IO)
+ read_n_things(N - 1, ThingReader, [Thing | Things0], Res, !IO)
;
Res1 = error(Err),
Res = error(Err)
@@ -877,7 +873,7 @@
%-----------------------------------------------------------------------------%
:- pred read_string(maybe_error(string)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_string(Res, !IO) :-
read_num(Res0, !IO),
@@ -894,16 +890,15 @@
).
:- pred read_n_byte_string(int::in, maybe_error(string)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_n_byte_string(Length, Res, !IO) :-
read_n_bytes(Length, Res1, !IO),
(
Res1 = ok(Bytes),
(
- map((pred(I::in, C::out) is semidet :-
- char__to_int(C, I)
- ), Bytes, Chars)
+ map((pred(I::in, C::out) is semidet :- char__to_int(C, I)),
+ Bytes, Chars)
->
string__from_char_list(Chars, Str),
Res = ok(Str)
@@ -920,7 +915,7 @@
% io__write_string("\n", !IO).
:- pred read_ptr(ptr_kind::in, maybe_error(int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_ptr(_Kind, Res, !IO) :-
read_num1(0, Res, !IO).
@@ -929,7 +924,7 @@
% io__write(Res, !IO),
% io__write_string("\n", !IO).
-:- pred read_num(maybe_error(int)::out, io__state::di, io__state::uo) is det.
+:- pred read_num(maybe_error(int)::out, io::di, io::uo) is det.
read_num(Res, !IO) :-
read_num1(0, Res, !IO).
@@ -939,7 +934,7 @@
% io__write_string("\n", !IO).
:- pred read_num1(int::in, maybe_error(int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_num1(Num0, Res, !IO) :-
read_byte(Res0, !IO),
@@ -968,13 +963,13 @@
fixed_size_int_bytes = 4.
:- pred read_fixed_size_int(maybe_error(int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_fixed_size_int(Res, !IO) :-
read_fixed_size_int1(fixed_size_int_bytes, 0, 0, Res, !IO).
:- pred read_fixed_size_int1(int::in, int::in, int::in, maybe_error(int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_fixed_size_int1(BytesLeft, Num0, ShiftBy, Res, !IO) :-
( BytesLeft =< 0 ->
@@ -984,8 +979,7 @@
(
Res0 = ok(Byte),
Num1 = Num0 \/ ( Byte << ShiftBy),
- read_fixed_size_int1(BytesLeft - 1, Num1, ShiftBy + 8,
- Res, !IO)
+ read_fixed_size_int1(BytesLeft - 1, Num1, ShiftBy + 8, Res, !IO)
;
Res0 = error(Err),
Res = error(Err)
@@ -993,7 +987,7 @@
).
:- pred read_n_bytes(int::in, maybe_error(list(int))::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_n_bytes(N, Res, !IO) :-
read_n_bytes(N, [], Res0, !IO),
@@ -1007,7 +1001,7 @@
).
:- pred read_n_bytes(int::in, list(int)::in, maybe_error(list(int))::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_n_bytes(N, Bytes0, Res, !IO) :-
( N =< 0 ->
@@ -1024,7 +1018,7 @@
).
:- pred read_deep_byte(maybe_error(int)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
read_deep_byte(Res, !IO) :-
read_byte(Res0, !IO),
Index: deep_profiler/startup.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/startup.m,v
retrieving revision 1.7
diff -u -b -r1.7 startup.m
--- deep_profiler/startup.m 12 Jan 2004 04:29:23 -0000 1.7
+++ deep_profiler/startup.m 23 Mar 2005 13:17:19 -0000
@@ -16,19 +16,36 @@
:- interface.
:- import_module profile.
-:- import_module io, bool, list, std_util.
+
+:- import_module bool.
+:- import_module io.
+:- import_module list.
+:- import_module std_util.
:- pred read_and_startup(string::in, list(string)::in, bool::in,
maybe(io__output_stream)::in, maybe_error(deep)::out,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
:- implementation.
-:- import_module profile, read_profile, callgraph, canonical.
-:- import_module measurements, array_util.
-:- import_module std_util, int, string, array, assoc_list, set, map, require.
+:- import_module array_util.
+:- import_module callgraph.
+:- import_module canonical.
+:- import_module measurements.
+:- import_module profile.
+:- import_module read_profile.
+
+:- import_module array.
+:- import_module assoc_list.
+:- import_module int.
+:- import_module map.
+:- import_module require.
+:- import_module set.
+:- import_module std_util.
+:- import_module string.
+
% :- import_module unsafe.
read_and_startup(Machine, DataFileNames, Canonical, MaybeOutputStream, Res,
@@ -62,7 +79,7 @@
).
:- pred startup(string::in, string::in, bool::in, maybe(io__output_stream)::in,
- initial_deep::in, deep::out, io__state::di, io__state::uo) is det.
+ initial_deep::in, deep::out, io::di, io::uo) is det.
startup(Machine, DataFileName, Canonical, MaybeOutputStream, InitDeep0, Deep,
!IO) :-
@@ -869,7 +886,7 @@
%-----------------------------------------------------------------------------%
:- pred maybe_report_stats(maybe(io__output_stream)::in,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
% XXX: io__report_stats writes to stderr, which mdprof_cgi has closed.
% We want to write the report to _OutputStream, but the library doesn't
@@ -882,7 +899,7 @@
maybe_report_stats(no, !IO).
:- pred maybe_report_msg(maybe(io__output_stream)::in, string::in,
- io__state::di, io__state::uo) is det.
+ io::di, io::uo) is det.
maybe_report_msg(yes(OutputStream), Msg, !IO) :-
io__write_string(OutputStream, Msg, !IO),
@@ -894,20 +911,20 @@
% Predicates for use in debugging.
% :- pred print_pdis(initial_deep::in, list(int)::in,
-% io__state::di, io__state::uo) is det.
+% io::di, io::uo) is det.
%
% print_pdis(InitDeep, PDIs, !IO) :-
% io__nl(!IO),
% io__write_list(PDIs, "", print_pdi_nl(InitDeep), !IO).
%
-% :- pred print_pdi_nl(initial_deep::in, int::in, io__state::di, io__state::uo)
+% :- pred print_pdi_nl(initial_deep::in, int::in, io::di, io::uo)
% is det.
%
% print_pdi_nl(InitDeep, PDI, !IO) :-
% print_pdi(InitDeep, PDI, !IO),
% io__nl(!IO).
%
-% :- pred print_pdi(initial_deep::in, int::in, io__state::di, io__state::uo)
+% :- pred print_pdi(initial_deep::in, int::in, io::di, io::uo)
% is det.
%
% print_pdi(InitDeep, PDI, !IO) :-
@@ -924,20 +941,20 @@
% io__nl(!IO).
%
% :- pred print_csdis(initial_deep::in, list(int)::in,
-% io__state::di, io__state::uo) is det.
+% io::di, io::uo) is det.
%
% print_csdis(InitDeep, CSDIs, !IO) :-
% io__nl(!IO),
% io__write_list(CSDIs, "", print_csdi_nl(InitDeep), !IO).
%
-% :- pred print_csdi_nl(initial_deep::in, int::in, io__state::di, io__state::uo)
+% :- pred print_csdi_nl(initial_deep::in, int::in, io::di, io::uo)
% is det.
%
% print_csdi_nl(InitDeep, CSDI, !IO) :-
% print_csdi(InitDeep, CSDI, !IO),
% io__nl(!IO).
%
-% :- pred print_csdi(initial_deep::in, int::in, io__state::di, io__state::uo)
+% :- pred print_csdi(initial_deep::in, int::in, io::di, io::uo)
% is det.
%
% print_csdi(InitDeep, CSDI, !IO) :-
@@ -954,7 +971,7 @@
% print_pdi(InitDeep, CalleePDI, !IO).
%
% :- pred write_pdi_cn_csd(int::in, int::in, int::in,
-% io__state::di, io__state::uo) is det.
+% io::di, io::uo) is det.
%
% write_pdi_cn_csd(PDI, CN, CSDI, !IO) :-
% io__write_string("pdi ", !IO),
Index: deep_profiler/timeout.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/timeout.m,v
retrieving revision 1.10
diff -u -b -r1.10 timeout.m
--- deep_profiler/timeout.m 12 Jan 2004 04:29:23 -0000 1.10
+++ deep_profiler/timeout.m 23 Mar 2005 13:17:20 -0000
@@ -25,58 +25,60 @@
:- interface.
-:- import_module bool, io.
+:- import_module bool.
+:- import_module io.
-% Add the given file name to the list of files to be cleaned up.
-
-:- pred register_file_for_cleanup(string::in, io__state::di, io__state::uo)
+ % Add the given file name to the list of files to be cleaned up.
+ %
+:- pred register_file_for_cleanup(string::in, io::di, io::uo)
is det.
-% Remove the given file name from the list of files to be cleaned up.
-
-:- pred unregister_file_for_cleanup(string::in, io__state::di, io__state::uo)
+ % Remove the given file name from the list of files to be cleaned up.
+ %
+:- pred unregister_file_for_cleanup(string::in, io::di, io::uo)
is det.
-% Remove all file names from the list of files to be cleaned up.
-
-:- pred unregister_all_files_for_cleanup(io__state::di, io__state::uo) is det.
-
-% Delete all the files on the cleanup list.
-
-:- pred delete_cleanup_files(io__state::di, io__state::uo) is det.
-
-% Set up signal handlers for all the signals we can catch. The three strings
-% specify the name of the mutex file, the name of the directory containing the
-% `want' files, and the prefix of the names of the `want' files.
-
+ % Remove all file names from the list of files to be cleaned up.
+ %
+:- pred unregister_all_files_for_cleanup(io::di, io::uo) is det.
+
+ % Delete all the files on the cleanup list.
+ %
+:- pred delete_cleanup_files(io::di, io::uo) is det.
+
+ % Set up signal handlers for all the signals we can catch.
+ % The three strings specify the name of the mutex file,
+ % the name of the directory containing the `want' files,
+ % and the prefix of the names of the `want' files.
+ %
:- pred setup_signals(string::in, string::in, string::in,
- io__state::di, io__state::uo) is det.
-
-% Set up a timeout for the given number of minutes in the future.
-
-:- pred setup_timeout(int::in, io__state::di, io__state::uo) is det.
-
-% Get the lock on the named mutex file if the bool is `no'.
-% (The mutex file exists iff some process holds the lock.)
-% If the bool is `yes', meaning debugging is enabled, do nothing.
+ io::di, io::uo) is det.
+ % Set up a timeout for the given number of minutes in the future.
+ %
+:- pred setup_timeout(int::in, io::di, io::uo) is det.
+
+ % Get the lock on the named mutex file if the bool is `no'.
+ % (The mutex file exists iff some process holds the lock.)
+ % If the bool is `yes', meaning debugging is enabled, do nothing.
+ %
:- pred get_lock(bool::in, string::in,
- io__state::di, io__state::uo) is det.
-
-% Release the lock on the named mutex file if the bool is `no'.
-% (The mutex file exists iff some process holds the lock.)
-% If the bool is `yes', meaning debugging is enabled, do nothing.
+ io::di, io::uo) is det.
+ % Release the lock on the named mutex file if the bool is `no'.
+ % (The mutex file exists iff some process holds the lock.)
+ % If the bool is `yes', meaning debugging is enabled, do nothing.
+ %
:- pred release_lock(bool::in, string::in,
- io__state::di, io__state::uo) is det.
-
-% Create the `want' file with the given name.
-
-:- pred make_want_file(string::in, io__state::di, io__state::uo) is det.
-
-% Delete the `want' file with the given name.
+ io::di, io::uo) is det.
-:- pred remove_want_file(string::in, io__state::di, io__state::uo) is det.
+ % Create the `want' file with the given name.
+ %
+:- pred make_want_file(string::in, io::di, io::uo) is det.
+
+ % Delete the `want' file with the given name.
+ %
+:- pred remove_want_file(string::in, io::di, io::uo) is det.
:- implementation.
@@ -608,7 +610,7 @@
do_release_lock(MutexFile, !IO)
).
-:- pred do_get_lock(string::in, io__state::di, io__state::uo) is det.
+:- pred do_get_lock(string::in, io::di, io::uo) is det.
:- pragma foreign_proc("C",
do_get_lock(MutexFile::in, S0::di, S::uo),
@@ -622,7 +624,7 @@
#endif
").
-:- pred do_release_lock(string::in, io__state::di, io__state::uo)
+:- pred do_release_lock(string::in, io::di, io::uo)
is det.
:- pragma foreign_proc("C",
Index: deep_profiler/top_procs.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/top_procs.m,v
retrieving revision 1.1
diff -u -b -r1.1 top_procs.m
--- deep_profiler/top_procs.m 3 Jul 2001 08:16:19 -0000 1.1
+++ deep_profiler/top_procs.m 23 Mar 2005 13:17:20 -0000
@@ -15,8 +15,12 @@
:- interface.
-:- import_module profile, interface, measurements.
-:- import_module std_util, list.
+:- import_module interface.
+:- import_module measurements.
+:- import_module profile.
+
+:- import_module list.
+:- import_module std_util.
:- func find_top_procs(cost_kind, include_descendants, measurement_scope,
display_limit, deep) = maybe_error(list(int)).
@@ -48,7 +52,11 @@
:- implementation.
-:- import_module bool, int, float, array, require.
+:- import_module array.
+:- import_module bool.
+:- import_module float.
+:- import_module int.
+:- import_module require.
find_top_procs(Sort, InclDesc, Scope, Limit, Deep) = MaybeTopPSIs :-
find_top_sort_predicate(Sort, InclDesc, Scope, SortCompatible,
@@ -136,19 +144,17 @@
%-----------------------------------------------------------------------------%
-:- pred filter_top_procs(deep, int, pred(deep, int), int).
-:- mode filter_top_procs(in, in, pred(in, in) is semidet, in) is semidet.
+:- pred filter_top_procs(deep::in, int::in,
+ pred(deep, int)::in(pred(in, in) is semidet), int::in) is semidet.
filter_top_procs(Deep, RootPSI, FilterPred, PSI) :-
PSI \= RootPSI,
FilterPred(Deep, PSI).
-:- pred find_top_sort_predicate(cost_kind, include_descendants,
- measurement_scope, bool,
- compare_proc_statics, pred(deep, int)).
-:- mode find_top_sort_predicate(in, in, in, out,
- out(func(in, in, in) = out is det),
- out(pred(in, in) is semidet)) is det.
+:- pred find_top_sort_predicate(cost_kind::in, include_descendants::in,
+ measurement_scope::in, bool::out,
+ compare_proc_statics::out(func(in, in, in) = out is det),
+ pred(deep, int)::out(pred(in, in) is semidet)) is det.
find_top_sort_predicate(calls, self, overall, yes,
compare_ps_calls_self_overall, filter_ps_calls_self).
@@ -183,9 +189,8 @@
find_top_sort_predicate(words, self_and_desc, per_call, yes,
compare_ps_words_both_percall, filter_ps_words_both).
-:- pred find_threshold_predicate(cost_kind, include_descendants,
- bool, pred(deep, float, int)).
-:- mode find_threshold_predicate(in, in, out, out(pred(in, in, in) is semidet))
+:- pred find_threshold_predicate(cost_kind::in, include_descendants::in,
+ bool::out, pred(deep, float, int)::out(pred(in, in, in) is semidet))
is det.
find_threshold_predicate(calls, self, no, threshold_ps_time_self).
Index: deep_profiler/util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/util.m,v
retrieving revision 1.2
diff -u -b -r1.2 util.m
--- deep_profiler/util.m 3 Jul 2001 08:16:20 -0000 1.2
+++ deep_profiler/util.m 23 Mar 2005 13:17:20 -0000
@@ -13,17 +13,20 @@
:- interface.
-:- import_module char, list.
+:- import_module char.
+:- import_module list.
% split(Str, Char, Pieces): splits Str into pieces at every occurrence
% of Char, and returns the pieces in order. No piece will contain Char.
% If two Chars occur in a row, split will return the empty string as
% the piece between them.
+ %
:- pred split(string::in, char::in, list(string)::out) is det.
:- implementation.
-:- import_module string, require.
+:- import_module require.
+:- import_module string.
split(Str0, SplitChar, Strs) :-
string__to_char_list(Str0, Chars0),
@@ -46,6 +49,7 @@
% before the first occurrence of SplitChar in Chars in Before, and all
% the characters after the first occurrence of SplitChar in Chars in
% After. The first occurrence of SplitChar itself is not returned.
+ %
:- pred find_split_char(list(char)::in, char::in,
list(char)::out, list(char)::out) is semidet.
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
Index: profiler/atsort_callgraph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/atsort_callgraph.m,v
retrieving revision 1.3
diff -u -b -r1.3 atsort_callgraph.m
--- profiler/atsort_callgraph.m 27 Jul 1997 15:07:43 -0000 1.3
+++ profiler/atsort_callgraph.m 23 Mar 2005 06:49:08 -0000
@@ -3,19 +3,15 @@
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
-
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
%
% atsort_callgraph.m
%
% Main author: petdr.
%
-% Takes a list of files which contains the callgraph of a Mercury module and
-% approximately topologically sorts them to std out.
+% Takes a list of files which contains the callgraph of a Mercury module
+% and approximately topologically sorts them to std out.
%
%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
:- module atsort_callgraph.
@@ -23,114 +19,97 @@
:- import_module io.
-:- pred main(io__state, io__state).
-:- mode main(di, uo) is det.
-
+:- pred main(io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-
:- implementation.
:- import_module read.
-:- import_module relation, set, std_util.
-
-main -->
- io__command_line_arguments(Files),
- { relation__init(CallGraph0) },
- build_call_graph(Files, CallGraph0, CallGraph),
- { relation__atsort(CallGraph, Cliques) },
- { list__reverse(Cliques, RevCliques) },
- print_cliques(RevCliques).
+:- import_module relation.
+:- import_module set.
+:- import_module std_util.
+
+main(!IO) :-
+ io__command_line_arguments(Files, !IO),
+ relation__init(CallGraph0),
+ build_call_graph(Files, CallGraph0, CallGraph, !IO),
+ relation__atsort(CallGraph, Cliques),
+ list__reverse(Cliques, RevCliques),
+ print_cliques(RevCliques, !IO).
%-----------------------------------------------------------------------------%
+ % Builds the call graph located in the *.prof files.
+ %
+:- pred build_call_graph(list(string)::in,
+ relation(string)::in, relation(string)::out, io::di, io::uo) is det.
+
+build_call_graph([], !CallGraph, !IO).
+build_call_graph([File | Files], !CallGraph, !IO) :-
+ process_prof_file(File, !CallGraph, !IO),
+ build_call_graph(Files, !CallGraph, !IO).
+
+ % Puts all the Caller and Callee label pairs from File into the
+ % call graph relation.
+ %
+:- pred process_prof_file(string::in,
+ relation(string)::in, relation(string)::out, io::di, io::uo) is det.
-% build__call_graph:
-% Builds the call graph located in the *.prof files.
-%
-:- pred build_call_graph(list(string), relation(string),
- relation(string), io__state, io__state).
-:- mode build_call_graph(in, in, out, di, uo) is det.
-
-build_call_graph([], CallGraph, CallGraph) --> [].
-build_call_graph([File | Files], CallGraph0, CallGraph) -->
- process_prof_file(File, CallGraph0, CallGraph1),
- build_call_graph(Files, CallGraph1, CallGraph).
-
-
-% process_prof_file:
-% Puts all the Caller and Callee label pairs from File into the
-% call graph relation.
-%
-:- pred process_prof_file(string, relation(string), relation(string),
- io__state, io__state).
-:- mode process_prof_file(in, in, out, di, uo) is det.
-
-process_prof_file(File, CallGraph0, CallGraph) -->
- io__see(File, Result),
+process_prof_file(File, !CallGraph, !IO) :-
+ io__see(File, Result, !IO),
(
- { Result = ok },
- process_prof_file_2(CallGraph0, CallGraph),
- io__seen
+ Result = ok,
+ process_prof_file_2(!CallGraph, !IO),
+ io__seen(!IO)
;
- { Result = error(Error) },
- { CallGraph = CallGraph0 },
-
- { io__error_message(Error, ErrorMsg) },
- io__stderr_stream(StdErr),
+ Result = error(Error),
+ io__error_message(Error, ErrorMsg),
+ io__stderr_stream(StdErr, !IO),
io__write_strings(StdErr,
["atsort_callgraph: error opening file `",
- File, "': ", ErrorMsg, "\n"])
+ File, "': ", ErrorMsg, "\n"], !IO)
).
-:- pred process_prof_file_2(relation(string), relation(string),
- io__state, io__state).
-:- mode process_prof_file_2(in, out, di, uo) is det.
+:- pred process_prof_file_2(relation(string)::in, relation(string)::out,
+ io::di, io::uo) is det.
-process_prof_file_2(CallGraph0, CallGraph) -->
- maybe_read_label_name(MaybeLabelName),
+process_prof_file_2(!CallGraph, !IO) :-
+ maybe_read_label_name(MaybeLabelName, !IO),
(
- { MaybeLabelName = yes(CallerLabel) },
- read_label_name(CalleeLabel),
- { relation__add(CallGraph0, CallerLabel, CalleeLabel,
- CallGraph1) },
- process_prof_file_2(CallGraph1, CallGraph)
+ MaybeLabelName = yes(CallerLabel),
+ read_label_name(CalleeLabel, !IO),
+ svrelation__add(CallerLabel, CalleeLabel, !CallGraph),
+ process_prof_file_2(!CallGraph, !IO)
;
- { MaybeLabelName = no },
- { CallGraph = CallGraph0 }
+ MaybeLabelName = no
).
-
%-----------------------------------------------------------------------------%
+:- pred print_cliques(list(set(string)::in), io::di, io::uo) is det.
-:- pred print_cliques(list(set(string)), io__state, io__state).
-:- mode print_cliques(in, di, uo) is det.
-
-print_cliques([]) --> [].
-print_cliques([Clique | Cliques]) -->
- print_clique(Clique),
- print_cliques(Cliques).
-
-:- pred print_clique(set(string), io__state, io__state).
-:- mode print_clique(in, di, uo) is det.
-
-print_clique(Clique) -->
- { set__to_sorted_list(Clique, CliqueList) },
- print_list(CliqueList).
+print_cliques([], !IO).
+print_cliques([Clique | Cliques], !IO) :-
+ print_clique(Clique, !IO),
+ print_cliques(Cliques, !IO).
+
+:- pred print_clique(set(string)::in, io::di, io::uo) is det.
+
+print_clique(Clique, !IO) :-
+ set__to_sorted_list(Clique, CliqueList),
+ print_list(CliqueList, !IO).
:- pred print_list(list(string), io__state, io__state).
:- mode print_list(in, di, uo) is det.
-print_list([]) --> [].
-print_list([C | Cs]) -->
- io__write_string(C),
- io__write_string("\n"),
- print_list(Cs).
-
+print_list([], !IO).
+print_list([C | Cs], !IO) :-
+ io__write_string(C, !IO),
+ io__write_string("\n", !IO),
+ print_list(Cs, !IO).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
Index: profiler/call_graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/call_graph.m,v
retrieving revision 1.9
diff -u -b -r1.9 call_graph.m
--- profiler/call_graph.m 2 Dec 2004 08:01:10 -0000 1.9
+++ profiler/call_graph.m 23 Mar 2005 06:49:52 -0000
@@ -9,11 +9,10 @@
% Main author: petdr.
%
% Responsible for building the static call graph. The dynamic call graph is
-% built during the processing of 'Prof.CallPair', if the appropiate option is
-% set.
+% built during the processing of 'Prof.CallPair', if the appropiate option
+% is set.
%
%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
:- module call_graph.
@@ -30,8 +29,12 @@
:- implementation.
:- import_module read.
-:- import_module options, globals.
-:- import_module require, bool, std_util.
+:- import_module options.
+:- import_module globals.
+
+:- import_module bool.
+:- import_module require.
+:- import_module std_util.
%-----------------------------------------------------------------------------%
@@ -43,9 +46,10 @@
% available. NB The dynamic call graph is built as it is read in
% in process_addr_pair_file
%
- ( Dynamic = yes ->
- true
+ (
+ Dynamic = yes
;
+ Dynamic = no,
build_static_call_graph(Args, VeryVerbose, !StaticCallGraph,
!IO)
).
Index: profiler/demangle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/demangle.m,v
retrieving revision 1.19
diff -u -b -r1.19 demangle.m
--- profiler/demangle.m 20 Dec 2004 04:11:56 -0000 1.19
+++ profiler/demangle.m 23 Mar 2005 06:58:15 -0000
@@ -17,7 +17,9 @@
%-----------------------------------------------------------------------------%
:- module demangle.
+
:- interface.
+
:- import_module string.
:- pred demangle(string::in, string::out) is det.
@@ -55,8 +57,8 @@
Name = MangledName
).
-:- pred demangle_from_asm(string, string).
-:- mode demangle_from_asm(in, out) is semidet.
+:- pred demangle_from_asm(string::in, string::out) is semidet.
+
demangle_from_asm -->
% skip any leading underscore inserted by the C compiler,
% and skip the `_entry_' prefix, if any.
@@ -66,11 +68,10 @@
maybe_remove_prefix("_"),
maybe_remove_prefix("_entry_")
),
-
demangle_from_c.
-:- pred demangle_from_c(string, string).
-:- mode demangle_from_c(in, out) is semidet.
+:- pred demangle_from_c(string::in, string::out) is semidet.
+
demangle_from_c -->
( demangle_proc_hl ->
{ true }
@@ -86,8 +87,8 @@
/*---------------------------------------------------------------------------*/
-:- pred demangle_proc_ll(string, string).
-:- mode demangle_proc_ll(in, out) is semidet.
+:- pred demangle_proc_ll(string::in, string::out) is semidet.
+
demangle_proc_ll -->
remove_prefix("mercury__"),
@@ -191,8 +192,8 @@
{ string__append_list(Parts, DemangledName) },
dcg_set(DemangledName).
-:- pred demangle_proc_hl(string, string).
-:- mode demangle_proc_hl(in, out) is semidet.
+:- pred demangle_proc_hl(string::in, string::out) is semidet.
+
demangle_proc_hl -->
% Symbols in the Mercury standard library get an additional
% "mercury__" prefix in their mangled name.
@@ -347,9 +348,9 @@
{ string__append_list(Parts, DemangledName) },
dcg_set(DemangledName).
+:- pred demangle_unused_args(maybe(pair(int, bool))::out, int::in, int::out,
+ string::in, string::out) is det.
-:- pred demangle_unused_args(maybe(pair(int, bool)), int, int, string, string).
-:- mode demangle_unused_args(out, in, out, in, out) is det.
demangle_unused_args(UnusedArgs, ModeNum0, ModeNum) -->
%
% Process the mangling introduced by unused_args.m.
@@ -375,8 +376,9 @@
{ ModeNum = ModeNum0 }
).
-:- pred demangle_higher_order(maybe(int), int, int, string, string).
-:- mode demangle_higher_order(out, in, out, in, out) is det.
+:- pred demangle_higher_order(maybe(int)::out, int::in, int::out,
+ string::in, string::out) is det.
+
demangle_higher_order(HigherOrder, ModeNum0, ModeNum) -->
%
% Process the mangling introduced by higher_order.m.
@@ -400,8 +402,9 @@
% skip past the prefix. Fails if the mode number
% is invalid for the specified category.
%
-:- pred handle_compiler_generated_pred(int, pred_category, string, string).
-:- mode handle_compiler_generated_pred(in, out, in, out) is semidet.
+:- pred handle_compiler_generated_pred(int::in, pred_category::out,
+ string::in, string::out) is semidet.
+
handle_compiler_generated_pred(ModeNum0, Category0) -->
( remove_prefix("__Unify__") ->
{ Category0 = unify }
@@ -419,8 +422,9 @@
% Remove any prefixes added for introduced predicates,
% and get the predicate name.
-:- pred handle_category_etc(string, pred_category, pred_category, string, string).
-:- mode handle_category_etc(out, in, out, in, out) is semidet.
+:- pred handle_category_etc(string::out, pred_category::in, pred_category::out,
+ string::in, string::out) is semidet.
+
handle_category_etc(PredName, Category0, Category) -->
%
% we need to look at the pred name and see if it is an
@@ -504,10 +508,11 @@
{ PredName = PredName0 }
).
-:- pred format_proc(pred_category, maybe(string), string, string, int, int,
- maybe(int), maybe(pair(int, bool)), maybe(int), list(string),
- list(string)).
-:- mode format_proc(in, in, in, in, in, in, in, in, in, out, in) is det.
+:- pred format_proc(pred_category::in, maybe(string)::in, string::in,
+ string::in, int::in, int::in, maybe(int)::in,
+ maybe(pair(int, bool))::in, maybe(int)::in,
+ list(string)::out, list(string)::in) is det.
+
format_proc(Category, MaybeModule, PredOrFunc, PredName, Arity, ModeNum,
HigherOrder, UnusedArgs, MaybeInternalLabelNum) -->
["<"],
@@ -592,8 +597,8 @@
% Code to deal with mercury_data items.
%
-:- pred demangle_data(string, string).
-:- mode demangle_data(in, out) is semidet.
+:- pred demangle_data(string::in, string::out) is semidet.
+
demangle_data -->
( remove_prefix("mercury_data_") ->
% LLDS mangled data
@@ -645,8 +650,9 @@
{ format_data(DataCategory, MaybeModule, Name, Arity, Result) },
dcg_set(Result).
-:- pred format_data(data_category, maybe(string), string, int, string).
-:- mode format_data(in, in, in, in, out) is semidet.
+:- pred format_data(data_category::in, maybe(string)::in, string::in, int::in,
+ string::out) is semidet.
+
format_data(info, MaybeModule, Name, Arity, Result) :-
( MaybeModule = yes(Module) ->
string__format("<type_ctor_info for type `%s.%s/%d'>",
@@ -679,8 +685,8 @@
fail
).
-:- pred demangle_typeclass_info(string, string).
-:- mode demangle_typeclass_info(in, out) is semidet.
+:- pred demangle_typeclass_info(string::in, string::out) is semidet.
+
demangle_typeclass_info -->
maybe_remove_prefix("mercury_data___"),
remove_prefix("base_typeclass_info_"),
@@ -695,8 +701,9 @@
[s(ClassName), s(Args)], Result) },
dcg_set(Result).
-:- pred demangle_class_args(int, string, string, string).
-:- mode demangle_class_args(in, out, in, out) is semidet.
+:- pred demangle_class_args(int::in, string::out, string::in, string::out)
+ is semidet.
+
demangle_class_args(Num, FormattedArgs) -->
remove_maybe_module_prefix(yes(TypeName), ["arity"]),
{ TypeName \= "" },
@@ -729,8 +736,8 @@
% identifier.
%
-:- pred fix_mangled_ascii(string, string).
-:- mode fix_mangled_ascii(in, out) is semidet.
+:- pred fix_mangled_ascii(string::in, string::out) is semidet.
+
fix_mangled_ascii -->
( remove_prefix("f__") ->
insert_prefix("f_")
@@ -772,8 +779,8 @@
[]
).
-:- pred fix_mangled_ascii_chars(string, string).
-:- mode fix_mangled_ascii_chars(in, out) is semidet.
+:- pred fix_mangled_ascii_chars(string::in, string::out) is semidet.
+
fix_mangled_ascii_chars -->
remove_int(I),
( remove_prefix("_") ->
@@ -784,16 +791,16 @@
{ char__to_int(C, I) },
insert_prefix_char(C).
-/*---------------------------------------------------------------------------*/
+%---------------------------------------------------------------------------%
+
+:- pred remove_int(int::out, string::in, string::out) is semidet.
-:- pred remove_int(int, string, string).
-:- mode remove_int(out, in, out) is semidet.
remove_int(Int) -->
remove_digit(Digit),
remove_int_2(Digit, Int).
-:- pred remove_int_2(int, int, string, string).
-:- mode remove_int_2(in, out, in, out) is semidet.
+:- pred remove_int_2(int::in, int::out, string::in, string::out) is semidet.
+
remove_int_2(Int0, Int) -->
( remove_digit(Next) ->
{ Int1 = Int0 * 10 + Next },
@@ -802,14 +809,14 @@
{ Int = Int0 }
).
-:- pred remove_digit(int, string, string).
-:- mode remove_digit(out, in, out) is semidet.
+:- pred remove_digit(int::out, string::in, string::out) is semidet.
+
remove_digit(Digit, String0, String) :-
string__first_char(String0, Char, String),
digit(Char, Digit).
-:- pred digit(character, int).
-:- mode digit(in, uo) is semidet.
+:- pred digit(character::in, int::out) is semidet.
+
digit('0', 0).
digit('1', 1).
digit('2', 2).
@@ -823,8 +830,9 @@
/*---------------------------------------------------------------------------*/
-:- pred remove_maybe_module_prefix(maybe(string), list(string), string, string).
-:- mode remove_maybe_module_prefix(out, in, in, out) is det.
+:- pred remove_maybe_module_prefix(maybe(string)::out, list(string)::in,
+ string::in, string::out) is det.
+
remove_maybe_module_prefix(MaybeModule, StringsToStopAt, String0, String) :-
(
list__member(StopString, StringsToStopAt),
@@ -856,8 +864,9 @@
MaybeModule = no
).
-:- pred remove_maybe_pred_name(maybe(string), string, string).
-:- mode remove_maybe_pred_name(out, in, out) is det.
+:- pred remove_maybe_pred_name(maybe(string)::out, string::in, string::out)
+ is det.
+
remove_maybe_pred_name(MaybePredName, String0, String) :-
(
string__sub_string_search(String0, "__", Index)
@@ -872,8 +881,7 @@
MaybePredName = no
).
-:- pred remove_type_spec(string, string, string) is det.
-:- mode remove_type_spec(out, in, out) is semidet.
+:- pred remove_type_spec(string::out, string::in, string::out) is semidet.
remove_type_spec(TypeSpec, String0, String) :-
string__length(String0, Length),
@@ -884,8 +892,8 @@
String0, 1, Index),
string__split(String0, Index + 1, TypeSpec, String).
-:- pred find_matching_close_bracket(int, int, string, int, int).
-:- mode find_matching_close_bracket(in, in, in, in, out) is semidet.
+:- pred find_matching_close_bracket(int::in, int::in, string::in, int::in,
+ int::out) is semidet.
find_matching_close_bracket(NumBrackets0, Length, String, Index0, Index) :-
Index0 < Length,
@@ -905,44 +913,44 @@
String, Index0 + 1, Index)
).
-:- pred maybe_remove_prefix(string, string, string).
-:- mode maybe_remove_prefix(in, in, out) is det.
+:- pred maybe_remove_prefix(string::in, string::in, string::out) is det.
+
maybe_remove_prefix(Prefix) -->
( remove_prefix(Prefix) -> [] ; [] ).
-:- pred remove_prefix(string, string, string).
-:- mode remove_prefix(in, in, out) is semidet.
+:- pred remove_prefix(string::in, string::in, string::out) is semidet.
+
remove_prefix(Prefix, Name0, Name) :-
string__append(Prefix, Name, Name0).
-:- pred m_remove_suffix(string, string, string).
-:- mode m_remove_suffix(in, in, out) is semidet.
+:- pred m_remove_suffix(string::in, string::in, string::out) is semidet.
+
m_remove_suffix(Suffix, Name0, Name) :-
string__remove_suffix(Name0, Suffix, Name).
-:- pred insert_prefix(string, string, string).
-:- mode insert_prefix(in, in, out) is det.
+:- pred insert_prefix(string::in, string::in, string::out) is det.
+
insert_prefix(Prefix, Name0, Name) :-
string__append(Prefix, Name0, Name).
-:- pred insert_prefix_char(char, string, string).
-:- mode insert_prefix_char(in, in, out) is det.
+:- pred insert_prefix_char(char::in, string::in, string::out) is det.
+
insert_prefix_char(Prefix, Name0, Name) :-
string__first_char(Name, Prefix, Name0).
-:- pred dcg_set(T1, T2, T1).
-:- mode dcg_set(in, in, out) is det.
+:- pred dcg_set(T1::in, T2::in, T1::out) is det.
+
dcg_set(X, _, X).
-:- pred format_maybe_module(maybe(string), string, string).
-:- mode format_maybe_module(in, in, out) is det.
+:- pred format_maybe_module(maybe(string)::in, string::in, string::out) is det.
+
format_maybe_module(no, Name, QualifiedName) :-
string__format("%s", [s(Name)], QualifiedName).
format_maybe_module(yes(Module), Name, QualifiedName) :-
string__format("%s.%s", [s(Module), s(Name)], QualifiedName).
-:- pred remove_trailing_int(int, string, string).
-:- mode remove_trailing_int(out, in, out) is semidet.
+:- pred remove_trailing_int(int::out, string::in, string::out) is semidet.
+
remove_trailing_int(Int) -->
remove_trailing_digit(Digit),
( remove_trailing_int(Rest) ->
@@ -951,14 +959,14 @@
{ Int = Digit }
).
-:- pred remove_trailing_digit(int, string, string).
-:- mode remove_trailing_digit(out, in, out) is semidet.
+:- pred remove_trailing_digit(int::out, string::in, string::out) is semidet.
+
remove_trailing_digit(Digit, String0, String) :-
string_last_char(String0, Char, String),
digit(Char, Digit).
-:- pred string_last_char(string, character, string).
-:- mode string_last_char(in, out, out) is semidet.
+:- pred string_last_char(string::in, character::out, string::out) is semidet.
+
string_last_char(String0, Char, String) :-
string__length(String0, Len),
Len1 = Len - 1,
Index: profiler/demangle_test.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/demangle_test.m,v
retrieving revision 1.1
diff -u -b -r1.1 demangle_test.m
--- profiler/demangle_test.m 26 Jul 1997 11:41:49 -0000 1.1
+++ profiler/demangle_test.m 23 Mar 2005 06:59:36 -0000
@@ -28,18 +28,25 @@
:- pred main(state::di, state::uo) is det.
:- implementation.
+
:- import_module demangle.
-:- import_module list, char, string.
-main -->
- io__command_line_arguments(Args),
- ( { Args \= [] } ->
+:- import_module char.
+:- import_module list.
+:- import_module string.
+
+main(!IO) :-
+ io__command_line_arguments(Args, !IO),
+ (
+ Args = [_ | _],
%
% invoke demangle/2 on each command line argument
%
- { list__map(demangle, Args, DemangledArgs) },
- io__write_list(DemangledArgs, "\n", io__write_string), io__nl
+ list__map(demangle, Args, DemangledArgs),
+ io__write_list(DemangledArgs, "\n", io__write_string, !IO),
+ io__nl(!IO)
;
+ Args = [],
%
% copy stdin to stdout, calling demangle/2 for
% every valid C identifier in the input
@@ -48,29 +55,33 @@
).
:- pred demangle_stdin(list(char)::in, state::di, state::uo) is det.
-demangle_stdin(RevChars) -->
- io__read_char(Result),
- ( { Result = ok(Char) },
- ( { char__is_alnum_or_underscore(Char) } ->
- demangle_stdin([Char | RevChars])
+
+demangle_stdin(RevChars, !IO) :-
+ io__read_char(Result, !IO),
+ (
+ Result = ok(Char),
+ ( char__is_alnum_or_underscore(Char) ->
+ demangle_stdin([Char | RevChars], !IO)
;
- { string__from_rev_char_list(RevChars, MangledName) },
- { demangle(MangledName, DemangledName) },
- io__write_string(DemangledName),
- io__write_char(Char),
- demangle_stdin([])
+ string__from_rev_char_list(RevChars, MangledName),
+ demangle(MangledName, DemangledName),
+ io__write_string(DemangledName, !IO),
+ io__write_char(Char, !IO),
+ demangle_stdin([], !IO)
)
- ; { Result = eof },
- { string__from_rev_char_list(RevChars, MangledName) },
- { demangle(MangledName, DemangledName) },
- io__write_string(DemangledName)
- ; { Result = error(Error) },
- { io__error_message(Error, Message) },
- io__input_stream_name(StreamName),
- io__progname("demangle_test", ProgName),
+ ;
+ Result = eof,
+ string__from_rev_char_list(RevChars, MangledName),
+ demangle(MangledName, DemangledName),
+ io__write_string(DemangledName, !IO)
+ ;
+ Result = error(Error),
+ io__error_message(Error, Message),
+ io__input_stream_name(StreamName, !IO),
+ io__progname("demangle_test", ProgName, !IO),
io__write_strings([ProgName, ": ",
"error reading input file `", StreamName, "': \n\t",
- Message, "\n"])
+ Message, "\n"], !IO)
).
%-----------------------------------------------------------------------------%
Index: profiler/generate_output.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/generate_output.m,v
retrieving revision 1.21
diff -u -b -r1.21 generate_output.m
--- profiler/generate_output.m 2 Dec 2004 08:01:10 -0000 1.21
+++ profiler/generate_output.m 23 Mar 2005 07:07:21 -0000
@@ -1,4 +1,6 @@
%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
% Copyright (C) 1995-1998, 2004 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
@@ -20,7 +22,11 @@
:- import_module output_prof_info.
:- import_module prof_info.
-:- import_module float, int, io, map, string.
+:- import_module float.
+:- import_module int.
+:- import_module io.
+:- import_module map.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -37,7 +43,10 @@
:- import_module globals.
:- import_module options.
-:- import_module bool, list, rbtree, relation.
+:- import_module bool.
+:- import_module list.
+:- import_module rbtree.
+:- import_module relation.
%-----------------------------------------------------------------------------%
@@ -76,7 +85,7 @@
CallList0 = rbtree__values(CallTree),
FlatList0 = rbtree__values(FlatTree),
- assign_index_numbers(CallList0, IndexMap, CallList),
+ assign_index_numbers(IndexMap, CallList0, CallList),
FlatList = list__reverse(FlatList0),
Output = output(InfoMap, CallList, FlatList).
@@ -85,11 +94,12 @@
process_prof_node_list([], _, _, !OutputProf, !IO).
process_prof_node_list([PN | PNs], Prof, VeryVerbose, !OutputProf, !IO) :-
- ( VeryVerbose = yes ->
+ (
+ VeryVerbose = yes,
prof_node_get_pred_name(PN, LabelName),
io__write_string("\n\t% Processing " ++ LabelName, !IO)
;
- true
+ VeryVerbose = no
),
process_prof_node(PN, Prof, !OutputProf),
process_prof_node_list(PNs, Prof, VeryVerbose, !OutputProf, !IO).
@@ -118,8 +128,7 @@
profiling::in, profiling::out) is det.
generate_output__cycle(ProfNode, Prof, !OutputProf) :-
- prof_get_entire(Prof, Scale, _Units, IntTotalCounts, _, _,
- _CycleMap),
+ prof_get_entire(Prof, Scale, _Units, IntTotalCounts, _, _, _CycleMap),
TotalCounts = float__float(IntTotalCounts),
prof_node_get_entire_cycle(ProfNode, Name, CycleNum, Initial, Prop,
@@ -144,16 +153,13 @@
DescTime = (InitialFloat + Prop) * Scale,
OutputProfNode = output_cycle_prof(Name, CycleNum, SelfTime,
- DescPercentage, DescTime, TotalCalls, SelfCalls,
- [], []),
+ DescPercentage, DescTime, TotalCalls, SelfCalls, [], []),
map__det_insert(InfoMap0, Name, OutputProfNode, InfoMap),
- rbtree__insert_duplicate(CallTree0, DescPercentage,
- Name, CallTree),
+ rbtree__insert_duplicate(CallTree0, DescPercentage, Name, CallTree),
!:OutputProf = profiling(InfoMap, CallTree, FreeTree).
-
% generate_output__single_predicate:
% Fills out the output_prof structure when pred is a single predicate.
%
@@ -161,15 +167,17 @@
profiling::in, profiling::out) is det.
generate_output__single_predicate(ProfNode, Prof, !OutputProf) :-
- prof_get_entire(Prof, Scale, _Units, IntTotalCounts, _, _,
- CycleMap),
+ prof_get_entire(Prof, Scale, _Units, IntTotalCounts, _, _, CycleMap),
TotalCounts = float__float(IntTotalCounts),
prof_node_get_entire_pred(ProfNode, LabelName, CycleNum, Initial, Prop,
ParentList, ChildList, TotalCalls, SelfCalls, NameList),
% Node only needs to be processed if it has a parent or a child.
- ( ParentList = [], ChildList = [] ->
+ (
+ ParentList = [],
+ ChildList = []
+ ->
true
;
!.OutputProf = profiling(InfoMap0, CallTree0, FlatTree0),
@@ -202,7 +210,8 @@
process_prof_node_children(ChildList, CycleNum, CycleMap,
Prof, OutputChildList, OutputCycleChildList),
- OutputProfNode = output_prof( Name, CycleNum,
+ OutputProfNode = output_prof(
+ Name, CycleNum,
DescPercentage,
FlatPercentage, SelfTime,
DescTime, TotalCalls,
@@ -223,7 +232,6 @@
!:OutputProf = profiling(InfoMap, CallTree, FlatTree)
).
-
% construct_name:
% When more then one predicate maps to the same address. This predicate
% will build a string of all the different names separated by 'or's.
@@ -235,71 +243,61 @@
string__append(" or ", Name, NameStr1),
string__append(NameStr1, NameStr0, NameStr).
-
-% process_prof_node_parents:
-% generate the parents output structure.
-%
-:- pred process_prof_node_parents(list(pred_info), float, float, int, int,
- cycle_map, list(parent), list(parent)).
-:- mode process_prof_node_parents(in, in, in, in, in, in, out, out) is det.
+ % process_prof_node_parents:
+ % generate the parents output structure.
+ %
+:- pred process_prof_node_parents(list(pred_info)::in, float::in, float::in,
+ int::in, int::in, cycle_map::in, list(parent)::out, list(parent)::out)
+ is det.
process_prof_node_parents(Parents0, SelfTime, DescTime, TotalCalls0, CycleNum,
CycleMap, OutputParentList, OutputCycleParentList) :-
- remove_cycle_members(Parents0, TotalCalls0, CycleNum, CycleMap,
- TotalCalls, Parents, OutputCycleParentList),
+ remove_cycle_members(Parents0, CycleNum, CycleMap,
+ TotalCalls0, TotalCalls, Parents, OutputCycleParentList),
FltTotalCalls = float__float(TotalCalls),
process_prof_node_parents_2(Parents, SelfTime, DescTime, FltTotalCalls,
CycleMap, OutputParentList).
+ % remove_cycle_members
+ % removes any members of the same cycle from the parent listing
+ % of a predicate. Then adjusts the total calls so as not to include
+ % that predicate.
+ %
+:- pred remove_cycle_members(list(pred_info)::in, int::in, cycle_map::in,
+ int::in, int::out, list(pred_info)::out, list(parent)::out) is det.
-% remove_cycle_members
-% removes any members of the same cycle from the parent listing
-% of a predicate. Then adjusts the total calls so as not to include
-% that predicate.
-%
-:- pred remove_cycle_members(list(pred_info), int, int, cycle_map, int,
- list(pred_info), list(parent)).
-:- mode remove_cycle_members(in, in, in, in, out, out, out) is det.
-
-remove_cycle_members([], TotalCalls, _, _, TotalCalls, [], []).
-remove_cycle_members([PN | PNs], TotalCalls0, CycleNum, CycleMap, TotalCalls,
- List, OutputCycleParentList) :-
+remove_cycle_members([], _, _, !TotalCalls, [], []).
+remove_cycle_members([PN | PNs], CycleNum, CycleMap, !TotalCalls, List,
+ OutputCycleParentList) :-
pred_info_get_entire(PN, LabelName, Calls),
- (
- map__search(CycleMap, LabelName, ParentCycleNum)
- ->
- (
- ParentCycleNum = CycleNum
- ->
- TotalCalls1 = TotalCalls0 - Calls,
- remove_cycle_members(PNs, TotalCalls1, CycleNum,
- CycleMap, TotalCalls, List, OC0),
+ ( map__search(CycleMap, LabelName, ParentCycleNum) ->
+ ( ParentCycleNum = CycleNum ->
+ !:TotalCalls = !.TotalCalls - Calls,
+ remove_cycle_members(PNs, CycleNum, CycleMap, !TotalCalls,
+ List, OC0),
Parent = parent(LabelName, CycleNum, 0.0, 0.0, Calls),
- OutputCycleParentList = [ Parent | OC0 ]
+ OutputCycleParentList = [Parent | OC0]
;
- remove_cycle_members(PNs, TotalCalls0, CycleNum,
- CycleMap, TotalCalls, List0, OC0),
+ remove_cycle_members(PNs, CycleNum, CycleMap, !TotalCalls,
+ List0, OC0),
OutputCycleParentList = OC0,
List = [PN | List0]
)
;
- remove_cycle_members(PNs, TotalCalls0, CycleNum, CycleMap,
- TotalCalls, List0, OutputCycleParentList),
+ remove_cycle_members(PNs, CycleNum, CycleMap, !TotalCalls,
+ List0, OutputCycleParentList),
List = [PN | List0]
).
-
-:- pred process_prof_node_parents_2(list(pred_info), float, float, float,
- cycle_map, list(parent)).
-:- mode process_prof_node_parents_2(in, in, in, in, in, out) is det.
+:- pred process_prof_node_parents_2(list(pred_info)::in, float::in, float::in,
+ float::in, cycle_map::in, list(parent)::out) is det.
process_prof_node_parents_2([], _, _, _, _, []).
process_prof_node_parents_2([P | Ps], SelfTime, DescTime, TotalCalls,
CycleMap, OutputParentList) :-
rbtree__init(Output0),
- process_prof_node_parents_3([P | Ps], SelfTime, DescTime,
- TotalCalls, CycleMap,
- Output0, Output),
+ process_prof_node_parents_3([P | Ps], SelfTime, DescTime, TotalCalls,
+ CycleMap, Output0, Output),
rbtree__values(Output, OutputParentList).
:- pred process_prof_node_parents_3(list(pred_info)::in,
@@ -329,17 +327,15 @@
PropSelfTime = SelfTime * Proportion,
PropDescTime = DescTime * Proportion,
- Parent = parent(LabelName, ParentCycleNum, PropSelfTime,
- PropDescTime, Calls),
+ Parent = parent(LabelName, ParentCycleNum, PropSelfTime, PropDescTime,
+ Calls),
rbtree__insert_duplicate(!.Output, Calls, Parent, !:Output),
process_prof_node_parents_3(PNs, SelfTime, DescTime, TotalCalls,
CycleMap, !Output).
-
-:- pred process_prof_node_children(list(pred_info), int, cycle_map,
- prof, list(child), list(child)).
-:- mode process_prof_node_children(in, in, in, in, out, out) is det.
+:- pred process_prof_node_children(list(pred_info)::in, int::in, cycle_map::in,
+ prof::in, list(child)::out, list(child)::out) is det.
process_prof_node_children([], _, _, _, [], []).
process_prof_node_children([C | Cs], CycleNum, CycleMap, Prof, OutputChildList,
@@ -361,19 +357,13 @@
remove_child_cycle_members([PN | PNs], CycleNum, CycleMap, List,
CycleChildList) :-
pred_info_get_entire(PN, LabelName, Calls),
- (
- map__search(CycleMap, LabelName, ChildCycleNum)
- ->
- (
- ChildCycleNum = CycleNum
- ->
- remove_child_cycle_members(PNs, CycleNum, CycleMap,
- List, OC0),
+ ( map__search(CycleMap, LabelName, ChildCycleNum) ->
+ ( ChildCycleNum = CycleNum ->
+ remove_child_cycle_members(PNs, CycleNum, CycleMap, List, OC0),
Child = child(LabelName, CycleNum, 0.0, 0.0, Calls, 0),
- CycleChildList = [ Child | OC0 ]
+ CycleChildList = [Child | OC0]
;
- remove_child_cycle_members(PNs, CycleNum, CycleMap,
- List0, OC0),
+ remove_child_cycle_members(PNs, CycleNum, CycleMap, List0, OC0),
CycleChildList = OC0,
List = [PN | List0]
)
@@ -427,12 +417,12 @@
% assign_index_numbers:
% Reverses the output list so that the predicates which account for
- % most of the time come first and then assigns index numbers.
+ % most of the time come first, and then assigns index numbers.
%
-:- pred assign_index_numbers(list(string)::in, map(string, int)::out,
- list(string)::out) is det.
+:- pred assign_index_numbers(map(string, int)::out,
+ list(string)::in, list(string)::out) is det.
-assign_index_numbers(List0, IndexMap, List) :-
+assign_index_numbers(IndexMap, List0, List) :-
list__reverse(List0, List),
assign_index_numbers_2(List, 1, map.init, IndexMap).
Index: profiler/globals.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/globals.m,v
retrieving revision 1.10
diff -u -b -r1.10 globals.m
--- profiler/globals.m 2 Dec 2004 08:01:10 -0000 1.10
+++ profiler/globals.m 23 Mar 2005 12:59:08 -0000
@@ -16,7 +16,12 @@
:- module globals.
:- interface.
-:- import_module bool, list, options, getopt, io.
+
+:- import_module bool.
+:- import_module getopt.
+:- import_module io.
+:- import_module list.
+:- import_module options.
:- type globals.
@@ -38,13 +43,11 @@
:- pred globals__init(option_table::in, globals::out) is det.
:- pred globals__get_what_to_profile(globals::in, what_to_profile::out) is det.
-
-:- pred globals__set_what_to_profile(globals::in, what_to_profile::in,
- globals::out) is det.
-
:- pred globals__get_options(globals::in, option_table::out) is det.
-:- pred globals__set_options(globals::in, option_table::in, globals::out)
+:- pred globals__set_what_to_profile(what_to_profile::in,
+ globals::in, globals::out) is det.
+:- pred globals__set_options(option_table::in, globals::in, globals::out)
is det.
:- pred globals__lookup_option(globals::in, option::in, option_data::out)
@@ -87,7 +90,11 @@
%-----------------------------------------------------------------------------%
:- implementation.
-:- import_module map, std_util, string, require.
+
+:- import_module map.
+:- import_module require.
+:- import_module std_util.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -99,20 +106,18 @@
:- type globals
---> globals(
- what_to_profile,
- option_table
+ what_to_profile :: what_to_profile,
+ option_table :: option_table
).
globals__init(Options, globals(user_plus_system_time, Options)).
-globals__get_what_to_profile(globals(WhatToProfile, _), WhatToProfile).
-
-globals__set_what_to_profile(globals(_, A), WhatToProfile,
- globals(WhatToProfile, A)).
-
-globals__get_options(globals(_, Options), Options).
+globals__get_what_to_profile(Globals, Globals ^ what_to_profile).
+globals__get_options(Globals, Globals ^ option_table).
-globals__set_options(globals(A, _), Options, globals(A, Options)).
+globals__set_what_to_profile(WhatToProfile,
+ Globals, Globals ^ what_to_profile := WhatToProfile).
+globals__set_options(Options, Globals, Globals ^ option_table := Options).
globals__lookup_option(Globals, Option, OptionData) :-
globals__get_options(Globals, OptionTable),
@@ -184,7 +189,7 @@
globals__io_get_globals(Globals0, !IO),
globals__get_options(Globals0, OptionTable0),
map__set(OptionTable0, Option, OptionData, OptionTable),
- globals__set_options(Globals0, OptionTable, Globals),
+ globals__set_options(OptionTable, Globals0, Globals),
globals__io_set_globals(Globals, !IO).
%-----------------------------------------------------------------------------%
Index: profiler/mercury_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/mercury_profile.m,v
retrieving revision 1.29
diff -u -b -r1.29 mercury_profile.m
--- profiler/mercury_profile.m 5 Jan 2005 05:09:35 -0000 1.29
+++ profiler/mercury_profile.m 23 Mar 2005 08:02:31 -0000
@@ -33,10 +33,23 @@
:- implementation.
-:- import_module process_file, call_graph, generate_output, propagate, output.
-:- import_module prof_info, prof_debug, options, globals.
-
-:- import_module bool, list, std_util, string, getopt, relation, library.
+:- import_module call_graph.
+:- import_module generate_output.
+:- import_module globals.
+:- import_module options.
+:- import_module output.
+:- import_module process_file.
+:- import_module prof_debug.
+:- import_module prof_info.
+:- import_module propagate.
+
+:- import_module bool.
+:- import_module getopt.
+:- import_module library.
+:- import_module list.
+:- import_module relation.
+:- import_module std_util.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -136,16 +149,19 @@
io__set_output_stream(StdErr, StdOut, !IO),
globals__io_lookup_bool_option(call_graph, CallGraphOpt, !IO),
globals__io_lookup_bool_option(help, Help, !IO),
- ( Help = yes ->
+ (
+ Help = yes,
long_usage(!IO)
;
+ Help = no,
globals__io_lookup_bool_option(verbose, Verbose, !IO),
maybe_write_string(Verbose, "% Processing input files...", !IO),
process_file__main(Prof0, CallGraph0, !IO),
maybe_write_string(Verbose, " done\n", !IO),
- ( CallGraphOpt = yes ->
+ (
+ CallGraphOpt = yes,
maybe_write_string(Verbose, "% Building call graph...",
!IO),
call_graph__main(Args, CallGraph0, CallGraph, !IO),
@@ -156,6 +172,7 @@
propagate__counts(CallGraph, Prof0, Prof, !IO),
maybe_write_string(Verbose, " done\n", !IO)
;
+ CallGraphOpt = no,
Prof = Prof0
),
Index: profiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/options.m,v
retrieving revision 1.17
diff -u -b -r1.17 options.m
--- profiler/options.m 16 Dec 2004 03:17:30 -0000 1.17
+++ profiler/options.m 23 Mar 2005 12:54:34 -0000
@@ -13,8 +13,13 @@
%-----------------------------------------------------------------------------%
:- module options.
+
:- interface.
-:- import_module bool, string, io, getopt.
+
+:- import_module bool.
+:- import_module getopt.
+:- import_module io.
+:- import_module string.
:- type option
% Verbosity options
@@ -55,7 +60,9 @@
%-----------------------------------------------------------------------------%
:- implementation.
-:- import_module std_util, map.
+
+:- import_module std_util.
+:- import_module map.
% Verbosity Options
option_default(verbose, bool(no)).
@@ -176,11 +183,13 @@
%-----------------------------------------------------------------------------%
-maybe_write_string(yes, String) --> io__write_string(String).
-maybe_write_string(no, _) --> [].
-
-maybe_flush_output(yes) --> io__flush_output.
-maybe_flush_output(no) --> [].
+maybe_write_string(yes, String, !IO) :-
+ io__write_string(String, !IO).
+maybe_write_string(no, _, !IO).
+
+maybe_flush_output(yes, !IO) :-
+ io__flush_output(!IO).
+maybe_flush_output(no, !IO).
%-----------------------------------------------------------------------------%
:- end_module options.
Index: profiler/output.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/output.m,v
retrieving revision 1.21
diff -u -b -r1.21 output.m
--- profiler/output.m 2 Dec 2004 08:01:10 -0000 1.21
+++ profiler/output.m 23 Mar 2005 08:05:18 -0000
@@ -18,7 +18,11 @@
:- interface.
:- import_module output_prof_info.
-:- import_module string, int, map, io.
+
+:- import_module int.
+:- import_module io.
+:- import_module map.
+:- import_module string.
:- pred output__main(output::in, map(string, int)::in, io::di, io::uo) is det.
@@ -31,7 +35,12 @@
:- import_module options.
:- import_module generate_output.
-:- import_module assoc_list, bool, float, list, require, std_util.
+:- import_module assoc_list.
+:- import_module bool.
+:- import_module float.
+:- import_module list.
+:- import_module require.
+:- import_module std_util.
%-----------------------------------------------------------------------------%
@@ -43,11 +52,12 @@
Output = output(InfoMap, CallList, FlatList),
globals__io_lookup_bool_option(call_graph, CallGraphOpt, !IO),
- ( CallGraphOpt = yes ->
+ (
+ CallGraphOpt = yes,
output__call_graph_headers(!IO),
output_call_graph(CallList, InfoMap, IndexMap, !IO)
;
- true
+ CallGraphOpt = no
),
output__flat_headers(!IO),
@@ -210,7 +220,10 @@
true
),
- ( CycleParentList = [], ParentList = [] ->
+ (
+ CycleParentList = [],
+ ParentList = []
+ ->
io__format("%67s", [s("<spontaneous>\n")], !IO)
;
list__sort(CycleParentList, SortedCycleParentList),
@@ -365,7 +378,8 @@
map__lookup(InfoMap, LabelName, ProfNode),
map__lookup(IndexMap, LabelName, Index),
(
- ProfNode = output_prof(Name, CycleNum,
+ ProfNode = output_prof(
+ Name, CycleNum,
_Percentage,
Percentage, Self,
Descendant, TotalCalls,
@@ -423,9 +437,7 @@
:- func construct_name(string, int) = string.
construct_name(Name, CycleNum) = FullName :-
- (
- CycleNum = 0
- ->
+ ( CycleNum = 0 ->
FullName = Name
;
string__int_to_string(CycleNum, CycleStr),
Index: profiler/output_prof_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/output_prof_info.m,v
retrieving revision 1.6
diff -u -b -r1.6 output_prof_info.m
--- profiler/output_prof_info.m 2 Dec 2004 08:01:10 -0000 1.6
+++ profiler/output_prof_info.m 23 Mar 2005 08:06:06 -0000
@@ -20,7 +20,11 @@
:- interface.
-:- import_module float, int, list, map, string.
+:- import_module float.
+:- import_module int.
+:- import_module list.
+:- import_module map.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -93,7 +97,6 @@
int % calls to current predicate
).
-
:- type child
---> child(
string, % child name
Index: profiler/process_file.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/process_file.m,v
retrieving revision 1.19
diff -u -b -r1.19 process_file.m
--- profiler/process_file.m 2 Dec 2004 08:01:10 -0000 1.19
+++ profiler/process_file.m 23 Mar 2005 12:59:25 -0000
@@ -20,7 +20,9 @@
:- interface.
:- import_module prof_info.
-:- import_module io, relation.
+
+:- import_module io.
+:- import_module relation.
:- pred process_file__main(prof::out, relation(string)::out, io::di, io::uo)
is det.
@@ -31,9 +33,17 @@
:- implementation.
:- import_module read.
-:- import_module globals, options.
-:- import_module bool, int, require, std_util, string.
-:- import_module list, map.
+:- import_module globals.
+:- import_module options.
+
+:- import_module bool.
+:- import_module int.
+:- import_module list.
+:- import_module map.
+:- import_module require.
+:- import_module std_util.
+:- import_module string.
+:- import_module svmap.
%-----------------------------------------------------------------------------%
@@ -72,18 +82,18 @@
prof_set_entire(Scale, Units, TotalCounts, AddrDeclMap,
ProfNodeMap, CycleMap, Prof),
globals__io_get_globals(Globals0, !IO),
- globals__set_what_to_profile(Globals0, WhatToProfile, Globals),
+ globals__set_what_to_profile(WhatToProfile, Globals0, Globals),
globals__io_set_globals(Globals, !IO),
- ( Dynamic = no ->
+ (
+ Dynamic = no
% maybe_write_string(VVerbose, "\t% Processing "),
% maybe_write_string(VVerbose, LibFile),
% maybe_write_string(VVerbose, "..."),
% process_library_callgraph(_, _),
% maybe_write_string(VVerbose, " done.\n"),
- true
;
- true
+ Dynamic = yes
).
%-----------------------------------------------------------------------------%
@@ -119,7 +129,8 @@
process_addr_decl_2(!AddrDecl, !ProfNodeMap, !IO) :-
maybe_read_label_addr(MaybeLabelAddr, !IO),
- ( MaybeLabelAddr = yes(LabelAddr) ->
+ (
+ MaybeLabelAddr = yes(LabelAddr),
read_label_name(LabelName, !IO),
ProfNode = prof_node_init(LabelName),
map__det_insert(!.AddrDecl, LabelName, LabelAddr, !:AddrDecl),
@@ -140,10 +151,9 @@
),
process_addr_decl_2(!AddrDecl, !ProfNodeMap, !IO)
;
- true
+ MaybeLabelAddr = no
).
-
%-----------------------------------------------------------------------------%
% process_addr:
@@ -172,7 +182,8 @@
io__write_string("': ", !IO),
io__write_string(ErrorMsg, !IO),
io__write_string("\n", !IO),
- io__write_string("The generated profile will only include ", !IO),
+ io__write_string("The generated profile will only include ",
+ !IO),
io__write_string("call counts.\n\n", !IO),
TotalCounts = 0,
% We can use any arbitrary values for WhatToProfile and Scale;
@@ -188,7 +199,8 @@
process_addr_2(!TotalCounts, !ProfNodeMap, !IO) :-
maybe_read_label_addr(MaybeLabelAddr, !IO),
- ( MaybeLabelAddr = yes(LabelAddr) ->
+ (
+ MaybeLabelAddr = yes(LabelAddr),
read_int(Count, !IO),
% Add to initial counts if we have a ProfNode structure
@@ -212,7 +224,7 @@
),
process_addr_2(!TotalCounts, !ProfNodeMap, !IO)
;
- true
+ MaybeLabelAddr = no
).
%-----------------------------------------------------------------------------%
@@ -250,7 +262,8 @@
process_addr_pair_2(Dynamic, !DynamicCallGraph, !ProfNodeMap, !AddrDecl,
!IO) :-
maybe_read_label_addr(MaybeLabelAddr, !IO),
- ( MaybeLabelAddr = yes(CallerAddr) ->
+ (
+ MaybeLabelAddr = yes(CallerAddr),
read_label_addr(CalleeAddr, !IO),
read_int(Count, !IO),
@@ -283,10 +296,11 @@
),
% Insert parent information
- map__set(!.ProfNodeMap, CalleeAddr, CalleeProfNode, !:ProfNodeMap),
+ svmap__set(CalleeAddr, CalleeProfNode, !ProfNodeMap),
% Add edge to call graph if generating dynamic call graph.
- ( Dynamic = yes ->
+ (
+ Dynamic = yes,
relation__add_element(!.DynamicCallGraph,
CallerName, CallerKey, !:DynamicCallGraph),
relation__add_element(!.DynamicCallGraph,
@@ -294,15 +308,14 @@
relation__add(!.DynamicCallGraph, CallerKey,
CalleeKey, !:DynamicCallGraph)
;
- true
+ Dynamic = no
),
process_addr_pair_2(Dynamic, !DynamicCallGraph, !ProfNodeMap,
!AddrDecl, !IO)
;
- true
+ MaybeLabelAddr = no
).
-
%-----------------------------------------------------------------------------%
% process_library_callgraph:
@@ -337,12 +350,13 @@
process_library_callgraph_2(!LibATSort, !LibPredMap, !IO) :-
maybe_read_label_name(MaybeLabelName, !IO),
- ( MaybeLabelName = yes(LabelName) ->
+ (
+ MaybeLabelName = yes(LabelName),
map__det_insert(!.LibPredMap, LabelName, unit, !:LibPredMap),
list__cons(LabelName, !LibATSort),
process_library_callgraph_2(!LibATSort, !LibPredMap, !IO)
;
- true
+ MaybeLabelName = no
).
%-----------------------------------------------------------------------------%
Index: profiler/prof_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/prof_debug.m,v
retrieving revision 1.7
diff -u -b -r1.7 prof_debug.m
--- profiler/prof_debug.m 2 Dec 2004 08:01:11 -0000 1.7
+++ profiler/prof_debug.m 23 Mar 2005 08:10:09 -0000
@@ -12,8 +12,14 @@
%-----------------------------------------------------------------------------%
:- module prof_debug.
+
:- interface.
-:- import_module set, list, string, io, assoc_list.
+
+:- import_module assoc_list.
+:- import_module io.
+:- import_module list.
+:- import_module set.
+:- import_module string.
:- pred output_cliques(list(set(string))::in, io::di, io::uo) is det.
@@ -24,55 +30,50 @@
%-----------------------------------------------------------------------------%
:- implementation.
+
:- import_module std_util.
%-----------------------------------------------------------------------------%
-
% output_cliques
% Used to check that the topological ordering is being done correctly.
-output_cliques([]) --> [].
-output_cliques([C | Cs]) -->
- io__write_string("================================\n"),
- { set__to_sorted_list(C, M) },
- print_list(M),
- output_cliques(Cs).
-
-output_propagate_info(Clique, Parents) -->
- io__write_string("************************\n"),
- io__write_string("Clique\n"),
- print_set(Clique),
- io__write_string("\nParents\n"),
- print_assoc_list(Parents).
-
-
-:- pred print_set(set(string), io__state, io__state).
-:- mode print_set(in, di, uo) is det.
-
-print_set(Set) -->
- { set__to_sorted_list(Set, List) },
- print_list(List).
-
-
-:- pred print_assoc_list(assoc_list(string,int), io__state, io__state).
-:- mode print_assoc_list(in, di, uo) is det.
-
-print_assoc_list([]) --> [].
-print_assoc_list([ A - B | Xs]) -->
- io__write_string(A),
- io__write_string("\t-\t"),
- io__write_int(B),
- io__write_string("\n"),
- print_assoc_list(Xs).
-
-:- pred print_list(list(string), io__state, io__state).
-:- mode print_list(in, di, uo) is det.
-
-print_list([]) --> [].
-print_list([X | Xs]) -->
- io__write_string(X),
- io__write_string("\n"),
- print_list(Xs).
+output_cliques([], !IO).
+output_cliques([C | Cs], !IO) :-
+ io__write_string("================================\n", !IO),
+ set__to_sorted_list(C, M),
+ print_list(M, !IO),
+ output_cliques(Cs, !IO).
+
+output_propagate_info(Clique, Parents, !IO) :-
+ io__write_string("************************\n", !IO),
+ io__write_string("Clique\n", !IO),
+ print_set(Clique, !IO),
+ io__write_string("\nParents\n", !IO),
+ print_assoc_list(Parents, !IO).
+
+:- pred print_set(set(string)::in, io::di, io::uo) is det.
+
+print_set(Set, !IO) :-
+ set__to_sorted_list(Set, List),
+ print_list(List, !IO).
+
+:- pred print_assoc_list(assoc_list(string,int)::in, io::di, io::uo) is det.
+
+print_assoc_list([], !IO).
+print_assoc_list([ A - B | Xs], !IO) :-
+ io__write_string(A, !IO),
+ io__write_string("\t-\t", !IO),
+ io__write_int(B, !IO),
+ io__write_string("\n", !IO),
+ print_assoc_list(Xs, !IO).
+
+:- pred print_list(list(string)::in, io::di, io::uo) is det.
+
+print_list([], !IO).
+print_list([X | Xs], !IO) :-
+ io__write_string(X, !IO),
+ io__write_string("\n", !IO),
+ print_list(Xs, !IO).
%-----------------------------------------------------------------------------%
:- end_module prof_debug.
Index: profiler/prof_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/prof_info.m,v
retrieving revision 1.12
diff -u -b -r1.12 prof_info.m
--- profiler/prof_info.m 2 Dec 2004 08:01:11 -0000 1.12
+++ profiler/prof_info.m 23 Mar 2005 12:59:45 -0000
@@ -20,11 +20,11 @@
:- interface.
-:- import_module list, map.
+:- import_module list.
+:- import_module map.
%-----------------------------------------------------------------------------%
-
% prof: Data structure which contains ALL the relevant info for use
% in generating the output.
:- type prof.
@@ -73,7 +73,6 @@
addrdecl::out, prof_node_map::out, cycle_map::out) is det.
:- pred prof_get_addrdeclmap(prof::in, addrdecl::out) is det.
-
:- pred prof_get_profnodemap(prof::in, prof_node_map::out) is det.
%-----------------------------------------------------------------------------%
@@ -85,7 +84,6 @@
prof_node_map::in, cycle_map::in, prof::out) is det.
:- pred prof_set_profnodemap(prof_node_map::in, prof::in, prof::out) is det.
-
:- pred prof_set_cyclemap(cycle_map::in, prof::in, prof::out) is det.
%-----------------------------------------------------------------------------%
@@ -95,7 +93,6 @@
:- pred prof_node_type(prof_node::in, prof_node_type::out) is det.
-
%-----------------------------------------------------------------------------%
%
% *** Access Predicate for prof_node ***
@@ -109,19 +106,12 @@
int::out, float::out, list(pred_info)::out, int::out, int::out) is det.
:- pred prof_node_get_pred_name(prof_node::in, string::out) is det.
-
:- pred prof_node_get_cycle_number(prof_node::in, int::out) is det.
-
:- pred prof_node_get_initial_counts(prof_node::in, int::out) is det.
-
:- pred prof_node_get_propagated_counts(prof_node::in, float::out) is det.
-
:- pred prof_node_get_parent_list(prof_node::in, list(pred_info)::out) is det.
-
:- pred prof_node_get_child_list(prof_node::in, list(pred_info)::out) is det.
-
:- pred prof_node_get_total_calls(prof_node::in, int::out) is det.
-
:- pred prof_node_get_self_calls(prof_node::in, int::out) is det.
%-----------------------------------------------------------------------------%
@@ -168,149 +158,159 @@
%
:- pred pred_info_get_entire(pred_info::in, string::out, int::out) is det.
-
:- pred pred_info_get_pred_name(pred_info::in, string::out) is det.
-
:- pred pred_info_get_counts(pred_info::in, int::out) is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-
:- implementation.
:- import_module require, std_util.
-:- type prof --->
- prof(
- float, % Scaling factor
- string, % Units
+:- type prof
+ ---> prof(
+ scaling_factor :: float,
+ % Scaling factor.
+
+ units :: string,
+ % Units
% (Each profiling count is
% equivalent to Scale Units)
- int, % Total counts of the profile
- % run
- addrdecl, % Map between label name and
+
+ total_count :: int,
+ % Total counts of the profile
+ % run.
+
+ addr_decl_map :: addrdecl,
+ % Map between label name and
% label addr used to find key
% to look up prof_node_map.
- prof_node_map, % Map between label addresses
+
+ prof_node_map :: prof_node_map,
+ % Map between label addresses
% and all the relevant data
- % about that predicate
- cycle_map % Map between predicate name
+ % about that predicate.
+
+ cycle_map :: cycle_map
+ % Map between predicate name
% and it's cycle number.
).
-
:- type prof_node
- --->
% A node which consists of just one predicate.
- pred_node(
- string, % current predicate (label)
- int, % cycle number
- int, % self counts
- float, % propagated counts
- list(pred_info), % Parent pred and the number
+ ---> pred_node(
+ pred_name :: string,
+ pred_cycle_number :: int,
+ pred_self_counts :: int,
+ pred_propagated_counts :: float,
+
+ pred_parent_list :: list(pred_info),
+ % Parent pred and the number
% of times it calls this
- % predicate
- list(pred_info), % Child pred and the number of
+ % predicate.
+ % XXX
+
+ pred_child_list :: list(pred_info),
+ % Child pred and the number of
% times they are called from
% this predicate.
- int, % total count of times this
+
+ pred_total_calls :: int,
+ % Total count of times this
% predicate called.
- int, % Number of self recursive
- % calls of this routine
- list(string) % Alternative names for this
+
+ pred_self_calls :: int,
+ % Number of self recursive
+ % calls of this routine.
+
+ prd_name_list :: list(string)
+ % Alternative names for this
% predicate eg. Labels with
% different names but the same
% address.
)
- ;
% A node which is built up with more then one predicate
% and is a cycle.
- cycle_node(
- string, % cycle name
- int, % cycle number
- int, % self counts
- float, % propagated counts
- list(pred_info), % Cycle members plus total calls
- % to that predicated
- int, % total count of times this
+ ; cycle_node(
+ cycle_name :: string,
+ cycle_cycle_number :: int,
+ cycle_self_counts :: int,
+ cycle_propagated_counts :: float,
+
+ cycle_members :: list(pred_info),
+ % Cycle members plus total
+ % calls to that predicated
+ % XXX
+
+ cycle_total_calls :: int,
+ % total count of times this
% predicate called.
- int % Number of calls to fellow
- % cycle members
- ).
+ % XXX
-:- type pred_info --->
- pred_info(
- string, % predicate (label)
- int % count (to or from)
+ cycle_self_calls :: int
+ % Number of calls to fellow
+ % cycle members.
).
-:- type junk == unit.
+:- type pred_info
+ ---> pred_info(
+ pred_info_name :: string,
+ % predicate (label)
+ pred_info_count :: int
+ % count (to or from)
+ ).
%-----------------------------------------------------------------------------%
-
-% get_prof_node:
-% Gets the prof_node given a label name.
-%
+ % get_prof_node:
+ % Gets the prof_node given a label name.
+ %
get_prof_node(Pred, AddrMap, ProfNodeMap, ProfNode) :-
map__lookup(AddrMap, Pred, Key),
map__lookup(ProfNodeMap, Key, ProfNode).
-
update_prof_node(Pred, ProfNode, AddrMap, ProfNodeMap0, ProfNodeMap) :-
map__lookup(AddrMap, Pred, Key),
map__det_update(ProfNodeMap0, Key, ProfNode, ProfNodeMap).
-
%-----------------------------------------------------------------------------%
-
% *** Access prof predicates *** %
prof_get_entire(prof(A, B, C, D, E, F), A, B, C, D, E, F).
-prof_get_addrdeclmap(prof(_, _, _, AddrDeclMap, _, _), AddrDeclMap).
-
-prof_get_profnodemap(prof(_, _, _, _, ProfNodeMap, _), ProfNodeMap).
-
+prof_get_addrdeclmap(Prof, Prof ^ addr_decl_map).
+prof_get_profnodemap(Prof, Prof ^ prof_node_map).
%-----------------------------------------------------------------------------%
-
% *** Update prof predicates *** %
prof_set_entire(A, B, C, D, E, F, prof(A, B, C, D, E, F)).
-prof_set_profnodemap(ProfNodeMap, prof(A, B, C, D, _, F),
- prof(A, B, C, D, ProfNodeMap, F)).
-
-prof_set_cyclemap(CycleMap, prof(A, B, C, D, E, _),
- prof(A, B, C, D, E, CycleMap)).
-
+prof_set_profnodemap(ProfNodeMap, Prof, Prof ^ prof_node_map := ProfNodeMap).
+prof_set_cyclemap(CycleMap, Prof, Prof ^ cycle_map := CycleMap).
%-----------------------------------------------------------------------------%
-
% *** Initialise predicates *** %
-prof_node_init(PredName) = pred_node(PredName, 0, 0, 0.0, [], [], 0, 0, []).
-
-prof_node_init_cycle(A, B, C, D, E, F, G) = cycle_node(A, B, C, D, E, F, G).
+prof_node_init(PredName) =
+ pred_node(PredName, 0, 0, 0.0, [], [], 0, 0, []).
+prof_node_init_cycle(A, B, C, D, E, F, G) =
+ cycle_node(A, B, C, D, E, F, G).
%-----------------------------------------------------------------------------%
-
% *** Special prof_node predicates *** %
-prof_node_type(pred_node(_,_,_,_,_,_,_,_,_), predicate).
-prof_node_type(cycle_node(_,_,_,_,_,_,_), cycle).
-
+prof_node_type(pred_node(_, _, _, _, _, _, _, _, _), predicate).
+prof_node_type(cycle_node(_, _, _, _, _, _, _), cycle).
%-----------------------------------------------------------------------------%
-
% *** Access prof_node predicates *** %
prof_node_get_entire_pred(pred_node(A,B,C,D,E,F,G,H,I),A,B,C,D,E,F,G,H,I).
@@ -330,8 +330,7 @@
prof_node_get_initial_counts(pred_node(_, _, Count, _, _, _, _, _, _), Count).
prof_node_get_initial_counts(cycle_node(_, _, Count, _, _, _, _), Count).
-prof_node_get_propagated_counts(pred_node(_, _, _, Count, _, _, _, _, _),
- Count).
+prof_node_get_propagated_counts(pred_node(_, _, _, Count,_,_,_,_,_), Count).
prof_node_get_propagated_counts(cycle_node(_, _, _, Count, _, _, _), Count).
prof_node_get_parent_list(pred_node(_, _, _, _, PList, _, _, _, _), PList).
@@ -348,10 +347,8 @@
prof_node_get_self_calls(pred_node(_, _, _, _, _, _, _, Calls, _), Calls).
prof_node_get_self_calls(cycle_node(_, _, _, _, _, _, Calls), Calls).
-
%-----------------------------------------------------------------------------%
-
% *** Update prof_node predicates *** %
prof_node_set_cycle_num(Cycle, pred_node(A, _, C, D, E, F, G, H, I),
@@ -399,26 +396,20 @@
prof_node_concat_to_member(_, _, pred_node(_, _, _, _, _, _, _, _, _), _) :-
error("prof_node_concat_to_member: pred_node has no members\n").
-
%-----------------------------------------------------------------------------%
-
% *** Init predicates for pred_info *** %
pred_info_init(Name, Count, pred_info(Name, Count)).
-
%-----------------------------------------------------------------------------%
-
% *** Access predicates for pred_info *** %
pred_info_get_entire(pred_info(A, B), A, B).
-pred_info_get_pred_name(pred_info(Name, _), Name).
-
-pred_info_get_counts(pred_info(_, Count), Count).
-
+pred_info_get_pred_name(Pred, Pred ^ pred_info_name).
+pred_info_get_counts(Pred, Pred ^ pred_info_count).
%-----------------------------------------------------------------------------%
:- end_module prof_info.
Index: profiler/propagate.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/propagate.m,v
retrieving revision 1.13
diff -u -b -r1.13 propagate.m
--- profiler/propagate.m 2 Dec 2004 08:01:11 -0000 1.13
+++ profiler/propagate.m 23 Mar 2005 12:43:07 -0000
@@ -23,7 +23,9 @@
:- interface.
:- import_module prof_info.
-:- import_module io, relation.
+
+:- import_module io.
+:- import_module relation.
:- pred propagate__counts(relation(string)::in, prof::in, prof::out,
io::di, io::uo) is det.
@@ -33,8 +35,16 @@
:- implementation.
-:- import_module assoc_list, float, int, list, map, multi_map, require.
-:- import_module string, sparse_bitset, std_util.
+:- import_module assoc_list.
+:- import_module float.
+:- import_module int.
+:- import_module list.
+:- import_module map.
+:- import_module multi_map.
+:- import_module require.
+:- import_module sparse_bitset.
+:- import_module std_util.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -95,7 +105,6 @@
;
DfsRev = [], % This case should never happen
error("propagate.identify_cycles_2: empty list\n")
-
)
->
CycleNum = CycleNum0
Index: profiler/read.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/read.m,v
retrieving revision 1.11
diff -u -b -r1.11 read.m
--- profiler/read.m 2 Dec 2004 08:01:11 -0000 1.11
+++ profiler/read.m 23 Mar 2005 12:43:47 -0000
@@ -1,5 +1,5 @@
%-----------------------------------------------------------------------------%
-% Copyright (C) 1995-1998,2000, 2004 The University of Melbourne.
+% Copyright (C) 1995-1998,2000,2004 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
@@ -16,7 +16,11 @@
:- interface.
:- import_module globals.
-:- import_module int, io, std_util, string.
+
+:- import_module int.
+:- import_module io.
+:- import_module std_util.
+:- import_module string.
%-----------------------------------------------------------------------------%
@@ -44,7 +48,9 @@
:- import_module demangle.
:- import_module options.
-:- import_module bool, list, char.
+:- import_module bool.
+:- import_module char.
+:- import_module list.
:- import_module require.
%-----------------------------------------------------------------------------%
@@ -155,9 +161,7 @@
;
WordResult = error(Error),
error("read_label_name: " ++ io.error_message(Error))
-
).
-
%-----------------------------------------------------------------------------%
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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