[m-rev.] diff: more deep profiler cleanups

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Oct 4 18:20:14 AEST 2006


deep_profiler/*.m:
	Minor cleanups.

Zoltan.

cvs diff: Diffing .
Index: callgraph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/callgraph.m,v
retrieving revision 1.9
diff -u -b -r1.9 callgraph.m
--- callgraph.m	29 Sep 2006 06:15:11 -0000	1.9
+++ callgraph.m	4 Oct 2006 08:02:10 -0000
@@ -53,12 +53,11 @@
 find_cliques(InitDeep, BottomUpPDPtrCliqueList) :-
     make_graph(InitDeep, Graph),
     topological_sort(Graph, TopDownPDICliqueList),
-    %
+
     % Turn each of the sets of PDIs into a list of PDPtrs.  We use foldl here
     % because the list may be very long and map runs out of stack space, and
     % we want the final list in reverse order anyway because the propagation
     % algorithm works bottom up.
-    %
     list.foldl(accumulate_pdptr_lists, TopDownPDICliqueList,
         [], BottomUpPDPtrCliqueList).
 
@@ -133,10 +132,9 @@
 make_clique_indexes(NPDs, CliqueList, Cliques, CliqueIndex) :-
     Cliques = array(CliqueList),
     array.init(NPDs, clique_ptr(-1), CliqueIndex0),
-    %
+
     % For each clique, add entries to the CliqueIndex array, which maps every
     % proc_dynamic_ptr back to the clique to which it belongs.
-    %
     array_foldl_from_1(index_clique, Cliques, CliqueIndex0, CliqueIndex).
 
 :- pred index_clique(int::in, list(proc_dynamic_ptr)::in,
@@ -149,8 +147,6 @@
 :- pred index_clique_member(int::in, proc_dynamic_ptr::in,
     array(clique_ptr)::array_di, array(clique_ptr)::array_uo) is det.
 
-% :- pragma promise_pure(index_clique_member/4).
-
 index_clique_member(CliqueNum, PDPtr, !CliqueIndex) :-
     PDPtr = proc_dynamic_ptr(PDI),
     % impure unsafe_perform_io(write_pdi_cn(PDI, CliqueNum)),
Index: cliques.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/cliques.m,v
retrieving revision 1.7
diff -u -b -r1.7 cliques.m
--- cliques.m	9 Mar 2006 04:56:39 -0000	1.7
+++ cliques.m	4 Oct 2006 08:03:13 -0000
@@ -103,8 +103,6 @@
         mklist(N - 1, Acc1, Acc)
     ).
 
-% :- pragma promise_pure(topological_sort/2).
-
 topological_sort(Graph, TSort) :-
     % impure unsafe_perform_io(io.nl),
     % impure unsafe_perform_io(io.write_string("the graph:\n")),
@@ -202,8 +200,6 @@
 :- pred dfs(list(int)::in, graph::in, visit::array_di, list(int)::in,
     visit::array_uo, list(int)::out) is det.
 
-% :- pragma promise_pure(dfs/6).
-
 dfs([], _Graph, Visit, Dfs, Visit, Dfs).
 dfs([Node | Nodes], Graph, Visit0, Dfs0, Visit, Dfs) :-
     ( dense_bitset.member(Node, Visit0) ->
Index: conf.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/conf.m,v
retrieving revision 1.8
diff -u -b -r1.8 conf.m
--- conf.m	9 Mar 2006 04:56:39 -0000	1.8
+++ conf.m	4 Oct 2006 08:03:40 -0000
@@ -62,10 +62,7 @@
             io.read_file_as_string(TmpStream, TmpReadRes, !IO),
             (
                 TmpReadRes = ok(ServerNameNl),
-                (
-                    string.remove_suffix(ServerNameNl,
-                        "\n", ServerNamePrime)
-                ->
+                ( string.remove_suffix(ServerNameNl, "\n", ServerNamePrime) ->
                     ServerName = ServerNamePrime
                 ;
                     error("malformed server name")
Index: dump.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/dump.m,v
retrieving revision 1.6
diff -u -b -r1.6 dump.m
--- dump.m	4 Oct 2006 06:59:17 -0000	1.6
+++ dump.m	4 Oct 2006 08:05:00 -0000
@@ -24,6 +24,7 @@
 
     % dump_initial_deep(ProfStats, Restrict, DumpCSDs, DumpPDs,
     %   DumpCSSs, DumpPSs, InitialDeep, !IO):
+    %
     % Dump selected parts of InitialDeep to standard output. The array of call
     % site dynamics, proc dynamics, call site statics and proc statics is
     % dumped if the corresponding Dump bool is "yes". If Restrict is "yes",
@@ -256,8 +257,7 @@
         RefinedPSId = PS ^ ps_refined_id
     ),
     io.format("pd%d:\n", [i(Index)], !IO),
-    io.format("\tpd_proc_static = %d (%s)\n", [i(PSI), s(RefinedPSId)],
-        !IO),
+    io.format("\tpd_proc_static = %d (%s)\n", [i(PSI), s(RefinedPSId)], !IO),
     array_foldl_from_0(dump_call_site_array_slot, Sites, !IO),
     io.nl(!IO).
 
@@ -281,8 +281,7 @@
 
 dump_init_call_site_statics(Restriction, CallStatics, !IO) :-
     io.write_string("SECTION CALL SITE STATICS:\n\n", !IO),
-    array_foldl_from_1(dump_call_site_static(Restriction), CallStatics,
-        !IO).
+    array_foldl_from_1(dump_call_site_static(Restriction), CallStatics, !IO).
 
 :- pred dump_call_site_static(restriction::in, int::in, call_site_static::in,
     io::di, io::uo) is det.
@@ -293,8 +292,7 @@
             Restriction = none
         ;
             Restriction = these(_, UsedCallSiteStatics),
-            set.member(call_site_static_ptr(Index),
-                UsedCallSiteStatics)
+            set.member(call_site_static_ptr(Index), UsedCallSiteStatics)
         )
     ->
         CallSiteStatic = call_site_static(ContainerPSPtr, SlotNum,
@@ -347,8 +345,7 @@
             % redundant information.
             true
         ;
-            io.format("\tps_refined_id\t= %s\n",
-                [s(RefinedId)], !IO)
+            io.format("\tps_refined_id\t= %s\n", [s(RefinedId)], !IO)
         ),
         ( RefinedId \= RawId ->
             % The output is too big already; don't include
@@ -357,8 +354,7 @@
         ;
             io.format("\tps_raw_id\t= %s\n", [s(RawId)], !IO)
         ),
-        io.format("\tlocation\t= %s:%d\n",
-            [s(FileName), i(LineNumber)], !IO),
+        io.format("\tlocation\t= %s:%d\n", [s(FileName), i(LineNumber)], !IO),
         (
             InInterface = yes,
             io.write_string("\tin_interface\n", !IO)
Index: exclude.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/exclude.m,v
retrieving revision 1.9
diff -u -b -r1.9 exclude.m
--- exclude.m	20 Sep 2006 09:42:23 -0000	1.9
+++ exclude.m	4 Oct 2006 08:18:57 -0000
@@ -83,12 +83,11 @@
            ).
 
 :- type exclusion_type
-    --->    all_procedures      % Exclude all procedures in the
-                                % named module.
-    ;       internal_procedures.    % Exclude all procedures in the
-                                    % named module, except those
-                                    % which are exported from the
-                                    % module.
+    --->    exclude_all_procedures
+            % Exclude all procedures in the named module.
+    ;       exclude_internal_procedures.
+            % Exclude all procedures in the named module, except those
+            % which are exported from the module.
 
 %-----------------------------------------------------------------------------%
 
@@ -129,18 +128,17 @@
             Words = [Scope, ModuleName],
             (
                 Scope = "all",
-                ExclType = all_procedures
+                ExclType = exclude_all_procedures
             ;
                 Scope = "internal",
-                ExclType = internal_procedures
+                ExclType = exclude_internal_procedures
             )
         ->
             Spec = exclude_spec(ModuleName, ExclType),
             RevSpecs1 = [Spec | RevSpecs0],
             read_exclude_lines(FileName, InputStream, RevSpecs1, Res, !IO)
         ;
-            Msg = string.format(
-                "file %s contains badly formatted line: %s",
+            Msg = string.format("file %s contains badly formatted line: %s",
                 [s(FileName), s(Line)]),
             Res = error(Msg)
         )
@@ -194,9 +192,9 @@
             set.member(ExclSpec, ExcludedSpecs),
             ExclSpec = exclude_spec(ModuleName, ExclType),
             (
-                ExclType = all_procedures
+                ExclType = exclude_all_procedures
             ;
-                ExclType = internal_procedures,
+                ExclType = exclude_internal_procedures,
                 PS ^ ps_in_interface = no
             )
         ->
Index: html_format.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/html_format.m,v
retrieving revision 1.14
diff -u -b -r1.14 html_format.m
--- html_format.m	4 Oct 2006 07:03:54 -0000	1.14
+++ html_format.m	4 Oct 2006 08:01:27 -0000
@@ -212,7 +212,7 @@
 
 select_colgroup_background(Pref, N) = HTML :-
     (
-        Pref ^ pref_colour = column_groups,
+        Pref ^ pref_colour = colour_column_groups,
         ( N /\ 1 = 0 ->
             Background = even_background
         ;
@@ -220,7 +220,7 @@
         ),
         string.format("background: %s", [s(Background)], HTML)
     ;
-        Pref ^ pref_colour = none,
+        Pref ^ pref_colour = colour_none,
         HTML = ""
     ).
 
@@ -252,11 +252,11 @@
     footer_pref_toggles(Cmd, Pref, Deep) ++
     "<br>\n" ++
     string.format("<A HREF=""%s"">Menu</A>\n",
-        [s(deep_cmd_pref_to_url(Pref, Deep, menu))]) ++
+        [s(deep_cmd_pref_to_url(Pref, Deep, deep_cmd_menu))]) ++
     string.format("<A HREF=""%s"">Restart</A>\n",
-        [s(deep_cmd_pref_to_url(Pref, Deep, restart))]) ++
+        [s(deep_cmd_pref_to_url(Pref, Deep, deep_cmd_restart))]) ++
     string.format("<A HREF=""%s"">Quit</A>\n",
-        [s(deep_cmd_pref_to_url(Pref, Deep, quit))]) ++
+        [s(deep_cmd_pref_to_url(Pref, Deep, deep_cmd_quit))]) ++
     "</BODY>\n" ++
     "</HTML>\n".
 
@@ -346,34 +346,35 @@
 
 :- func command_relevant_toggles(cmd) = list(toggle_kind).
 
-command_relevant_toggles(quit) = [].
-command_relevant_toggles(restart) = [].
-command_relevant_toggles(timeout(_)) = [].
-command_relevant_toggles(menu) = [].
-command_relevant_toggles(root(_)) =
-    command_relevant_toggles(clique(1)). % The clique num doesn't matter.
-command_relevant_toggles(clique(_)) =
+command_relevant_toggles(deep_cmd_quit) = [].
+command_relevant_toggles(deep_cmd_restart) = [].
+command_relevant_toggles(deep_cmd_timeout(_)) = [].
+command_relevant_toggles(deep_cmd_menu) = [].
+command_relevant_toggles(deep_cmd_root(_)) =
+    % The clique num doesn't matter.
+    command_relevant_toggles(deep_cmd_clique(1)).
+command_relevant_toggles(deep_cmd_clique(_)) =
     [toggle_fields, toggle_box, toggle_colour, toggle_ancestor_limit,
     toggle_summarize, toggle_order_criteria, toggle_time_format].
-command_relevant_toggles(proc(_)) =
+command_relevant_toggles(deep_cmd_proc(_)) =
     [toggle_fields, toggle_box, toggle_colour, toggle_summarize,
     toggle_order_criteria, toggle_time_format].
-command_relevant_toggles(proc_callers(_, _, _)) =
+command_relevant_toggles(deep_cmd_proc_callers(_, _, _)) =
     [toggle_fields, toggle_box, toggle_colour, toggle_order_criteria,
     toggle_contour, toggle_time_format].
-command_relevant_toggles(modules) =
+command_relevant_toggles(deep_cmd_modules) =
     [toggle_fields, toggle_box, toggle_colour, toggle_order_criteria,
     toggle_time_format, toggle_inactive_modules].
-command_relevant_toggles(module(_)) =
+command_relevant_toggles(deep_cmd_module(_)) =
     [toggle_fields, toggle_box, toggle_colour, toggle_order_criteria,
     toggle_time_format, toggle_inactive_procs].
-command_relevant_toggles(top_procs(_, _, _, _)) =
+command_relevant_toggles(deep_cmd_top_procs(_, _, _, _)) =
     [toggle_fields, toggle_box, toggle_colour, toggle_time_format].
-command_relevant_toggles(proc_static(_)) = [].
-command_relevant_toggles(proc_dynamic(_)) = [].
-command_relevant_toggles(call_site_static(_)) = [].
-command_relevant_toggles(call_site_dynamic(_)) = [].
-command_relevant_toggles(raw_clique(_)) = [].
+command_relevant_toggles(deep_cmd_proc_static(_)) = [].
+command_relevant_toggles(deep_cmd_proc_dynamic(_)) = [].
+command_relevant_toggles(deep_cmd_call_site_static(_)) = [].
+command_relevant_toggles(deep_cmd_call_site_dynamic(_)) = [].
+command_relevant_toggles(deep_cmd_raw_clique(_)) = [].
 
 :- func footer_field_toggle(cmd, preferences, deep) = string.
 
@@ -488,39 +489,39 @@
         Memory1Toggle = string.format("<A HREF=""%s"">%s</A>\n",
             [s(deep_cmd_pref_to_url(Memory1Pref, Deep, Cmd)), s(Memory1Msg)])
     ),
-    ( Fields ^ memory_fields = memory(words) ->
+    ( Fields ^ memory_fields = memory(units_words) ->
         Memory2Toggle = ""
     ;
-        Memory2Fields = Fields ^ memory_fields := memory(words),
+        Memory2Fields = Fields ^ memory_fields := memory(units_words),
         Memory2Pref = Pref ^ pref_fields := Memory2Fields,
         Memory2Msg = "Words",
         Memory2Toggle = string.format("<A HREF=""%s"">%s</A>\n",
             [s(deep_cmd_pref_to_url(Memory2Pref, Deep, Cmd)), s(Memory2Msg)])
     ),
-    ( Fields ^ memory_fields = memory(bytes) ->
+    ( Fields ^ memory_fields = memory(units_bytes) ->
         Memory3Toggle = ""
     ;
-        Memory3Fields = Fields ^ memory_fields := memory(bytes),
+        Memory3Fields = Fields ^ memory_fields := memory(units_bytes),
         Memory3Pref = Pref ^ pref_fields := Memory3Fields,
         Memory3Msg = "Bytes",
         Memory3Toggle = string.format("<A HREF=""%s"">%s</A>\n",
             [s(deep_cmd_pref_to_url(Memory3Pref, Deep, Cmd)), s(Memory3Msg)])
     ),
-    ( Fields ^ memory_fields = memory_and_percall(words) ->
+    ( Fields ^ memory_fields = memory_and_percall(units_words) ->
         Memory4Toggle = ""
     ;
         Memory4Fields = Fields ^ memory_fields :=
-            memory_and_percall(words),
+            memory_and_percall(units_words),
         Memory4Pref = Pref ^ pref_fields := Memory4Fields,
         Memory4Msg = "Words and per-call words",
         Memory4Toggle = string.format("<A HREF=""%s"">%s</A>\n",
             [s(deep_cmd_pref_to_url(Memory4Pref, Deep, Cmd)), s(Memory4Msg)])
     ),
-    ( Fields ^ memory_fields = memory_and_percall(bytes) ->
+    ( Fields ^ memory_fields = memory_and_percall(units_bytes) ->
         Memory5Toggle = ""
     ;
         Memory5Fields = Fields ^ memory_fields :=
-            memory_and_percall(bytes),
+            memory_and_percall(units_bytes),
         Memory5Pref = Pref ^ pref_fields := Memory5Fields,
         Memory5Msg = "Bytes and per-call bytes",
         Memory5Toggle = string.format("<A HREF=""%s"">%s</A>\n",
@@ -633,12 +634,12 @@
 
 footer_colour_toggle(Cmd, Pref, Deep) = HTML :-
     (
-        Pref ^ pref_colour = none,
-        Pref1 = Pref ^ pref_colour := column_groups,
+        Pref ^ pref_colour = colour_none,
+        Pref1 = Pref ^ pref_colour := colour_column_groups,
         Msg1 = "Colour column groups"
     ;
-        Pref ^ pref_colour = column_groups,
-        Pref1 = Pref ^ pref_colour := none,
+        Pref ^ pref_colour = colour_column_groups,
+        Pref1 = Pref ^ pref_colour := colour_none,
         Msg1 = "Fade column groups"
     ),
     HTML = string.format("<A HREF=""%s"">%s</A>\n",
@@ -764,38 +765,38 @@
     update_cost_criteria_func) = string.
 
 toggle_cost_criteria(CostKind, InclDesc, Scope, UpdateCriteria) = Toggles :-
-    ( CostKind \= calls ->
+    ( CostKind \= cost_calls ->
         MsgCalls = "Sort by calls",
         ToggleCalls = string.format("<A HREF=""%s"">%s</A>\n",
-            [s(UpdateCriteria(calls, InclDesc, Scope)), s(MsgCalls)])
+            [s(UpdateCriteria(cost_calls, InclDesc, Scope)), s(MsgCalls)])
     ;
         ToggleCalls = ""
     ),
-    ( CostKind \= redos ->
+    ( CostKind \= cost_redos ->
         MsgRedos = "Sort by redos",
         ToggleRedos = string.format("<A HREF=""%s"">%s</A>\n",
-            [s(UpdateCriteria(redos, InclDesc, Scope)), s(MsgRedos)])
+            [s(UpdateCriteria(cost_redos, InclDesc, Scope)), s(MsgRedos)])
     ;
         ToggleRedos = ""
     ),
-    ( CostKind \= time ->
+    ( CostKind \= cost_time ->
         MsgTime = "Sort by time",
         ToggleTime = string.format("<A HREF=""%s"">%s</A>\n",
-            [s(UpdateCriteria(time, InclDesc, Scope)), s(MsgTime)])
+            [s(UpdateCriteria(cost_time, InclDesc, Scope)), s(MsgTime)])
     ;
         ToggleTime = ""
     ),
-    ( CostKind \= allocs ->
+    ( CostKind \= cost_allocs ->
         MsgAllocs = "Sort by allocations",
         ToggleAllocs = string.format("<A HREF=""%s"">%s</A>\n",
-            [s(UpdateCriteria(allocs, InclDesc, Scope)), s(MsgAllocs)])
+            [s(UpdateCriteria(cost_allocs, InclDesc, Scope)), s(MsgAllocs)])
     ;
         ToggleAllocs = ""
     ),
-    ( CostKind \= words ->
+    ( CostKind \= cost_words ->
         MsgWords = "Sort by words",
         ToggleWords = string.format("<A HREF=""%s"">%s</A>\n",
-            [s(UpdateCriteria(words, InclDesc, Scope)), s(MsgWords)])
+            [s(UpdateCriteria(cost_words, InclDesc, Scope)), s(MsgWords)])
     ;
         ToggleWords = ""
     ),
@@ -834,13 +835,13 @@
 footer_inactive_modules_toggle(Cmd, Pref0, Deep) = HTML :-
     Pref0 ^ pref_inactive = inactive_items(Procs, Modules),
     (
-        Modules = show,
+        Modules = inactive_show,
         Msg  = "Hide inactive modules",
-        Pref = Pref0 ^ pref_inactive := inactive_items(Procs, hide)
+        Pref = Pref0 ^ pref_inactive := inactive_items(Procs, inactive_hide)
     ;
-        Modules = hide,
+        Modules = inactive_hide,
         Msg  = "Show inactive modules",
-        Pref = Pref0 ^ pref_inactive := inactive_items(Procs, show)
+        Pref = Pref0 ^ pref_inactive := inactive_items(Procs, inactive_show)
     ),
     HTML = string.format("<A HREF=""%s"">%s</A>\n",
         [s(deep_cmd_pref_to_url(Pref, Deep, Cmd)), s(Msg)]).
@@ -850,13 +851,13 @@
 footer_inactive_procs_toggle(Cmd, Pref0, Deep) = HTML :-
     Pref0 ^ pref_inactive = inactive_items(Procs, Modules),
     (
-        Procs = show,
+        Procs = inactive_show,
         Msg = "Hide inactive procedures",
-        Pref = Pref0 ^ pref_inactive := inactive_items(hide, Modules)
+        Pref = Pref0 ^ pref_inactive := inactive_items(inactive_hide, Modules)
     ;
-        Procs = hide,
+        Procs = inactive_hide,
         Msg = "Show inactive procedures",
-        Pref = Pref0 ^ pref_inactive := inactive_items(show, Modules)
+        Pref = Pref0 ^ pref_inactive := inactive_items(inactive_show, Modules)
     ),
     HTML = string.format("<A HREF=""%s"">%s</A>\n",
         [s(deep_cmd_pref_to_url(Pref, Deep, Cmd)), s(Msg)]).
@@ -883,7 +884,7 @@
 
 update_cost_criteria_in_top_procs_cmd(Pref, Deep, Limit,
         CostKind, InclDesc, Scope) = HTML :-
-    Cmd = top_procs(Limit, CostKind, InclDesc, Scope),
+    Cmd = deep_cmd_top_procs(Limit, CostKind, InclDesc, Scope),
     HTML = deep_cmd_pref_to_url(Pref, Deep, Cmd).
 
 %-----------------------------------------------------------------------------%
@@ -902,11 +903,11 @@
 
 :- func cost_kind_to_description(cost_kind) = string.
 
-cost_kind_to_description(calls)  = "number of calls".
-cost_kind_to_description(redos)  = "number of redos".
-cost_kind_to_description(time)   = "time".
-cost_kind_to_description(allocs) = "memory allocations".
-cost_kind_to_description(words)  = "words allocated".
+cost_kind_to_description(cost_calls)  = "number of calls".
+cost_kind_to_description(cost_redos)  = "number of redos".
+cost_kind_to_description(cost_time)   = "time".
+cost_kind_to_description(cost_allocs) = "memory allocations".
+cost_kind_to_description(cost_words)  = "words allocated".
 
 :- func incl_desc_to_description(include_descendants) = string.
 
@@ -956,8 +957,8 @@
     ),
     SecondRow0 = "<TR>\n",
     ( show_port_counts(Fields) = yes ->
-        Calls = WrapFunc("Calls", by_cost(calls, self, overall)),
-        Redos = WrapFunc("Redos", by_cost(redos, self, overall)),
+        Calls = WrapFunc("Calls", by_cost(cost_calls, self, overall)),
+        Redos = WrapFunc("Redos", by_cost(cost_redos, self, overall)),
         FirstRow1 = FirstRow0 ++
             "<TH COLSPAN=5>Port counts\n",
         SecondRow1 = SecondRow0 ++
@@ -972,7 +973,7 @@
     ),
     ( show_quanta(Fields) = yes ->
         TicksSelfOverall = WrapFunc("Self",
-            by_cost(time, self, overall)),
+            by_cost(cost_time, self, overall)),
         TicksSelfHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(TicksSelfOverall)]),
         TicksSelfFields = 1
@@ -982,9 +983,11 @@
     ),
     ( show_times(Fields) = yes ->
         ( show_quanta(Fields) = yes ->
-            TimeSelfOverall = WrapFunc("Time", by_cost(time, self, overall))
+            TimeSelfOverall = WrapFunc("Time",
+                by_cost(cost_time, self, overall))
         ;
-            TimeSelfOverall = WrapFunc("Self", by_cost(time, self, overall))
+            TimeSelfOverall = WrapFunc("Self",
+                by_cost(cost_time, self, overall))
         ),
         TimeSelfHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(TimeSelfOverall)]),
@@ -1001,7 +1004,8 @@
         TimeSelfPercentFields = 0
     ),
     ( show_per_times(Fields) = yes ->
-        TimeSelfPerCall = WrapFunc("/call", by_cost(time, self, per_call)),
+        TimeSelfPerCall = WrapFunc("/call",
+            by_cost(cost_time, self, per_call)),
         TimeSelfPerCallHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(TimeSelfPerCall)]),
         TimeSelfPerCallFields = 1
@@ -1011,7 +1015,7 @@
     ),
     ( TotalsDisp = totals_meaningful, show_quanta(Fields) = yes ->
         TicksTotalOverall = WrapFunc("Total",
-            by_cost(time, self_and_desc, overall)),
+            by_cost(cost_time, self_and_desc, overall)),
         TicksTotalHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(TicksTotalOverall)]),
         TicksTotalFields = 1
@@ -1022,10 +1026,10 @@
     ( TotalsDisp = totals_meaningful, show_times(Fields) = yes ->
         ( show_quanta(Fields) = yes ->
             TimeTotalOverall = WrapFunc("Time",
-                by_cost(time, self_and_desc, overall))
+                by_cost(cost_time, self_and_desc, overall))
         ;
             TimeTotalOverall = WrapFunc("Total",
-                by_cost(time, self_and_desc, overall))
+                by_cost(cost_time, self_and_desc, overall))
         ),
         TimeTotalHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(TimeTotalOverall)]),
@@ -1046,7 +1050,7 @@
     ),
     ( TotalsDisp = totals_meaningful, show_per_times(Fields) = yes ->
         TimeTotalPerCall = WrapFunc("/call",
-            by_cost(time, self_and_desc, per_call)),
+            by_cost(cost_time, self_and_desc, per_call)),
         TimeTotalPerCallHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(TimeTotalPerCall)]),
         TimeTotalPerCallFields = 1
@@ -1079,7 +1083,7 @@
     ),
     ( show_alloc(Fields) = yes ->
         AllocsSelfOverall = WrapFunc("Self",
-            by_cost(allocs, self, overall)),
+            by_cost(cost_allocs, self, overall)),
         AllocsSelfHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(AllocsSelfOverall)]) ++
             "<TH ALIGN=RIGHT>%\n",
@@ -1090,7 +1094,7 @@
     ),
     ( show_per_alloc(Fields) = yes ->
         AllocsSelfPerCall = WrapFunc("/call",
-            by_cost(allocs, self, per_call)),
+            by_cost(cost_allocs, self, per_call)),
         AllocsSelfPerCallHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(AllocsSelfPerCall)]),
         AllocsSelfPerCallFields = 1
@@ -1100,7 +1104,7 @@
     ),
     ( TotalsDisp = totals_meaningful, show_alloc(Fields) = yes ->
         AllocsTotalOverall = WrapFunc("Total",
-            by_cost(allocs, self_and_desc, overall)),
+            by_cost(cost_allocs, self_and_desc, overall)),
         AllocsTotalHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(AllocsTotalOverall)]) ++
             "<TH ALIGN=RIGHT>%\n",
@@ -1111,7 +1115,7 @@
     ),
     ( TotalsDisp = totals_meaningful, show_per_alloc(Fields) = yes ->
         AllocsTotalPerCall = WrapFunc("/call",
-            by_cost(allocs, self_and_desc, per_call)),
+            by_cost(cost_allocs, self_and_desc, per_call)),
         AllocsTotalPerCallHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(AllocsTotalPerCall)]),
         AllocsTotalPerCallFields = 1
@@ -1134,7 +1138,7 @@
     ),
     ( show_memory(Fields) = yes(_) ->
         MemorySelfOverall = WrapFunc("Self",
-            by_cost(words, self, overall)),
+            by_cost(cost_words, self, overall)),
         MemorySelfHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(MemorySelfOverall)]) ++
             "<TH ALIGN=RIGHT>%\n",
@@ -1145,7 +1149,7 @@
     ),
     ( show_per_memory(Fields) = yes(_) ->
         MemorySelfPerCall = WrapFunc("/call",
-            by_cost(words, self, per_call)),
+            by_cost(cost_words, self, per_call)),
         MemorySelfPerCallHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(MemorySelfPerCall)]),
         MemorySelfPerCallFields = 1
@@ -1155,7 +1159,7 @@
     ),
     ( TotalsDisp = totals_meaningful, show_memory(Fields) = yes(_) ->
         MemoryTotalOverall = WrapFunc("Total",
-            by_cost(words, self_and_desc, overall)),
+            by_cost(cost_words, self_and_desc, overall)),
         MemoryTotalHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(MemoryTotalOverall)]) ++
             "<TH ALIGN=RIGHT>%\n",
@@ -1166,7 +1170,7 @@
     ),
     ( TotalsDisp = totals_meaningful, show_per_memory(Fields) = yes(_) ->
         MemoryTotalPerCall = WrapFunc("/call",
-            by_cost(words, self_and_desc, per_call)),
+            by_cost(cost_words, self_and_desc, per_call)),
         MemoryTotalPerCallHeading =
             string.format("<TH ALIGN=RIGHT>%s\n", [s(MemoryTotalPerCall)]),
         MemoryTotalPerCallFields = 1
@@ -1182,12 +1186,12 @@
         MemoryTotalHeading ++ MemoryTotalPerCallHeading,
     ( show_memory(Fields) = yes(Units) ->
         (
-            Units = words,
+            Units = units_words,
             FirstRow4 = FirstRow3 ++
                 string.format("<TH COLSPAN=%d>Memory words\n",
                     [i(MemoryFields)])
         ;
-            Units = bytes,
+            Units = units_bytes,
             FirstRow4 = FirstRow3 ++
                 string.format("<TH COLSPAN=%d>Memory bytes\n",
                     [i(MemoryFields)])
@@ -1394,11 +1398,11 @@
 
     ( show_memory(Fields) = yes(Unit) ->
         (
-            Unit = words,
+            Unit = units_words,
             OwnMemory = OwnWords,
             TotalMemory = TotalWords
         ;
-            Unit = bytes,
+            Unit = units_bytes,
             WordSize = Deep ^ profile_stats ^ word_size,
             OwnMemory = OwnWords * WordSize,
             TotalMemory = TotalWords * WordSize
@@ -1855,20 +1859,20 @@
 
 proc_static_to_html_ref(Pref, Deep, PSPtr) = HTML :-
     PSPtr = proc_static_ptr(PSI),
-    URL = deep_cmd_pref_to_url(Pref, Deep, proc(PSI)),
+    URL = deep_cmd_pref_to_url(Pref, Deep, deep_cmd_proc(PSI)),
     deep_lookup_proc_statics(Deep, PSPtr, PS),
     ProcName = PS ^ ps_refined_id,
     HTML = string.format("<A HREF=""%s"">%s</A>",
         [s(URL), s(escape_html_string(ProcName))]).
 
 module_name_to_html_ref(Pref, Deep, ModuleName) = HTML :-
-    URL = deep_cmd_pref_to_url(Pref, Deep, module(ModuleName)),
+    URL = deep_cmd_pref_to_url(Pref, Deep, deep_cmd_module(ModuleName)),
     HTML = string.format("<A HREF=""%s"">%s</A>",
         [s(URL), s(escape_html_string(ModuleName))]).
 
 clique_ptr_to_html_ref(Pref, Deep, ProcName, CliquePtr) = HTML :-
     CliquePtr = clique_ptr(CliqueNum),
-    URL = deep_cmd_pref_to_url(Pref, Deep, clique(CliqueNum)),
+    URL = deep_cmd_pref_to_url(Pref, Deep, deep_cmd_clique(CliqueNum)),
     HTML = string.format("<A HREF=""%s"">%s</A>",
         [s(URL), s(escape_html_string(ProcName))]).
 
Index: interface.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/interface.m,v
retrieving revision 1.13
diff -u -b -r1.13 interface.m
--- interface.m	29 Mar 2006 08:07:40 -0000	1.13
+++ interface.m	4 Oct 2006 08:01:34 -0000
@@ -55,9 +55,9 @@
 
 %-----------------------------------------------------------------------------%
 
-    % These functions derive the names of auxiliary files (or parts
-    % thereof) from the name of the profiling data file being explored.
-    % The auxiliary files are:
+    % These functions derive the names of auxiliary files (or parts thereof)
+    % from the name of the profiling data file being explored. The auxiliary
+    % files are:
     %
     % - the name of the named pipe for transmitting queries to the server;
     % - the name of the named pipe for transmitting responses back to the
@@ -83,27 +83,29 @@
 :- func contour_file_name(string) = string.
 
     % send_term(ToFileName, Debug, Term):
+    %
     %   Write the term Term to ToFileName, making it is new contents.
-    %   If Debug is `yes', write it to the file `/tmp/.send_term'
-    %   as well.
+    % If Debug is `yes', write it to the file `/tmp/.send_term' as well.
     %
 :- pred send_term(string::in, bool::in, T::in, 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.
+    % If Debug is `yes', write it to the file `/tmp/.send_string' as well.
     %
 :- pred send_string(string::in, bool::in, string::in, 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.
+    %
+    % 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::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.
@@ -119,26 +121,26 @@
     --->    cmd_pref(cmd, preferences).
 
 :- type cmd
-    --->    quit
-    ;       restart
-    ;       timeout(int)
-    ;       menu
-    ;       root(maybe(int))
-    ;       clique(int)
-    ;       proc(int)
-    ;       proc_callers(int, caller_groups, int)
-    ;       modules
-    ;       module(string)
-    ;       top_procs(display_limit, cost_kind, include_descendants,
+    --->    deep_cmd_quit
+    ;       deep_cmd_restart
+    ;       deep_cmd_timeout(int)
+    ;       deep_cmd_menu
+    ;       deep_cmd_root(maybe(int))
+    ;       deep_cmd_clique(int)
+    ;       deep_cmd_proc(int)
+    ;       deep_cmd_proc_callers(int, caller_groups, int)
+    ;       deep_cmd_modules
+    ;       deep_cmd_module(string)
+    ;       deep_cmd_top_procs(display_limit, cost_kind, include_descendants,
                 measurement_scope)
     %
     % The following commands are for debugging.
     %
-    ;       proc_static(int)
-    ;       proc_dynamic(int)
-    ;       call_site_static(int)
-    ;       call_site_dynamic(int)
-    ;       raw_clique(int).
+    ;       deep_cmd_proc_static(int)
+    ;       deep_cmd_proc_dynamic(int)
+    ;       deep_cmd_call_site_static(int)
+    ;       deep_cmd_call_site_dynamic(int)
+    ;       deep_cmd_raw_clique(int).
 
 :- type caller_groups
     --->    group_by_call_site
@@ -147,11 +149,11 @@
     ;       group_by_clique.
 
 :- type cost_kind
-    --->    calls
-    ;       redos
-    ;       time
-    ;       allocs
-    ;       words.
+    --->    cost_calls
+    ;       cost_redos
+    ;       cost_time
+    ;       cost_allocs
+    ;       cost_words.
 
 :- type include_descendants
     --->    self
@@ -159,40 +161,41 @@
 
 :- type display_limit
     --->    rank_range(int, int)
-                    % rank_range(M, N): display procedures
-                    % with rank M to N, both inclusive.
+            % rank_range(M, N): display procedures with rank M to N,
+            % both inclusive.
 
     ;       threshold(float).
-                    % threshold(Percent): display
-                    % procedures whose cost is at least
-                    % Fraction of the whole program's
-                    % cost.
+            % threshold(Percent): display procedures whose cost is at least
+            % Percent% of the whole program's cost.
 
 :- type preferences
     ---> preferences(
+            % The set of fields to display.
             pref_fields :: fields,
-                    % set of fields to display
+
+            % Whether displays should be boxed.
             pref_box    :: box,
-                    % whether displays should be boxed
+
+            % What principle governs colours.
             pref_colour :: colour_scheme,
-                    % what principle governs colours
+
+            % The max number of ancestors to display.
             pref_anc    :: maybe(int),
-                    % max number of ancestors to display
+
+            % Whether pages should summarize at higher order call sites.
             pref_summarize  :: summarize,
-                    % whether pages should summarize
-                    % at higher order call sites
+
+            % The criteria for ordering lines in pages, if the command
+            % doesn't specify otherwise.
             pref_criteria   :: order_criteria,
-                    % the criteria for ordering lines in
-                    % pages, if the command doesn't specify
-                    % otherwise
+
+            % Whether contour exclusion should be applied.
             pref_contour :: contour,
-                    % whether contour exclusion should be
-                    % applied
+
             pref_time :: time_format,
 
+            % Whether we should show modules/procs that haven't been called.
             pref_inactive :: inactive_items
-                    % Whether we should show modules/procs
-                    % that haven't been called.
         ).
 
 :- type port_fields
@@ -218,8 +221,8 @@
     ;       memory_and_percall(memory_units).
 
 :- type memory_units
-    --->    words
-    ;       bytes.
+    --->    units_words
+    ;       units_bytes.
 
 :- type fields
     --->    fields(
@@ -234,8 +237,8 @@
     ;       nobox.
 
 :- type colour_scheme
-    --->    column_groups
-    ;       none.
+    --->    colour_column_groups
+    ;       colour_none.
 
 :- type summarize
     --->    summarize
@@ -263,7 +266,9 @@
     ;       scale_by_millions
     ;       scale_by_thousands.
 
-:- type inactive_status ---> hide ; show.
+:- type inactive_status
+    --->    inactive_hide
+    ;       inactive_show.
 
 :- type inactive_items
     --->    inactive_items(
@@ -324,19 +329,20 @@
         default_inactive_items
     ).
 
-default_fields = fields(port, ticks, no_alloc, memory(words)).
-all_fields = fields(port, ticks_and_time_and_percall, alloc, memory(words)).
+default_fields = fields(port, ticks, no_alloc, memory(units_words)).
+all_fields =
+    fields(port, ticks_and_time_and_percall, alloc, memory(units_words)).
 default_box = box.
-default_colour_scheme = column_groups.
+default_colour_scheme = colour_column_groups.
 default_ancestor_limit = yes(5).
 default_summarize = dont_summarize.
 default_order_criteria = by_context.
-default_cost_kind = time.
+default_cost_kind = cost_time.
 default_incl_desc = self_and_desc.
 default_scope = overall.
 default_contour = no_contour.
 default_time_format = scale_by_thousands.
-default_inactive_items = inactive_items(show, show).
+default_inactive_items = inactive_items(inactive_show, inactive_show).
 
 %-----------------------------------------------------------------------------%
 
@@ -526,20 +532,20 @@
 
 cmd_to_string(Cmd) = CmdStr :-
     (
-        Cmd = quit,
+        Cmd = deep_cmd_quit,
         CmdStr = "quit"
     ;
-        Cmd = restart,
+        Cmd = deep_cmd_restart,
         CmdStr = "restart"
     ;
-        Cmd = timeout(Minutes),
+        Cmd = deep_cmd_timeout(Minutes),
         CmdStr = string.format("timeout%c%d",
             [c(cmd_separator_char), i(Minutes)])
     ;
-        Cmd = menu,
+        Cmd = deep_cmd_menu,
         CmdStr = "menu"
     ;
-        Cmd = root(MaybePercent),
+        Cmd = deep_cmd_root(MaybePercent),
         (
             MaybePercent = yes(Percent),
             CmdStr = string.format("root%c%d",
@@ -550,29 +556,29 @@
                 [c(cmd_separator_char), s("no")])
         )
     ;
-        Cmd = clique(CliqueNum),
+        Cmd = deep_cmd_clique(CliqueNum),
         CmdStr = string.format("clique%c%d",
             [c(cmd_separator_char), i(CliqueNum)])
     ;
-        Cmd = proc(ProcNum),
+        Cmd = deep_cmd_proc(ProcNum),
         CmdStr = string.format("proc%c%d",
             [c(cmd_separator_char), i(ProcNum)])
     ;
-        Cmd = proc_callers(ProcNum, GroupCallers, BunchNum),
+        Cmd = deep_cmd_proc_callers(ProcNum, GroupCallers, BunchNum),
         GroupCallersStr = caller_groups_to_string(GroupCallers),
         CmdStr = string.format("proc_callers%c%d%c%s%c%d",
             [c(cmd_separator_char), i(ProcNum),
             c(cmd_separator_char), s(GroupCallersStr),
             c(cmd_separator_char), i(BunchNum)])
     ;
-        Cmd = modules,
+        Cmd = deep_cmd_modules,
         CmdStr = "modules"
     ;
-        Cmd = module(ModuleName),
+        Cmd = deep_cmd_module(ModuleName),
         CmdStr = string.format("module%c%s",
             [c(cmd_separator_char), s(ModuleName)])
     ;
-        Cmd = top_procs(Limit, CostKind, InclDesc, Scope),
+        Cmd = deep_cmd_top_procs(Limit, CostKind, InclDesc, Scope),
         LimitStr = limit_to_string(Limit),
         CostKindStr = cost_kind_to_string(CostKind),
         InclDescStr = incl_desc_to_string(InclDesc),
@@ -583,23 +589,23 @@
             c(cmd_separator_char), s(InclDescStr),
             c(cmd_separator_char), s(ScopeStr)])
     ;
-        Cmd = proc_static(PSI),
+        Cmd = deep_cmd_proc_static(PSI),
         CmdStr = string.format("proc_static%c%d",
             [c(cmd_separator_char), i(PSI)])
     ;
-        Cmd = proc_dynamic(PDI),
+        Cmd = deep_cmd_proc_dynamic(PDI),
         CmdStr = string.format("proc_dynamic%c%d",
             [c(cmd_separator_char), i(PDI)])
     ;
-        Cmd = call_site_static(CSSI),
+        Cmd = deep_cmd_call_site_static(CSSI),
         CmdStr = string.format("call_site_static%c%d",
             [c(cmd_separator_char), i(CSSI)])
     ;
-        Cmd = call_site_dynamic(CSDI),
+        Cmd = deep_cmd_call_site_dynamic(CSDI),
         CmdStr = string.format("call_site_dynamic%c%d",
             [c(cmd_separator_char), i(CSDI)])
     ;
-        Cmd = raw_clique(CI),
+        Cmd = deep_cmd_raw_clique(CI),
         CmdStr = string.format("raw_clique%c%d",
             [c(cmd_separator_char), i(CI)])
     ).
@@ -651,32 +657,32 @@
             fail
         )
     ->
-        MaybeCmd = yes(root(MaybePercent))
+        MaybeCmd = yes(deep_cmd_root(MaybePercent))
     ;
         Pieces = ["clique", CliqueNumStr],
         string.to_int(CliqueNumStr, CliqueNum)
     ->
-        MaybeCmd = yes(clique(CliqueNum))
+        MaybeCmd = yes(deep_cmd_clique(CliqueNum))
     ;
         Pieces = ["proc", PSIStr],
         string.to_int(PSIStr, PSI)
     ->
-        MaybeCmd = yes(proc(PSI))
+        MaybeCmd = yes(deep_cmd_proc(PSI))
     ;
         Pieces = ["proc_callers", PSIStr, GroupCallersStr, BunchNumStr],
         string.to_int(PSIStr, PSI),
         string.to_int(BunchNumStr, BunchNum),
         string_to_caller_groups(GroupCallersStr, GroupCallers)
     ->
-        MaybeCmd = yes(proc_callers(PSI, GroupCallers, BunchNum))
+        MaybeCmd = yes(deep_cmd_proc_callers(PSI, GroupCallers, BunchNum))
     ;
         Pieces = ["modules"]
     ->
-        MaybeCmd = yes(modules)
+        MaybeCmd = yes(deep_cmd_modules)
     ;
         Pieces = ["module", ModuleName]
     ->
-        MaybeCmd = yes(module(ModuleName))
+        MaybeCmd = yes(deep_cmd_module(ModuleName))
     ;
         Pieces = ["top_procs", LimitStr,
             CostKindStr, InclDescStr, ScopeStr],
@@ -685,49 +691,49 @@
         string_to_incl_desc(InclDescStr, InclDesc),
         string_to_scope(ScopeStr, Scope)
     ->
-        MaybeCmd = yes(top_procs(Limit, CostKind, InclDesc, Scope))
+        MaybeCmd = yes(deep_cmd_top_procs(Limit, CostKind, InclDesc, Scope))
     ;
         Pieces = ["menu"]
     ->
-        MaybeCmd = yes(menu)
+        MaybeCmd = yes(deep_cmd_menu)
     ;
         Pieces = ["proc_static", PSIStr],
         string.to_int(PSIStr, PSI)
     ->
-        MaybeCmd = yes(proc_static(PSI))
+        MaybeCmd = yes(deep_cmd_proc_static(PSI))
     ;
         Pieces = ["proc_dynamic", PDIStr],
         string.to_int(PDIStr, PDI)
     ->
-        MaybeCmd = yes(proc_dynamic(PDI))
+        MaybeCmd = yes(deep_cmd_proc_dynamic(PDI))
     ;
         Pieces = ["call_site_static", CSSIStr],
         string.to_int(CSSIStr, CSSI)
     ->
-        MaybeCmd = yes(call_site_static(CSSI))
+        MaybeCmd = yes(deep_cmd_call_site_static(CSSI))
     ;
         Pieces = ["call_site_dynamic", CSDIStr],
         string.to_int(CSDIStr, CSDI)
     ->
-        MaybeCmd = yes(call_site_dynamic(CSDI))
+        MaybeCmd = yes(deep_cmd_call_site_dynamic(CSDI))
     ;
         Pieces = ["raw_clique", CliqueNumStr],
         string.to_int(CliqueNumStr, CliqueNum)
     ->
-        MaybeCmd = yes(raw_clique(CliqueNum))
+        MaybeCmd = yes(deep_cmd_raw_clique(CliqueNum))
     ;
         Pieces = ["timeout", TimeOutStr],
         string.to_int(TimeOutStr, TimeOut)
     ->
-        MaybeCmd = yes(timeout(TimeOut))
+        MaybeCmd = yes(deep_cmd_timeout(TimeOut))
     ;
         Pieces = ["restart"]
     ->
-        MaybeCmd = yes(restart)
+        MaybeCmd = yes(deep_cmd_restart)
     ;
         Pieces = ["quit"]
     ->
-        MaybeCmd = yes(quit)
+        MaybeCmd = yes(deep_cmd_quit)
     ;
         MaybeCmd = no
     ).
@@ -754,9 +760,8 @@
         string_to_time_format(TimeStr, Time),
         string_to_inactive_items(InactiveItemsStr, InactiveItems)
     ->
-        Preferences = preferences(Fields, Box, Colour,
-            MaybeAncestorLimit, Summarize, Order, Contour, Time,
-            InactiveItems),
+        Preferences = preferences(Fields, Box, Colour, MaybeAncestorLimit,
+            Summarize, Order, Contour, Time, InactiveItems),
         MaybePreferences = yes(Preferences)
     ;
         MaybePreferences = no
@@ -815,10 +820,10 @@
 :- mode string_to_memory_fields(out, in) is det.
 
 string_to_memory_fields("_",  no_memory).
-string_to_memory_fields("b",  memory(bytes)).
-string_to_memory_fields("w",  memory(words)).
-string_to_memory_fields("bp", memory_and_percall(bytes)).
-string_to_memory_fields("wp", memory_and_percall(words)).
+string_to_memory_fields("b",  memory(units_bytes)).
+string_to_memory_fields("w",  memory(units_words)).
+string_to_memory_fields("bp", memory_and_percall(units_bytes)).
+string_to_memory_fields("wp", memory_and_percall(units_words)).
 
 :- func fields_to_string(fields) = string.
 
@@ -870,11 +875,11 @@
 :- mode string_to_cost_kind(in, out) is semidet.
 :- mode string_to_cost_kind(out, in) is det.
 
-string_to_cost_kind("calls",  calls).
-string_to_cost_kind("redos",  redos).
-string_to_cost_kind("time",   time).
-string_to_cost_kind("allocs", allocs).
-string_to_cost_kind("words",  words).
+string_to_cost_kind("calls",  cost_calls).
+string_to_cost_kind("redos",  cost_redos).
+string_to_cost_kind("time",   cost_time).
+string_to_cost_kind("allocs", cost_allocs).
+string_to_cost_kind("words",  cost_words).
 
 :- func incl_desc_to_string(include_descendants) = string.
 
@@ -1006,10 +1011,10 @@
 :- mode string_to_inactive_items(in, out) is semidet.
 :- mode string_to_inactive_items(out, in) is det.
 
-string_to_inactive_items("hh", inactive_items(hide,  hide)).
-string_to_inactive_items("sh", inactive_items(show,  hide)).
-string_to_inactive_items("hs", inactive_items(hide,  show)).
-string_to_inactive_items("ss", inactive_items(show,  show)).
+string_to_inactive_items("hh", inactive_items(inactive_hide, inactive_hide)).
+string_to_inactive_items("sh", inactive_items(inactive_show, inactive_hide)).
+string_to_inactive_items("hs", inactive_items(inactive_hide, inactive_show)).
+string_to_inactive_items("ss", inactive_items(inactive_show, inactive_show)).
 
 :- func colour_scheme_to_string(colour_scheme) = string.
 
@@ -1020,8 +1025,8 @@
 :- mode string_to_colour_scheme(in, out) is semidet.
 :- mode string_to_colour_scheme(out, in) is det.
 
-string_to_colour_scheme("cols", column_groups).
-string_to_colour_scheme("none", none).
+string_to_colour_scheme("cols", colour_column_groups).
+string_to_colour_scheme("none", colour_none).
 
 :- func box_to_string(box) = string.
 
Index: mdprof_cgi.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_cgi.m,v
retrieving revision 1.15
diff -u -b -r1.15 mdprof_cgi.m
--- mdprof_cgi.m	8 Jun 2006 02:53:20 -0000	1.15
+++ mdprof_cgi.m	4 Oct 2006 07:58:03 -0000
@@ -74,13 +74,13 @@
         ),
         split(QueryString0, query_separator_char, Pieces),
         ( Pieces = [CmdStr, PrefStr, FileName] ->
-            Cmd = url_component_to_cmd(CmdStr, menu),
+            Cmd = url_component_to_cmd(CmdStr, deep_cmd_menu),
             process_query(Cmd, yes(PrefStr), FileName, Options, !IO)
         ; Pieces = [CmdStr, FileName] ->
-            Cmd = url_component_to_cmd(CmdStr, menu),
+            Cmd = url_component_to_cmd(CmdStr, deep_cmd_menu),
             process_query(Cmd, no, FileName, Options, !IO)
         ; Pieces = [FileName] ->
-            process_query(menu, no, FileName, Options, !IO)
+            process_query(deep_cmd_menu, no, FileName, Options, !IO)
         ;
             io.set_exit_status(1, !IO),
             % Give the simplest URL in the error message.
@@ -448,18 +448,18 @@
         MaybeStartupStream = no
     ),
     CmdPref0 = cmd_pref(Cmd0, Pref0),
-    ( Cmd0 = restart ->
+    ( Cmd0 = deep_cmd_restart ->
         read_and_startup(Deep0 ^ server_name, [Deep0 ^ data_file_name],
             Canonical, MaybeStartupStream, [], MaybeDeep, !IO),
         (
             MaybeDeep = ok(Deep),
             MaybeMsg = no,
-            Cmd = menu
+            Cmd = deep_cmd_menu
         ;
             MaybeDeep = error(ErrorMsg),
             MaybeMsg = yes(ErrorMsg),
             Deep = Deep0,
-            Cmd = quit
+            Cmd = deep_cmd_quit
         )
     ;
         Deep = Deep0,
@@ -495,13 +495,13 @@
         MaybeStartupStream = no
     ),
 
-    ( Cmd = quit ->
+    ( Cmd = deep_cmd_quit ->
         % The lack of a recursive call here shuts down the server.
         %
         % This deletes all the files created by the process, including
         % WantFile and MutexFile, with MutexFile being deleted last.
         delete_cleanup_files(!IO)
-    ; Cmd = timeout(TimeOut) ->
+    ; Cmd = deep_cmd_timeout(TimeOut) ->
         server_loop(ToServerPipe, FromServerPipe, TimeOut, MaybeStartupStream,
             Debug, Canonical, QueryNum, Deep, !IO)
     ;
@@ -726,17 +726,17 @@
     lookup_int_option(Options, clique, CliqueNum),
     lookup_int_option(Options, proc, ProcNum),
     ( Root = yes ->
-        Cmd = root(no)
+        Cmd = deep_cmd_root(no)
     ; Modules = yes ->
-        Cmd = modules
+        Cmd = deep_cmd_modules
     ; CliqueNum > 0 ->
-        Cmd = clique(CliqueNum)
+        Cmd = deep_cmd_clique(CliqueNum)
     ; ProcNum > 0 ->
-        Cmd = proc(ProcNum)
+        Cmd = deep_cmd_proc(ProcNum)
     ; Quit = yes ->
-        Cmd = quit
+        Cmd = deep_cmd_quit
     ;
-        Cmd = menu
+        Cmd = deep_cmd_menu
     ).
 
 %-----------------------------------------------------------------------------%
Index: mdprof_test.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_test.m,v
retrieving revision 1.11
diff -u -b -r1.11 mdprof_test.m
--- mdprof_test.m	29 Mar 2006 08:07:40 -0000	1.11
+++ mdprof_test.m	4 Oct 2006 07:42:01 -0000
@@ -226,7 +226,7 @@
 
 test_cliques(Cur, Max, DirName, Pref, Deep, !IO) :-
     ( Cur =< Max ->
-        try_exec(clique(Cur), Pref, Deep, HTML, !IO),
+        try_exec(deep_cmd_clique(Cur), Pref, Deep, HTML, !IO),
         write_test_html(DirName, "clique", Cur, HTML, !IO),
         test_cliques(Cur + 1, Max, DirName, Pref, Deep, !IO)
     ;
@@ -238,7 +238,7 @@
 
 test_procs(Cur, Max, DirName, Pref, Deep, !IO) :-
     ( Cur =< Max ->
-        try_exec(proc(Cur), Pref, Deep, HTML, !IO),
+        try_exec(deep_cmd_proc(Cur), Pref, Deep, HTML, !IO),
         write_test_html(DirName, "proc", Cur, HTML, !IO),
         test_procs(Cur + 1, Max, DirName, Pref, Deep, !IO)
     ;
Index: query.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/query.m,v
retrieving revision 1.13
diff -u -b -r1.13 query.m
--- query.m	29 Sep 2006 06:15:11 -0000	1.13
+++ query.m	4 Oct 2006 08:15:08 -0000
@@ -68,29 +68,27 @@
         ;
             Msg = "unknown exception"
         ),
-        HTML = string.format(
-                "<H3>AN EXCEPTION HAS OCCURRED: %s</H3>\n",
+        HTML = string.format("<H3>AN EXCEPTION HAS OCCURRED: %s</H3>\n",
                 [s(Msg)])
     ).
 
 :- pred exec(cmd::in, preferences::in, deep::in, string::out,
     io::di, io::uo) is det.
 
-exec(restart, _Pref, _Deep, _HTML, !IO) :-
+exec(deep_cmd_restart, _Pref, _Deep, _HTML, !IO) :-
     % Our caller is supposed to filter out restart commands.
     error("exec: found restart command").
-exec(quit, _Pref, Deep, HTML, !IO) :-
+exec(deep_cmd_quit, _Pref, Deep, HTML, !IO) :-
     HTML = string.format(
         "<H3>Shutting down deep profile server for %s.</H3>\n",
         [s(Deep ^ data_file_name)]).
-exec(timeout(TimeOut), _Pref, _Deep, HTML, !IO) :-
-    HTML = string.format("<H3>Timeout set to %d minutes</H3>\n",
-        [i(TimeOut)]).
+exec(deep_cmd_timeout(TimeOut), _Pref, _Deep, HTML, !IO) :-
+    HTML = string.format("<H3>Timeout set to %d minutes</H3>\n", [i(TimeOut)]).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = menu,
+    Cmd = deep_cmd_menu,
     HTML = generate_menu_page(Cmd, Pref, Deep).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = root(MaybePercent),
+    Cmd = deep_cmd_root(MaybePercent),
     deep_lookup_clique_index(Deep, Deep ^ root, RootCliquePtr),
     RootCliquePtr = clique_ptr(RootCliqueNum),
     (
@@ -101,7 +99,7 @@
         generate_clique_page(Cmd, RootCliqueNum, Pref, Deep, HTML, 100, _)
     ).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = clique(CliqueNum),
+    Cmd = deep_cmd_clique(CliqueNum),
     CliquePtr = clique_ptr(CliqueNum),
     ( valid_clique_ptr(Deep, CliquePtr) ->
         generate_clique_page(Cmd, CliqueNum, Pref, Deep, HTML, 100, _)
@@ -112,7 +110,7 @@
             page_footer(Cmd, Pref, Deep)
     ).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = proc(PSI),
+    Cmd = deep_cmd_proc(PSI),
     PSPtr = proc_static_ptr(PSI),
     ( valid_proc_static_ptr(Deep, PSPtr) ->
         HTML = generate_proc_page(Cmd, PSPtr, Pref, Deep)
@@ -123,7 +121,7 @@
             page_footer(Cmd, Pref, Deep)
     ).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = proc_callers(PSI, CallerGroups, BunchNum),
+    Cmd = deep_cmd_proc_callers(PSI, CallerGroups, BunchNum),
     PSPtr = proc_static_ptr(PSI),
     ( valid_proc_static_ptr(Deep, PSPtr) ->
         generate_proc_callers_page(Cmd, PSPtr, CallerGroups, BunchNum,
@@ -135,10 +133,10 @@
             page_footer(Cmd, Pref, Deep)
     ).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = modules,
+    Cmd = deep_cmd_modules,
     HTML = generate_modules_page(Cmd, Pref, Deep).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = module(ModuleName),
+    Cmd = deep_cmd_module(ModuleName),
     ( map.search(Deep ^ module_data, ModuleName, ModuleData) ->
         HTML = generate_module_page(Cmd, ModuleName, ModuleData, Pref, Deep)
     ;
@@ -148,18 +146,18 @@
             page_footer(Cmd, Pref, Deep)
     ).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
-    Cmd = top_procs(Limit, CostKind, InclDesc, Scope),
+    Cmd = deep_cmd_top_procs(Limit, CostKind, InclDesc, Scope),
     HTML = generate_top_procs_page(Cmd, Limit, CostKind, InclDesc, Scope,
         Pref, Deep).
-exec(proc_static(PSI), _Pref, Deep, HTML, !IO) :-
+exec(deep_cmd_proc_static(PSI), _Pref, Deep, HTML, !IO) :-
     HTML = generate_proc_static_debug_page(PSI, Deep).
-exec(proc_dynamic(PDI), _Pref, Deep, HTML, !IO) :-
+exec(deep_cmd_proc_dynamic(PDI), _Pref, Deep, HTML, !IO) :-
     HTML = generate_proc_dynamic_debug_page(PDI, Deep).
-exec(call_site_static(CSSI), _Pref, Deep, HTML, !IO) :-
+exec(deep_cmd_call_site_static(CSSI), _Pref, Deep, HTML, !IO) :-
     HTML = generate_call_site_static_debug_page(CSSI, Deep).
-exec(call_site_dynamic(CSDI), _Pref, Deep, HTML, !IO) :-
+exec(deep_cmd_call_site_dynamic(CSDI), _Pref, Deep, HTML, !IO) :-
     HTML = generate_call_site_dynamic_debug_page(CSDI, Deep).
-exec(raw_clique(CI), _Pref, Deep, HTML, !IO) :-
+exec(deep_cmd_raw_clique(CI), _Pref, Deep, HTML, !IO) :-
     HTML = generate_clique_debug_page(CI, Deep).
 
 %-----------------------------------------------------------------------------%
@@ -343,56 +341,52 @@
         menu_text ++
         "<ul>\n" ++
         "<li>\n" ++
-        menu_item(Deep, Pref, root(no),
+        menu_item(Deep, Pref, deep_cmd_root(no),
             "Exploring the call graph, starting at the root.") ++
         "<li>\n" ++
-        menu_item(Deep, Pref, root(yes(90)),
+        menu_item(Deep, Pref, deep_cmd_root(yes(90)),
             "Exploring the call graph, starting at the action.") ++
         "<li>\n" ++
-        menu_item(Deep, Pref, modules,
+        menu_item(Deep, Pref, deep_cmd_modules,
             "Exploring the program module by module.") ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(rank_range(1, 100), time,
-                self, overall),
+            deep_cmd_top_procs(rank_range(1, 100), cost_time, self, overall),
             "Top 100 most expensive procedures: time, self.") ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(rank_range(1, 100), time,
-                self_and_desc, overall),
+            deep_cmd_top_procs(rank_range(1, 100), cost_time, self_and_desc,
+                overall),
             "Top 100 most expensive procedures: time, self+desc.")
             ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(rank_range(1, 100), words,
-                self, overall),
+            deep_cmd_top_procs(rank_range(1, 100), cost_words, self, overall),
             "Top 100 most expensive procedures: words, self.") ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(rank_range(1, 100), words,
-                self_and_desc, overall),
+            deep_cmd_top_procs(rank_range(1, 100), cost_words, self_and_desc,
+                overall),
             "Top 100 most expensive procedures: words, self+desc.")
             ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(threshold(0.1), time,
-                self, overall),
+            deep_cmd_top_procs(threshold(0.1), cost_time, self, overall),
             "Procedures above 0.1% threshold: time, self.") ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(threshold(0.1), time,
-                self_and_desc, overall),
+            deep_cmd_top_procs(threshold(0.1), cost_time, self_and_desc,
+                overall),
             "Procedures above 1% threshold: time, self+desc.")
             ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(threshold(0.1), words,
-                self, overall),
+            deep_cmd_top_procs(threshold(0.1), cost_words, self, overall),
             "Procedures above 0.1% threshold: words, self.") ++
         "<li>\n" ++
         menu_item(Deep, Pref,
-            top_procs(threshold(0.1), words,
-                self_and_desc, overall),
+            deep_cmd_top_procs(threshold(0.1), cost_words, self_and_desc,
+                overall),
             "Procedures above 1% threshold: words, self+desc.")
             ++
         "</ul>\n" ++
@@ -459,8 +453,7 @@
     generate_clique_page(Cmd, CliqueNum, Pref, Deep, HTML0,
         Percent, ActionPtrs),
     ( ActionPtrs = [clique_ptr(ActionCliqueNum)] ->
-        HTML = chase_the_action(Cmd, ActionCliqueNum,
-            Pref, Deep, Percent)
+        HTML = chase_the_action(Cmd, ActionCliqueNum, Pref, Deep, Percent)
     ;
         HTML = HTML0
     ).
@@ -472,16 +465,14 @@
 
 generate_clique_page(Cmd, CliqueNum, Pref, Deep, HTML,
         Percent, ActionPtrs) :-
-    clique_to_html(Pref, Deep, clique_ptr(CliqueNum),
-        CliqueHTML, Percent, ActionPtrs),
+    clique_to_html(Pref, Deep, clique_ptr(CliqueNum), CliqueHTML, Percent,
+        ActionPtrs),
     HTML =
         page_banner(Cmd, Pref) ++
-        string.format("<H3>Clique %d:</H3>\n",
-            [i(CliqueNum)]) ++
+        string.format("<H3>Clique %d:</H3>\n", [i(CliqueNum)]) ++
         table_start(Pref) ++
         fields_header(Pref, source_proc, totals_meaningful,
-            wrap_clique_links(clique_ptr(CliqueNum),
-                Pref, Deep)) ++
+            wrap_clique_links(clique_ptr(CliqueNum), Pref, Deep)) ++
         CliqueHTML ++
         table_end(Pref) ++
         page_footer(Cmd, Pref, Deep).
@@ -519,10 +510,8 @@
                 ""
             ;
                 table_start(Pref) ++
-                fields_header(Pref, IdFields,
-                    totals_meaningful,
-                    wrap_proc_callers_links(PSPtr,
-                        CallerGroups, 1,
+                fields_header(Pref, IdFields, totals_meaningful,
+                    wrap_proc_callers_links(PSPtr, CallerGroups, 1,
                         Pref, Deep)) ++
                 CallersHTML ++
                 table_end(Pref) ++
@@ -571,8 +560,8 @@
 
 generate_top_procs_page(Cmd, Limit, CostKind, InclDesc0, Scope0, Pref, Deep)
         = HTML :-
-    ( CostKind = calls ->
-        % counting calls is incompatible both with self_and_desc
+    ( CostKind = cost_calls ->
+        % Counting calls is incompatible both with self_and_desc
         % and per_call.
         InclDesc = self,
         Scope = overall
@@ -595,7 +584,8 @@
         Desc = cost_criteria_to_description(CostKind, InclDesc, Scope),
         Heading = string.format("<H3>Top procedures %s</H3>\n",
             [s(Desc)]),
-        ( TopPSIs = [] ->
+        (
+            TopPSIs = [],
             HTML =
                 page_banner(Cmd, Pref) ++
                 Heading ++ "<p>\n" ++
@@ -605,22 +595,20 @@
                 ToggleCostHTML ++
                 page_footer(Cmd, Pref, Deep)
         ;
+            TopPSIs = [_ | _],
             TopProcs = list.filter_map(
                 lookup_proc_total_to_html(Pref, Deep, no, ""),
                 list.map(wrap_proc_static_ptr, TopPSIs)),
             RankedTopProcs = add_ranks(TopProcs),
             SummaryHTMLs = list.map(
-                two_id_line_to_html(Pref, Deep,
-                    totals_meaningful),
+                two_id_line_to_html(Pref, Deep, totals_meaningful),
                 RankedTopProcs),
             HTML =
                 page_banner(Cmd, Pref) ++
                 Heading ++ "<p>\n" ++
                 table_start(Pref) ++
-                fields_header(Pref, rank_proc,
-                    totals_meaningful,
-                    wrap_top_procs_links(Limit, Pref,
-                        Deep)) ++
+                fields_header(Pref, rank_proc, totals_meaningful,
+                    wrap_top_procs_links(Limit, Pref, Deep)) ++
                 string.append_list(SummaryHTMLs) ++
                 table_end(Pref) ++
                 "<p>\n" ++
@@ -660,11 +648,11 @@
 module_summary_to_html(Pref, Deep, ModuleName - ModuleData) = LineGroup :-
     ModuleData = module_data(Own, Desc, _),
     not (
-        Pref ^ pref_inactive ^ inactive_modules = hide,
+        Pref ^ pref_inactive ^ inactive_modules = inactive_hide,
         is_inactive(Own)
     ),
     HTML = string.format("<TD><A HREF=""%s"">%s</A></TD>\n",
-        [s(deep_cmd_pref_to_url(Pref, Deep, module(ModuleName))),
+        [s(deep_cmd_pref_to_url(Pref, Deep, deep_cmd_module(ModuleName))),
             s(ModuleName)]),
     LineGroup = line_group(ModuleName, 0, ModuleName, Own, Desc, HTML, unit).
 
@@ -675,8 +663,8 @@
 
 module_to_html(Pref, Deep, _ModuleName, ModuleData, IdHeaders, HTML) :-
     ModuleData = module_data(_Own, _Desc, PSPtrs),
-    ProcLines = list.filter_map(
-        lookup_proc_total_to_html(Pref, Deep, yes, ""), PSPtrs),
+    ProcLines = list.filter_map(lookup_proc_total_to_html(Pref, Deep, yes, ""),
+        PSPtrs),
     Criteria = Pref ^ pref_criteria,
     SortedProcLines = sort_line_groups(Criteria, ProcLines),
     ( Criteria = by_cost(_, _, _) ->
@@ -686,8 +674,7 @@
         IdHeaders = source_proc,
         RankedProcLines = list.map(add_self_context, SortedProcLines)
     ),
-    ProcHTMLs = list.map(
-        two_id_line_to_html(Pref, Deep, totals_meaningful),
+    ProcHTMLs = list.map(two_id_line_to_html(Pref, Deep, totals_meaningful),
         RankedProcLines),
     HTML =
         separator_row(Pref, IdHeaders, totals_meaningful) ++
@@ -742,8 +729,8 @@
         separator_row(Pref, source_proc, totals_meaningful) ++
         Ancestors ++
         separator_row(Pref, source_proc, totals_meaningful) ++
-        header_row("Procedures of the clique:",
-            Pref, source_proc, totals_meaningful) ++
+        header_row("Procedures of the clique:", Pref, source_proc,
+            totals_meaningful) ++
         separator_row(Pref, source_proc, totals_meaningful) ++
         ProcGroups.
 
@@ -776,8 +763,7 @@
             ThisHTML = two_id_line_to_html(Pref, Deep, totals_meaningful,
                 ThisLine),
             clique_ancestors_to_html(Pref, Deep, AncestorLimit - 1,
-                RespectLimit, EntryCliquePtr,
-                AncestorHTML, Cutoff),
+                RespectLimit, EntryCliquePtr, AncestorHTML, Cutoff),
             HTML = AncestorHTML ++ ThisHTML
         )
     ;
@@ -819,24 +805,21 @@
         list.map(deep_lookup_pd_desc(Deep), PDPtrs, ProcDescs),
         ProcOwn = sum_own_infos(ProcOwns),
         ProcDesc = sum_inherit_infos(ProcDescs),
-        ProcTotal = proc_total_to_two_id_line(Pref, Deep,
-            yes, "summary ", PSPtr, ProcOwn, ProcDesc),
-        list.map2(
-            proc_in_clique_to_html(Pref, Deep, CliquePtr, Percent),
+        ProcTotal = proc_total_to_two_id_line(Pref, Deep, yes, "summary ",
+            PSPtr, ProcOwn, ProcDesc),
+        list.map2(proc_in_clique_to_html(Pref, Deep, CliquePtr, Percent),
             PDPtrs, ComponentHTMLs, ActionPtrLists),
         list.condense(ActionPtrLists, ActionPtrs),
         string.append_list(ComponentHTMLs, ComponentHTML),
         HTML =
             separator_row(Pref, source_proc, totals_meaningful) ++
-            two_id_line_to_html(Pref, Deep, totals_meaningful,
-                ProcTotal) ++
+            two_id_line_to_html(Pref, Deep, totals_meaningful, ProcTotal) ++
             separator_row(Pref, source_proc, totals_meaningful) ++
             ComponentHTML
     ).
 
 :- pred proc_in_clique_to_html(preferences::in, deep::in, clique_ptr::in,
-    int::in, proc_dynamic_ptr::in, string::out, list(clique_ptr)::out)
-    is det.
+    int::in, proc_dynamic_ptr::in, string::out, list(clique_ptr)::out) is det.
 
 proc_in_clique_to_html(Pref, Deep, CliquePtr, Percent, PDPtr,
         HTML, ActionPtrs) :-
@@ -845,11 +828,12 @@
         deep_lookup_pd_desc(Deep, PDPtr, ProcDesc),
         deep_lookup_proc_dynamics(Deep, PDPtr, PD),
         PSPtr = PD ^ pd_proc_static,
-        ProcTotal = proc_total_to_two_id_line(Pref, Deep,
-            yes, "", PSPtr, ProcOwn, ProcDesc),
+        ProcTotal = proc_total_to_two_id_line(Pref, Deep, yes, "",
+            PSPtr, ProcOwn, ProcDesc),
         child_call_sites(Deep ^ proc_dynamics, Deep ^ proc_statics,
             PDPtr, GroupPairs),
-        ( GroupPairs = [] ->
+        (
+            GroupPairs = [],
             HTML =
                 separator_row(Pref, source_proc,
                     totals_meaningful) ++
@@ -857,24 +841,20 @@
                     totals_meaningful,ProcTotal),
             ActionPtrs = []
         ;
-            list.map2(call_site_clique_to_html(Pref, Deep,
-                CliquePtr, Percent),
+            GroupPairs = [_ | _],
+            list.map2(call_site_clique_to_html(Pref, Deep, CliquePtr, Percent),
                 GroupPairs, CallSiteLists, ActionPtrLists),
             list.condense(CallSiteLists, CallSites),
             list.condense(ActionPtrLists, ActionPtrs),
             SortedCallSites = sort_line_groups(
                 Pref ^ pref_criteria, CallSites),
             BodyHTMLs = list.map(
-                two_id_line_group_to_html(Pref, Deep,
-                    totals_meaningful),
+                two_id_line_group_to_html(Pref, Deep, totals_meaningful),
                 SortedCallSites),
             HTML =
-                separator_row(Pref, source_proc,
-                    totals_meaningful) ++
-                two_id_line_to_html(Pref, Deep,
-                    totals_meaningful,ProcTotal) ++
-                separator_row(Pref, source_proc,
-                    totals_meaningful) ++
+                separator_row(Pref, source_proc, totals_meaningful) ++
+                two_id_line_to_html(Pref, Deep, totals_meaningful,ProcTotal) ++
+                separator_row(Pref, source_proc, totals_meaningful) ++
                 string.append_list(BodyHTMLs)
         )
     ;
@@ -907,7 +887,7 @@
 lookup_proc_total_to_html(Pref, Deep, Bold, Prefix, PSPtr) = LineGroup :-
     deep_lookup_ps_own(Deep, PSPtr, Own),
     not (
-        Pref ^ pref_inactive ^ inactive_procs = hide,
+        Pref ^ pref_inactive ^ inactive_procs = inactive_hide,
         is_inactive(Own)
     ),
     deep_lookup_ps_desc(Deep, PSPtr, Desc),
@@ -961,8 +941,7 @@
         BoldEnd = "</B>"
     ),
     HTML = string.format("<TD CLASS=id COLSPAN=%d>%s%s%s%s</TD>\n",
-        [i(Span), s(BoldStart), s(Prefix),
-        s(WrappedProcName), s(BoldEnd)]).
+        [i(Span), s(BoldStart), s(Prefix), s(WrappedProcName), s(BoldEnd)]).
 
 %-----------------------------------------------------------------------------%
 
@@ -991,9 +970,8 @@
             error("call_site_clique_to_html: non-normal_call error")
         ),
         call_site_context(Deep, CSSPtr, FileName, LineNumber),
-        multi_call_site_clique_to_html(Pref, Deep,
-            FileName, LineNumber, Kind, CallerCliquePtr, CSDPtrs,
-            LineGroups, Percent, ActionPtrs)
+        multi_call_site_clique_to_html(Pref, Deep, FileName, LineNumber,
+            Kind, CallerCliquePtr, CSDPtrs, LineGroups, Percent, ActionPtrs)
     ).
 
 :- func maybe_extract_action_clique(deep, clique_ptr, int,
@@ -1062,22 +1040,18 @@
     SummaryHTML =
         string.format("<TD CLASS=id>%s:%d</TD>\n",
             [s(escape_html_string(FileName)), i(LineNumber)]) ++
-        %
+
         % NOTE: we don't escape HTML special characters for
         % 'CallSiteName' because it has already been done.
-        %
-        string.format("<TD CLASS=id>%s</TD>\n",
-            [s(CallSiteName)]),
+        string.format("<TD CLASS=id>%s</TD>\n", [s(CallSiteName)]),
     (
         Pref ^ pref_summarize = summarize,
-        LineGroup = line_group(FileName, LineNumber,
-            RawCallSiteName, Own, Desc, SummaryHTML,
-                sub_lines(two_id, []))
+        LineGroup = line_group(FileName, LineNumber, RawCallSiteName,
+            Own, Desc, SummaryHTML, sub_lines(two_id, []))
     ;
         Pref ^ pref_summarize = dont_summarize,
-        LineGroup = line_group(FileName, LineNumber,
-            RawCallSiteName, Own, Desc, SummaryHTML,
-                sub_lines(two_id, SubLines))
+        LineGroup = line_group(FileName, LineNumber, RawCallSiteName,
+            Own, Desc, SummaryHTML, sub_lines(two_id, SubLines))
     ),
     LineGroups = [LineGroup].
 
@@ -1095,12 +1069,10 @@
     call_site_context(Deep, CSSPtr, FileName, LineNumber),
     ( Kind = normal_call_and_callee(CalleePSPtr, _) ->
         LineGroup0 = normal_call_site_summary_to_html(Pref, Deep,
-            FileName, LineNumber, CallerPSPtr, CalleePSPtr,
-            CallSiteCallList)
+            FileName, LineNumber, CallerPSPtr, CalleePSPtr, CallSiteCallList)
     ;
         LineGroup0 = multi_call_site_summary_to_html(Pref, Deep,
-            FileName, LineNumber, Kind,
-            CallerPSPtr, CallSiteCallList)
+            FileName, LineNumber, Kind, CallerPSPtr, CallSiteCallList)
     ),
     CSSContext = string.format("%s:%d",
         [s(escape_html_string(FileName)), i(LineNumber)]),
@@ -1120,8 +1092,7 @@
         Desc = zero_inherit_prof_info,
         SummaryHTML =
             string.format("<TD CLASS=id>%s</TD>\n",
-                [s(proc_static_to_html_ref(Pref,
-                    Deep, CalleePSPtr))]),
+                [s(proc_static_to_html_ref(Pref, Deep, CalleePSPtr))]),
         LineGroup = line_group(FileName, LineNumber,
             ProcName, Own, Desc, SummaryHTML,
             sub_lines(two_id, []))
@@ -1130,8 +1101,7 @@
         require(unify(CalleePSPtr, CalleePSPtrFromCall),
             "call_site_summary_to_html: callee mismatch"),
         LineGroup0 = call_site_summary_group_to_html(Pref, Deep,
-            FileName, LineNumber, ProcName,
-            CallerPSPtr, CallSiteCall),
+            FileName, LineNumber, ProcName, CallerPSPtr, CallSiteCall),
         LineGroup = line_to_two_id_subline_group(LineGroup0)
     ;
         error("normal_call_site_summary_to_html: too many procedures")
@@ -1151,24 +1121,20 @@
         FileName, LineNumber, RawCallSiteName, CallerPSPtr),
         CallSiteCallList),
     sum_line_group_measurements(SubLines, Own, Desc),
-    %
+
     % NOTE: we don't escape HTML special characters for
     % 'CallSiteName' because it has already been done.
-    %
     SummaryHTML =
-        string.format("<TD CLASS=id>%s</TD>\n",
-            [s(CallSiteName)]),
+        string.format("<TD CLASS=id>%s</TD>\n", [s(CallSiteName)]),
     (
         Pref ^ pref_summarize = summarize,
-        LineGroup = line_group(FileName, LineNumber,
-            RawCallSiteName, Own, Desc, SummaryHTML,
-            sub_lines(two_id, []))
+        LineGroup = line_group(FileName, LineNumber, RawCallSiteName,
+            Own, Desc, SummaryHTML, sub_lines(two_id, []))
     ;
         Pref ^ pref_summarize = dont_summarize,
         ContextSubLines = list.map(add_context(""), SubLines),
-        LineGroup = line_group(FileName, LineNumber,
-            RawCallSiteName, Own, Desc, SummaryHTML,
-            sub_lines(two_id, ContextSubLines))
+        LineGroup = line_group(FileName, LineNumber, RawCallSiteName,
+            Own, Desc, SummaryHTML, sub_lines(two_id, ContextSubLines))
     ).
 
 :- func call_site_summary_group_to_html(preferences, deep,
@@ -1207,11 +1173,9 @@
     inherit_prof_info::in, inherit_prof_info::out) is det.
 
 process_call_site_dynamics_group([], _, _,
-        MaybeCalleeCliquePtr, MaybeCalleeCliquePtr,
-        Own, Own, Desc, Desc).
+        MaybeCalleeCliquePtr, MaybeCalleeCliquePtr, Own, Own, Desc, Desc).
 process_call_site_dynamics_group([CSDPtr | CSDPtrs], Deep, CalleePSPtr,
-        MaybeCalleeCliquePtr0, MaybeCalleeCliquePtr,
-        Own0, Own, Desc0, Desc) :-
+        MaybeCalleeCliquePtr0, MaybeCalleeCliquePtr, Own0, Own, Desc0, Desc) :-
     deep_lookup_call_site_dynamics(Deep, CSDPtr, CSD),
     PDPtr = CSD ^ csd_callee,
     deep_lookup_proc_dynamics(Deep, PDPtr, PD),
@@ -1233,8 +1197,7 @@
     Own1 = add_own_to_own(Own0, CSDOwn),
     Desc1 = add_inherit_to_inherit(Desc0, CSDDesc),
     process_call_site_dynamics_group(CSDPtrs, Deep, CalleePSPtr,
-        MaybeCalleeCliquePtr1, MaybeCalleeCliquePtr,
-        Own1, Own, Desc1, Desc).
+        MaybeCalleeCliquePtr1, MaybeCalleeCliquePtr, Own1, Own, Desc1, Desc).
 
 :- pred accumulate_csd_prof_info(deep::in, proc_static_ptr::in,
     call_site_dynamic_ptr::in,
@@ -1280,8 +1243,7 @@
     Context = string.format("%s:%d", [s(escape_html_string(FileName)),
         i(LineNumber)]),
     HTML = call_to_html(Pref, Deep, CallSiteDisplay, Context,
-        CallerPDPtr, CalleePDPtr,
-        MaybeCallerCliquePtr, CalleeCliquePtr),
+        CallerPDPtr, CalleePDPtr, MaybeCallerCliquePtr, CalleeCliquePtr),
     ProcName = escape_html_string(proc_dynamic_name(Deep, CalleePDPtr)),
     LineGroup = line_group(FileName, LineNumber, ProcName,
         CallSiteOwn, CallSiteDesc, HTML, unit).
@@ -1375,7 +1337,7 @@
     ),
     ChosenCliquePtr = clique_ptr(ChosenCliqueNum),
     WrappedProcName = string.format("<A HREF=""%s"">%s</A>",
-        [s(deep_cmd_pref_to_url(Pref, Deep, clique(ChosenCliqueNum))),
+        [s(deep_cmd_pref_to_url(Pref, Deep, deep_cmd_clique(ChosenCliqueNum))),
         s(escape_html_string(ProcName))]),
     (
         CallSiteDisplay ^ display_wrap = wrap_url_always,
@@ -1448,8 +1410,7 @@
             Deep, Result, !IO),
         (
             Result = ok(ExcludeSpec),
-            CallerCSDPtrPairs = list.map(
-                pair_contour(Deep, ExcludeSpec),
+            CallerCSDPtrPairs = list.map(pair_contour(Deep, ExcludeSpec),
                 CallerCSDPtrs),
             MaybeErrorMsg = no
         ;
@@ -1460,10 +1421,10 @@
     ),
     ProcName = proc_static_name(Deep, PSPtr),
     PSPtr = proc_static_ptr(PSI),
-    CmdSite    = proc_callers(PSI, group_by_call_site, 1),
-    CmdProc    = proc_callers(PSI, group_by_proc, 1),
-    CmdModule  = proc_callers(PSI, group_by_module, 1),
-    CmdClique  = proc_callers(PSI, group_by_clique, 1),
+    CmdSite    = deep_cmd_proc_callers(PSI, group_by_call_site, 1),
+    CmdProc    = deep_cmd_proc_callers(PSI, group_by_proc, 1),
+    CmdModule  = deep_cmd_proc_callers(PSI, group_by_module, 1),
+    CmdClique  = deep_cmd_proc_callers(PSI, group_by_clique, 1),
     LinkSite   = "Group callers by call site",
     LinkProc   = "Group callers by procedure",
     LinkModule = "Group callers by module",
@@ -1476,8 +1437,7 @@
         GroupMap = list.foldl(accumulate_csds_by_call_site(Deep),
             CallerCSDPtrPairs, map.init),
         map.to_assoc_list(GroupMap, GroupList),
-        Lines = list.map(
-            proc_callers_call_site_to_html(Pref, Deep, PSPtr),
+        Lines = list.map(proc_callers_call_site_to_html(Pref, Deep, PSPtr),
             GroupList),
         SortedLines = sort_line_groups(Pref ^ pref_criteria, Lines),
         IdFields = source_proc,
@@ -1497,8 +1457,7 @@
         GroupMap = list.foldl(accumulate_csds_by_procedure(Deep),
             CallerCSDPtrPairs, map.init),
         map.to_assoc_list(GroupMap, GroupList),
-        Lines = list.map(
-            proc_callers_proc_to_html(Pref, Deep, PSPtr),
+        Lines = list.map(proc_callers_proc_to_html(Pref, Deep, PSPtr),
             GroupList),
         SortedLines = sort_line_groups(Pref ^ pref_criteria, Lines),
         IdFields = source_proc,
@@ -1518,11 +1477,9 @@
         GroupMap = list.foldl(accumulate_csds_by_module(Deep),
             CallerCSDPtrPairs, map.init),
         map.to_assoc_list(GroupMap, GroupList),
-        RawLines = list.map(
-            proc_callers_module_to_html(Pref, Deep, PSPtr),
+        RawLines = list.map(proc_callers_module_to_html(Pref, Deep, PSPtr),
             GroupList),
-        SortedRawLines = sort_line_groups(Pref ^ pref_criteria,
-            RawLines),
+        SortedRawLines = sort_line_groups(Pref ^ pref_criteria, RawLines),
         SortedLines = add_ranks(SortedRawLines),
         IdFields = rank_module,
         Entity = "module",
@@ -1541,11 +1498,9 @@
         GroupMap = list.foldl(accumulate_csds_by_clique(Deep),
             CallerCSDPtrPairs, map.init),
         map.to_assoc_list(GroupMap, GroupList),
-        RawLines = list.map(
-            proc_callers_clique_to_html(Pref, Deep, PSPtr),
+        RawLines = list.map(proc_callers_clique_to_html(Pref, Deep, PSPtr),
             GroupList),
-        SortedRawLines = sort_line_groups(Pref ^ pref_criteria,
-            RawLines),
+        SortedRawLines = sort_line_groups(Pref ^ pref_criteria, RawLines),
         SortedLines = add_ranks(SortedRawLines),
         IdFields = source_proc,
         Entity = "clique",
@@ -1574,32 +1529,29 @@
         DisplayedLines),
     HTML = string.append_list(DisplayedHTMLs),
     ( BunchNum > 1 ->
-        FirstCmd = proc_callers(PSI, CallerGroups, 1),
+        FirstCmd = deep_cmd_proc_callers(PSI, CallerGroups, 1),
         FirstLink = "First group",
         FirstToggle =
             string.format("<A HREF=""%s"">%s</A>\n",
-                [s(deep_cmd_pref_to_url(Pref, Deep, FirstCmd)),
-                s(FirstLink)])
+                [s(deep_cmd_pref_to_url(Pref, Deep, FirstCmd)), s(FirstLink)])
     ;
         FirstToggle = ""
     ),
     ( BunchNum > 2 ->
-        PrevCmd = proc_callers(PSI, CallerGroups, BunchNum - 1),
+        PrevCmd = deep_cmd_proc_callers(PSI, CallerGroups, BunchNum - 1),
         PrevLink = "Previous group",
         PrevToggle =
             string.format("<A HREF=""%s"">%s</A>\n",
-                [s(deep_cmd_pref_to_url(Pref, Deep, PrevCmd)),
-                s(PrevLink)])
+                [s(deep_cmd_pref_to_url(Pref, Deep, PrevCmd)), s(PrevLink)])
     ;
         PrevToggle = ""
     ),
     ( NumLines > BunchNum * BunchSize ->
-        NextCmd = proc_callers(PSI, CallerGroups, BunchNum + 1),
+        NextCmd = deep_cmd_proc_callers(PSI, CallerGroups, BunchNum + 1),
         NextLink = "Next group",
         NextToggle =
             string.format("<A HREF=""%s"">%s</A>\n",
-                [s(deep_cmd_pref_to_url(Pref, Deep, NextCmd)),
-                s(NextLink)])
+                [s(deep_cmd_pref_to_url(Pref, Deep, NextCmd)), s(NextLink)])
     ;
         NextToggle = ""
     ),
@@ -1641,7 +1593,7 @@
 
 proc_callers_banner(PSI, ProcName, Pref, Deep, NumLines, BunchSize, BunchNum,
         Parent) = HTML :-
-    Cmd = proc(PSI),
+    Cmd = deep_cmd_proc(PSI),
     WrappedProcName = string.format("<A HREF=""%s"">%s</A>",
         [s(deep_cmd_pref_to_url(Pref, Deep, Cmd)),
             s(escape_html_string(ProcName))]),
@@ -1657,8 +1609,7 @@
     ; BunchNum = 1 ->
         HTML = string.format(
             "<H3>There are %d %ss calling %s, showing first %d:</H3>",
-            [i(NumLines), s(Parent), s(WrappedProcName),
-            i(BunchSize)])
+            [i(NumLines), s(Parent), s(WrappedProcName), i(BunchSize)])
     ;
         First = (BunchNum - 1) * BunchSize + 1,
         Last0 = (BunchNum) * BunchSize,
@@ -1669,8 +1620,7 @@
         ),
         HTML = string.format(
             "<H3>There are %d %ss calling %s, showing %d to %d:</H3>",
-            [i(NumLines), s(Parent), s(WrappedProcName),
-            i(First), i(Last)])
+            [i(NumLines), s(Parent), s(WrappedProcName), i(First), i(Last)])
     ).
 
 :- func proc_callers_call_site_to_html(preferences, deep, proc_static_ptr,
@@ -1683,15 +1633,13 @@
     CallerPSPtr = CSS ^ css_container,
     deep_lookup_proc_statics(Deep, CallerPSPtr, CallerPS),
     CallerProcName = CallerPS ^ ps_refined_id,
-    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr),
-        CSDPtrs,
+    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr), CSDPtrs,
         zero_own_prof_info, Own, zero_inherit_prof_info, Desc),
     HTML =
         string.format("<TD CLASS=id>%s:%d</TD>\n",
             [s(FileName), i(LineNumber)]) ++
         string.format("<TD CLASS=id>%s</TD>\n",
-            [s(proc_static_to_html_ref(Pref, Deep,
-                CallerPSPtr))]),
+            [s(proc_static_to_html_ref(Pref, Deep, CallerPSPtr))]),
     LineGroup = line_group(FileName, LineNumber, CallerProcName,
         Own, Desc, HTML, unit).
 
@@ -1703,15 +1651,13 @@
     proc_static_context(Deep, CallerPSPtr, FileName, LineNumber),
     deep_lookup_proc_statics(Deep, CallerPSPtr, CallerPS),
     CallerProcName = CallerPS ^ ps_refined_id,
-    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr),
-        CSDPtrs,
+    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr), CSDPtrs,
         zero_own_prof_info, Own, zero_inherit_prof_info, Desc),
     HTML =
         string.format("<TD CLASS=id>%s:%d</TD>\n",
             [s(FileName), i(LineNumber)]) ++
         string.format("<TD CLASS=id>%s</TD>\n",
-            [s(proc_static_to_html_ref(Pref, Deep,
-                CallerPSPtr))]),
+            [s(proc_static_to_html_ref(Pref, Deep, CallerPSPtr))]),
     LineGroup = line_group(FileName, LineNumber, CallerProcName,
         Own, Desc, HTML, unit).
 
@@ -1720,8 +1666,7 @@
 
 proc_callers_module_to_html(Pref, Deep, CalleePSPtr, ModuleName - CSDPtrs)
         = LineGroup :-
-    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr),
-        CSDPtrs,
+    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr), CSDPtrs,
         zero_own_prof_info, Own, zero_inherit_prof_info, Desc),
     HTML = string.format("<TD CLASS=id>%s</TD>\n",
         [s(module_name_to_html_ref(Pref, Deep, ModuleName))]),
@@ -1735,8 +1680,7 @@
 
 proc_callers_clique_to_html(Pref, Deep, CalleePSPtr, CliquePtr - CSDPtrs)
         = LineGroup :-
-    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr),
-        CSDPtrs,
+    list.foldl2(accumulate_parent_csd_prof_info(Deep, CalleePSPtr), CSDPtrs,
         zero_own_prof_info, Own, zero_inherit_prof_info, Desc),
     deep_lookup_clique_parents(Deep, CliquePtr, EntryCSDPtr),
     deep_lookup_call_site_dynamics(Deep, EntryCSDPtr, EntryCSD),
@@ -1785,8 +1729,7 @@
     deep_lookup_proc_statics(Deep, GroupPSPtr, GroupPS),
     GroupModuleName = GroupPS ^ ps_decl_module,
     ( map.search(Map0, GroupModuleName, CostCSDPtrs0) ->
-        map.det_update(Map0, GroupModuleName, [CostCSDPtr | CostCSDPtrs0],
-            Map)
+        map.det_update(Map0, GroupModuleName, [CostCSDPtr | CostCSDPtrs0], Map)
     ;
         map.det_insert(Map0, GroupModuleName, [CostCSDPtr], Map)
     ).
@@ -1823,10 +1766,8 @@
         add_own_to_own(Own0, CSDOwn) = Own,
         add_inherit_to_inherit(Desc0, CSDDesc) = Desc1,
 
-        deep_lookup_clique_index(Deep, CSD ^ csd_callee,
-            CalleeCliquePtr),
-        deep_lookup_clique_members(Deep, CalleeCliquePtr,
-            CalleeCliquePDPtrs),
+        deep_lookup_clique_index(Deep, CSD ^ csd_callee, CalleeCliquePtr),
+        deep_lookup_clique_members(Deep, CalleeCliquePtr, CalleeCliquePDPtrs),
         list.foldl(compensate_using_comp_table(Deep, CallerPSPtr),
             CalleeCliquePDPtrs, Desc1, Desc)
     ).
@@ -1888,13 +1829,13 @@
 proc_summary_toggles_to_html(Pref, Deep, PSPtr) = HTML :-
     PSPtr = proc_static_ptr(PSI),
     Msg1 = "Parent call sites",
-    Cmd1 = proc_callers(PSI, group_by_call_site, 1),
+    Cmd1 = deep_cmd_proc_callers(PSI, group_by_call_site, 1),
     Msg2 = "Parent procedures",
-    Cmd2 = proc_callers(PSI, group_by_proc, 1),
+    Cmd2 = deep_cmd_proc_callers(PSI, group_by_proc, 1),
     Msg3 = "Parent modules",
-    Cmd3 = proc_callers(PSI, group_by_module, 1),
+    Cmd3 = deep_cmd_proc_callers(PSI, group_by_module, 1),
     Msg4 = "Parent cliques",
-    Cmd4 = proc_callers(PSI, group_by_clique, 1),
+    Cmd4 = deep_cmd_proc_callers(PSI, group_by_clique, 1),
     Link1 = string.format("<A HREF=""%s"">%s</A>\n",
         [s(deep_cmd_pref_to_url(Pref, Deep, Cmd1)), s(Msg1)]),
     Link2 = string.format("<A HREF=""%s"">%s</A>\n",
@@ -1916,7 +1857,7 @@
 
 wrap_clique_links(CliquePtr, Pref0, Deep, Str0, Criteria) = Str :-
     CliquePtr = clique_ptr(CI),
-    Cmd = clique(CI),
+    Cmd = deep_cmd_clique(CI),
     Pref = Pref0 ^ pref_criteria := Criteria,
     URL = deep_cmd_pref_to_url(Pref, Deep, Cmd),
     Str = string.format("<A HREF=%s>%s</A>",
@@ -1927,7 +1868,7 @@
 
 wrap_proc_links(PSPtr, Pref0, Deep, Str0, Criteria) = Str :-
     PSPtr = proc_static_ptr(PSI),
-    Cmd = proc(PSI),
+    Cmd = deep_cmd_proc(PSI),
     Pref = Pref0 ^ pref_criteria := Criteria,
     URL = deep_cmd_pref_to_url(Pref, Deep, Cmd),
     Str = string.format("<A HREF=%s>%s</A>",
@@ -1939,7 +1880,7 @@
 wrap_proc_callers_links(PSPtr, CallerGroups, BunchNum, Pref0, Deep,
         Str0, Criteria) = Str :-
     PSPtr = proc_static_ptr(PSI),
-    Cmd = proc_callers(PSI, CallerGroups, BunchNum),
+    Cmd = deep_cmd_proc_callers(PSI, CallerGroups, BunchNum),
     Pref = Pref0 ^ pref_criteria := Criteria,
     URL = deep_cmd_pref_to_url(Pref, Deep, Cmd),
     Str = string.format("<A HREF=%s>%s</A>",
@@ -1949,7 +1890,7 @@
     order_criteria) = string.
 
 wrap_module_links(ModuleName, Pref0, Deep, Str0, Criteria) = Str :-
-    Cmd = module(ModuleName),
+    Cmd = deep_cmd_module(ModuleName),
     Pref = Pref0 ^ pref_criteria := Criteria,
     URL = deep_cmd_pref_to_url(Pref, Deep, Cmd),
     Str = string.format("<A HREF=%s>%s</A>",
@@ -1958,7 +1899,7 @@
 :- func wrap_modules_links(preferences, deep, string, order_criteria) = string.
 
 wrap_modules_links(Pref0, Deep, Str0, Criteria) = Str :-
-    Cmd = modules,
+    Cmd = deep_cmd_modules,
     Pref = Pref0 ^ pref_criteria := Criteria,
     URL = deep_cmd_pref_to_url(Pref, Deep, Cmd),
     Str = string.format("<A HREF=%s>%s</A>",
@@ -1976,7 +1917,7 @@
         Str = Str0
     ;
         Criteria = by_cost(CostKind, InclDesc, Scope),
-        Cmd = top_procs(Limit, CostKind, InclDesc, Scope),
+        Cmd = deep_cmd_top_procs(Limit, CostKind, InclDesc, Scope),
         URL = deep_cmd_pref_to_url(Pref, Deep, Cmd),
         Str = string.format("<A HREF=%s>%s</A>",
             [s(URL), s(escape_html_string(Str0))])
Index: startup.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/startup.m,v
retrieving revision 1.13
diff -u -b -r1.13 startup.m
--- startup.m	29 Sep 2006 06:15:11 -0000	1.13
+++ startup.m	4 Oct 2006 08:17:09 -0000
@@ -84,8 +84,7 @@
         )
     ;
         DataFileNames = [_, _ | _],
-        error("mdprof_server: merging of data files " ++
-            "is not yet implemented")
+        error("mdprof_server: merging of data files is not yet implemented")
     ).
 
 :- pred startup(string::in, string::in, bool::in, maybe(io.output_stream)::in,
Index: top_procs.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/top_procs.m,v
retrieving revision 1.8
diff -u -b -r1.8 top_procs.m
--- top_procs.m	29 Mar 2006 08:07:41 -0000	1.8
+++ top_procs.m	4 Oct 2006 08:18:18 -0000
@@ -127,8 +127,7 @@
         ( Result1 \= (=) ->
             Result = Result1
         ;
-            Result = compare_ps_words_both_overall(Deep,
-                PSI1, PSI2)
+            Result = compare_ps_words_both_overall(Deep, PSI1, PSI2)
         )
     ).
 
@@ -146,61 +145,71 @@
     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,
+find_top_sort_predicate(cost_calls,  self,          overall,  yes,
     compare_ps_calls_self_overall,  filter_ps_calls_self).
-find_top_sort_predicate(calls,  self,          per_call, no,
+find_top_sort_predicate(cost_calls,  self,          per_call, no,
     compare_ps_calls_self_overall,  filter_ps_calls_self).
-find_top_sort_predicate(calls,  self_and_desc, overall,  no,
+find_top_sort_predicate(cost_calls,  self_and_desc, overall,  no,
     compare_ps_calls_self_overall,  filter_ps_calls_self).
-find_top_sort_predicate(calls,  self_and_desc, per_call, no,
+find_top_sort_predicate(cost_calls,  self_and_desc, per_call, no,
     compare_ps_calls_self_overall,  filter_ps_calls_self).
-find_top_sort_predicate(redos,  self,          overall,  yes,
+find_top_sort_predicate(cost_redos,  self,          overall,  yes,
     compare_ps_redos_self_overall,  filter_ps_redos_self).
-find_top_sort_predicate(redos,  self,          per_call, no,
+find_top_sort_predicate(cost_redos,  self,          per_call, no,
     compare_ps_redos_self_overall,  filter_ps_redos_self).
-find_top_sort_predicate(redos,  self_and_desc, overall,  no,
+find_top_sort_predicate(cost_redos,  self_and_desc, overall,  no,
     compare_ps_redos_self_overall,  filter_ps_redos_self).
-find_top_sort_predicate(redos,  self_and_desc, per_call, no,
+find_top_sort_predicate(cost_redos,  self_and_desc, per_call, no,
     compare_ps_redos_self_overall,  filter_ps_redos_self).
-find_top_sort_predicate(time,   self,          overall,  yes,
+find_top_sort_predicate(cost_time,   self,          overall,  yes,
     compare_ps_time_self_overall,   filter_ps_time_self).
-find_top_sort_predicate(time,   self,          per_call, yes,
+find_top_sort_predicate(cost_time,   self,          per_call, yes,
     compare_ps_time_self_percall,   filter_ps_time_self).
-find_top_sort_predicate(time,   self_and_desc, overall,  yes,
+find_top_sort_predicate(cost_time,   self_and_desc, overall,  yes,
     compare_ps_time_both_overall,   filter_ps_time_both).
-find_top_sort_predicate(time,   self_and_desc, per_call, yes,
+find_top_sort_predicate(cost_time,   self_and_desc, per_call, yes,
     compare_ps_time_both_percall,   filter_ps_time_both).
-find_top_sort_predicate(allocs, self,          overall,  yes,
+find_top_sort_predicate(cost_allocs, self,          overall,  yes,
     compare_ps_allocs_self_overall, filter_ps_allocs_self).
-find_top_sort_predicate(allocs, self,          per_call, yes,
+find_top_sort_predicate(cost_allocs, self,          per_call, yes,
     compare_ps_allocs_self_percall, filter_ps_allocs_self).
-find_top_sort_predicate(allocs, self_and_desc, overall,  yes,
+find_top_sort_predicate(cost_allocs, self_and_desc, overall,  yes,
     compare_ps_allocs_both_overall, filter_ps_allocs_both).
-find_top_sort_predicate(allocs, self_and_desc, per_call, yes,
+find_top_sort_predicate(cost_allocs, self_and_desc, per_call, yes,
     compare_ps_allocs_both_percall, filter_ps_allocs_both).
-find_top_sort_predicate(words,  self,          overall,  yes,
+find_top_sort_predicate(cost_words,  self,          overall,  yes,
     compare_ps_words_self_overall,  filter_ps_words_self).
-find_top_sort_predicate(words,  self,          per_call, yes,
+find_top_sort_predicate(cost_words,  self,          per_call, yes,
     compare_ps_words_self_percall,  filter_ps_words_self).
-find_top_sort_predicate(words,  self_and_desc, overall,  yes,
+find_top_sort_predicate(cost_words,  self_and_desc, overall,  yes,
     compare_ps_words_both_overall,  filter_ps_words_both).
-find_top_sort_predicate(words,  self_and_desc, per_call, yes,
+find_top_sort_predicate(cost_words,  self_and_desc, per_call, yes,
     compare_ps_words_both_percall,  filter_ps_words_both).
 
 :- 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).
-find_threshold_predicate(calls,  self_and_desc, no,  threshold_ps_time_self).
-find_threshold_predicate(redos,  self,          no,  threshold_ps_time_self).
-find_threshold_predicate(redos,  self_and_desc, no,  threshold_ps_time_self).
-find_threshold_predicate(time,   self,          yes, threshold_ps_time_self).
-find_threshold_predicate(time,   self_and_desc, yes, threshold_ps_time_both).
-find_threshold_predicate(allocs, self,          yes, threshold_ps_allocs_self).
-find_threshold_predicate(allocs, self_and_desc, yes, threshold_ps_allocs_both).
-find_threshold_predicate(words,  self,          yes, threshold_ps_words_self).
-find_threshold_predicate(words,  self_and_desc, yes, threshold_ps_words_both).
+find_threshold_predicate(cost_calls,  self,          no,
+    threshold_ps_time_self).
+find_threshold_predicate(cost_calls,  self_and_desc, no,
+    threshold_ps_time_self).
+find_threshold_predicate(cost_redos,  self,          no,
+    threshold_ps_time_self).
+find_threshold_predicate(cost_redos,  self_and_desc, no,
+    threshold_ps_time_self).
+find_threshold_predicate(cost_time,   self,          yes,
+    threshold_ps_time_self).
+find_threshold_predicate(cost_time,   self_and_desc, yes,
+    threshold_ps_time_both).
+find_threshold_predicate(cost_allocs, self,          yes,
+    threshold_ps_allocs_self).
+find_threshold_predicate(cost_allocs, self_and_desc, yes,
+    threshold_ps_allocs_both).
+find_threshold_predicate(cost_words,  self,          yes,
+    threshold_ps_words_self).
+find_threshold_predicate(cost_words,  self_and_desc, yes,
+    threshold_ps_words_both).
 
 %-----------------------------------------------------------------------------%
 
@@ -592,71 +601,71 @@
     ;
         Criteria = by_cost(Measurement, InclDesc, Scope),
         (
-            Measurement = calls,
+            Measurement = cost_calls,
             % We ignore the setting of InclDesc because calls are not
             % inherited from descendants, and we ignore the setting of Scope
             % because sorting on "calls per call" is not useful.
             CompFunc = compare_line_groups_by_calls
         ;
-            Measurement = redos,
+            Measurement = cost_redos,
             CompFunc = compare_line_groups_by_redos
         ;
-            Measurement = time,
+            Measurement = cost_time,
             InclDesc = self,
             Scope = overall,
             CompFunc = compare_line_groups_by_time_self_overall
         ;
-            Measurement = time,
+            Measurement = cost_time,
             InclDesc = self,
             Scope = per_call,
             CompFunc = compare_line_groups_by_time_self_percall
         ;
-            Measurement = time,
+            Measurement = cost_time,
             InclDesc = self_and_desc,
             Scope = overall,
             CompFunc = compare_line_groups_by_time_total_overall
         ;
-            Measurement = time,
+            Measurement = cost_time,
             InclDesc = self_and_desc,
             Scope = per_call,
             CompFunc = compare_line_groups_by_time_total_percall
         ;
-            Measurement = allocs,
+            Measurement = cost_allocs,
             InclDesc = self,
             Scope = overall,
             CompFunc = compare_line_groups_by_allocs_self_overall
         ;
-            Measurement = allocs,
+            Measurement = cost_allocs,
             InclDesc = self,
             Scope = per_call,
             CompFunc = compare_line_groups_by_allocs_self_percall
         ;
-            Measurement = allocs,
+            Measurement = cost_allocs,
             InclDesc = self_and_desc,
             Scope = overall,
             CompFunc = compare_line_groups_by_allocs_total_overall
         ;
-            Measurement = allocs,
+            Measurement = cost_allocs,
             InclDesc = self_and_desc,
             Scope = per_call,
             CompFunc = compare_line_groups_by_allocs_total_percall
         ;
-            Measurement = words,
+            Measurement = cost_words,
             InclDesc = self,
             Scope = overall,
             CompFunc = compare_line_groups_by_words_self_overall
         ;
-            Measurement = words,
+            Measurement = cost_words,
             InclDesc = self,
             Scope = per_call,
             CompFunc = compare_line_groups_by_words_self_percall
         ;
-            Measurement = words,
+            Measurement = cost_words,
             InclDesc = self_and_desc,
             Scope = overall,
             CompFunc = compare_line_groups_by_words_total_overall
         ;
-            Measurement = words,
+            Measurement = cost_words,
             InclDesc = self_and_desc,
             Scope = per_call,
             CompFunc = compare_line_groups_by_words_total_percall
cvs diff: Diffing notes
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list