[m-rev.] for review: call sequence numbers in the deep profiler

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Oct 4 15:10:42 AEST 2006


For review by Julien.

Zoltan.

Enhance the deep profiler by including in the output a measure of execution
time that has much finer granularity than clock ticks: a count of procedure
calls. The deep profiler does not yet display this data; that is for a later
diff.

runtime/mercury_deep_profiling.[ch]:
	Add a field containing this counter if the appropriate macro is
	defined. Initialize the new field when the profiling metrics structure 
	it is in is initialized.

	Use masks that fit into one byte for the commonly needed fields
	of the profiling metrics structure.

runtime/mercury_conf_params.h:
	Define this macro in deep profiling grades unless its absence is
	expressly requested (for performance tests of the deep profiler
	itself).

runtime/mercury_grade.h:
	Increment the binary compatibility number for the deep profiling
	grades.

runtime/mercury_deep_{call,redo,leave}_port_body.h:
	Update the call sequence number global at call sites.

	Update the new field when control enters a procedure invocation
	through the call or redo ports, and when it leaves the invocation
	through the exit or fail ports.

library/exception.m:
	Update the new field when control leaves a procedure invocation
	through the excp port.

deep_profiler/measurements.m:
	Include the new field in the deep profiler's version of the
	profiling metric structure.

deep_profiler/read_profile.m:
	Read in the updated format now generated by the runtime.

deep_profiler/dump.m:
	Include the new field in any dumps of the deep profiler's
	internal data structures.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
Index: deep_profiler/dump.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/dump.m,v
retrieving revision 1.5
diff -u -r1.5 dump.m
--- deep_profiler/dump.m	29 Sep 2006 06:15:11 -0000	1.5
+++ deep_profiler/dump.m	4 Oct 2006 04:43:03 -0000
@@ -187,7 +187,7 @@
 
 dump_own_prof_info(Own, !IO) :-
     decompress_profile(Own, Calls, Exits, Fails, Redos, Excps,
-        Quanta, Allocs, Words),
+        Quanta, CallSeqs, Allocs, Words),
     ( Calls = 0 ->
         true
     ;
@@ -218,6 +218,11 @@
     ;
         io.format("\tquanta:\t%d\n", [i(Quanta)], !IO)
     ),
+    ( CallSeqs = 0 ->
+        true
+    ;
+        io.format("\tcall_seqs:\t%d\n", [i(CallSeqs)], !IO)
+    ),
     ( Allocs = 0 ->
         true
     ;
Index: deep_profiler/measurements.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/measurements.m,v
retrieving revision 1.10
diff -u -r1.10 measurements.m
--- deep_profiler/measurements.m	26 Sep 2006 04:19:34 -0000	1.10
+++ deep_profiler/measurements.m	4 Oct 2006 04:42:18 -0000
@@ -30,12 +30,14 @@
 :- func redos(own_prof_info) = int.
 :- func excps(own_prof_info) = int.
 :- func quanta(own_prof_info) = int.
+:- func call_seqs(own_prof_info) = int.
 :- func allocs(own_prof_info) = int.
 :- func words(own_prof_info) = int.
 
 :- func zero_own_prof_info = own_prof_info.
 
 :- func inherit_quanta(inherit_prof_info) = int.
+:- func inherit_call_seqs(inherit_prof_info) = int.
 :- func inherit_allocs(inherit_prof_info) = int.
 :- func inherit_words(inherit_prof_info) = int.
 
@@ -55,11 +57,12 @@
 :- func sum_own_infos(list(own_prof_info)) = own_prof_info.
 :- func sum_inherit_infos(list(inherit_prof_info)) = inherit_prof_info.
 
-:- func compress_profile(int, int, int, int, int, int, int) = own_prof_info.
+:- func compress_profile(int, int, int, int, int, int, int, int)
+    = own_prof_info.
 :- func compress_profile(own_prof_info) = own_prof_info.
 
 :- pred decompress_profile(own_prof_info::in, int::out, int::out, int::out,
-    int::out, int::out, int::out, int::out, int::out) is det.
+    int::out, int::out, int::out, int::out, int::out, int::out) is det.
 
 :- func own_to_string(own_prof_info) = string.
 
@@ -80,23 +83,43 @@
 %-----------------------------------------------------------------------------%
 
 :- type own_prof_info
-    --->    own_prof_all(int, int, int, int, int, int, int)
-            % exits, fails, redos, excps, quanta, allocs, words
+    --->    own_prof_all(
+                opa_exits       :: int,
+                opa_fails       :: int,
+                opa_redos       :: int,
+                opa_excps       :: int,
+                opa_quanta      :: int,
+                opa_call_seqs   :: int,
+                opa_allocs      :: int,
+                opa_words       :: int
+            )
             % implicit calls = exits + fails + excps - redos
 
-    ;       own_prof_det(int, int, int, int)
-            % exits, quanta, allocs, words;
+    ;       own_prof_det(
+                opd_exits       :: int,
+                opd_quanta      :: int,
+                opd_call_seqs   :: int,
+                opd_allocs      :: int,
+                opd_words       :: int
+            )
             % implicit fails == redos == excps == 0
             % implicit calls == exits
 
-    ;       own_prof_fast_det(int, int, int)
-            % exits, allocs, words;
+    ;       own_prof_fast_det(
+                opfd_exits      :: int,
+                opfd_call_seqs  :: int,
+                opfd_allocs     :: int,
+                opfd_words      :: int
+            )
             % implicit fails == redos == excps == 0
             % implicit calls == exits
             % implicit quanta == 0
 
-    ;       own_prof_fast_nomem_semi(int, int).
-            % exits, fails
+    ;       own_prof_fast_nomem_semi(
+                opfns_exits     :: int,
+                opfns_fails     :: int,
+                opfns_call_seqs :: int
+            ).
             % implicit redos == excps == 0
             % implicit calls == exits + fails
             % implicit quanta == 0
@@ -104,79 +127,89 @@
 
 :- type inherit_prof_info
     --->    inherit_prof_info(
-                int,        % quanta
-                int,        % allocs
-                int         % words
+                ipo_quanta      :: int,
+                ipo_call_seqs   :: int,
+                ipo_allocs      :: int,
+                ipo_words       :: int
             ).
 
-calls(own_prof_fast_nomem_semi(Exits, Fails)) = Exits + Fails.
-exits(own_prof_fast_nomem_semi(Exits, _)) = Exits.
-fails(own_prof_fast_nomem_semi(_, Fails)) = Fails.
-redos(own_prof_fast_nomem_semi(_, _)) = 0.
-excps(own_prof_fast_nomem_semi(_, _)) = 0.
-quanta(own_prof_fast_nomem_semi(_, _)) = 0.
-allocs(own_prof_fast_nomem_semi(_, _)) = 0.
-words(own_prof_fast_nomem_semi(_, _)) = 0.
-
-calls(own_prof_fast_det(Exits, _, _)) = Exits.
-exits(own_prof_fast_det(Exits, _, _)) = Exits.
-fails(own_prof_fast_det(_, _, _)) = 0.
-redos(own_prof_fast_det(_, _, _)) = 0.
-excps(own_prof_fast_det(_, _, _)) = 0.
-quanta(own_prof_fast_det(_, _, _)) = 0.
-allocs(own_prof_fast_det(_, Allocs, _)) = Allocs.
-words(own_prof_fast_det(_, _, Words)) = Words.
-
-calls(own_prof_det(Exits, _, _, _)) = Exits.
-exits(own_prof_det(Exits, _, _, _)) = Exits.
-fails(own_prof_det(_, _, _, _)) = 0.
-redos(own_prof_det(_, _, _, _)) = 0.
-excps(own_prof_det(_, _, _, _)) = 0.
-quanta(own_prof_det(_, Quanta, _, _)) = Quanta.
-allocs(own_prof_det(_, _, Allocs, _)) = Allocs.
-words(own_prof_det(_, _, _, Words)) = Words.
+calls(own_prof_fast_nomem_semi(Exits, Fails, _)) = Exits + Fails.
+exits(own_prof_fast_nomem_semi(Exits, _, _)) = Exits.
+fails(own_prof_fast_nomem_semi(_, Fails, _)) = Fails.
+redos(own_prof_fast_nomem_semi(_, _, _)) = 0.
+excps(own_prof_fast_nomem_semi(_, _, _)) = 0.
+call_seqs(own_prof_fast_nomem_semi(_, _, CallSeqs)) = CallSeqs.
+quanta(own_prof_fast_nomem_semi(_, _, _)) = 0.
+allocs(own_prof_fast_nomem_semi(_, _, _)) = 0.
+words(own_prof_fast_nomem_semi(_, _, _)) = 0.
+
+calls(own_prof_fast_det(Exits, _, _, _)) = Exits.
+exits(own_prof_fast_det(Exits, _, _, _)) = Exits.
+fails(own_prof_fast_det(_, _, _, _)) = 0.
+redos(own_prof_fast_det(_, _, _, _)) = 0.
+excps(own_prof_fast_det(_, _, _, _)) = 0.
+quanta(own_prof_fast_det(_, _, _, _)) = 0.
+call_seqs(own_prof_fast_det(_, CallSeqs, _, _)) = CallSeqs.
+allocs(own_prof_fast_det(_, _, Allocs, _)) = Allocs.
+words(own_prof_fast_det(_, _, _, Words)) = Words.
+
+calls(own_prof_det(Exits, _, _, _, _)) = Exits.
+exits(own_prof_det(Exits, _, _, _, _)) = Exits.
+fails(own_prof_det(_, _, _, _, _)) = 0.
+redos(own_prof_det(_, _, _, _, _)) = 0.
+excps(own_prof_det(_, _, _, _, _)) = 0.
+quanta(own_prof_det(_, Quanta, _, _, _)) = Quanta.
+call_seqs(own_prof_det(_, _, CallSeqs, _, _)) = CallSeqs.
+allocs(own_prof_det(_, _, _, Allocs, _)) = Allocs.
+words(own_prof_det(_, _, _, _, Words)) = Words.
 
-calls(own_prof_all(Exits, Fails, Redos, Excps, _, _, _)) =
+calls(own_prof_all(Exits, Fails, Redos, Excps, _, _, _, _)) =
     Exits + Fails + Excps - Redos.
-exits(own_prof_all(Exits, _, _, _, _, _, _)) = Exits.
-fails(own_prof_all(_, Fails, _, _, _, _, _)) = Fails.
-redos(own_prof_all(_, _, Redos, _, _, _, _)) = Redos.
-excps(own_prof_all(_, _, _, Excps, _, _, _)) = Excps.
-quanta(own_prof_all(_, _, _, _, Quanta, _, _)) = Quanta.
-allocs(own_prof_all(_, _, _, _, _, Allocs, _)) = Allocs.
-words(own_prof_all(_, _, _, _, _, _, Words)) = Words.
-
-zero_own_prof_info = own_prof_fast_nomem_semi(0, 0).
-
-inherit_quanta(inherit_prof_info(Quanta, _, _)) = Quanta.
-inherit_allocs(inherit_prof_info(_, Allocs, _)) = Allocs.
-inherit_words(inherit_prof_info(_, _, Words)) = Words.
+exits(own_prof_all(Exits, _, _, _, _, _, _, _)) = Exits.
+fails(own_prof_all(_, Fails, _, _, _, _, _, _)) = Fails.
+redos(own_prof_all(_, _, Redos, _, _, _, _, _)) = Redos.
+excps(own_prof_all(_, _, _, Excps, _, _, _, _)) = Excps.
+quanta(own_prof_all(_, _, _, _, Quanta, _, _, _)) = Quanta.
+call_seqs(own_prof_all(_, _, _, _, CallSeqs, _, _, _)) = CallSeqs.
+allocs(own_prof_all(_, _, _, _, _, _, Allocs, _)) = Allocs.
+words(own_prof_all(_, _, _, _, _, _, _, Words)) = Words.
+
+zero_own_prof_info = own_prof_fast_nomem_semi(0, 0, 0).
+
+inherit_quanta(inherit_prof_info(Quanta, _, _, _)) = Quanta.
+inherit_call_seqs(inherit_prof_info(_, CallSeqs, _, _)) = CallSeqs.
+inherit_allocs(inherit_prof_info(_, _, Allocs, _)) = Allocs.
+inherit_words(inherit_prof_info(_, _, _, Words)) = Words.
 
-zero_inherit_prof_info = inherit_prof_info(0, 0, 0).
+zero_inherit_prof_info = inherit_prof_info(0, 0, 0, 0).
 
 add_inherit_to_inherit(PI1, PI2) = SumPI :-
     Quanta = inherit_quanta(PI1) + inherit_quanta(PI2),
+    CallSeqs = inherit_call_seqs(PI1) + inherit_call_seqs(PI2),
     Allocs = inherit_allocs(PI1) + inherit_allocs(PI2),
     Words = inherit_words(PI1) + inherit_words(PI2),
-    SumPI = inherit_prof_info(Quanta, Allocs, Words).
+    SumPI = inherit_prof_info(Quanta, CallSeqs, Allocs, Words).
 
 add_own_to_inherit(PI1, PI2) = SumPI :-
     Quanta = quanta(PI1) + inherit_quanta(PI2),
+    CallSeqs = call_seqs(PI1) + inherit_call_seqs(PI2),
     Allocs = allocs(PI1) + inherit_allocs(PI2),
     Words = words(PI1) + inherit_words(PI2),
-    SumPI = inherit_prof_info(Quanta, Allocs, Words).
+    SumPI = inherit_prof_info(Quanta, CallSeqs, Allocs, Words).
 
 subtract_own_from_inherit(PI1, PI2) = SumPI :-
     Quanta = inherit_quanta(PI2) - quanta(PI1),
+    CallSeqs = inherit_call_seqs(PI2) - call_seqs(PI1),
     Allocs = inherit_allocs(PI2) - allocs(PI1),
     Words = inherit_words(PI2) - words(PI1),
-    SumPI = inherit_prof_info(Quanta, Allocs, Words).
+    SumPI = inherit_prof_info(Quanta, CallSeqs, Allocs, Words).
 
 subtract_inherit_from_inherit(PI1, PI2) = SumPI :-
     Quanta = inherit_quanta(PI2) - inherit_quanta(PI1),
+    CallSeqs = inherit_call_seqs(PI2) - inherit_call_seqs(PI1),
     Allocs = inherit_allocs(PI2) - inherit_allocs(PI1),
     Words = inherit_words(PI2) - inherit_words(PI1),
-    SumPI = inherit_prof_info(Quanta, Allocs, Words).
+    SumPI = inherit_prof_info(Quanta, CallSeqs, Allocs, Words).
 
 add_inherit_to_own(PI1, PI2) = SumPI :-
     Exits = exits(PI2),
@@ -184,9 +217,10 @@
     Redos = redos(PI2),
     Excps = excps(PI2),
     Quanta = inherit_quanta(PI1) + quanta(PI2),
+    CallSeqs = inherit_call_seqs(PI1) + call_seqs(PI2),
     Allocs = inherit_allocs(PI1) + allocs(PI2),
     Words = inherit_words(PI1) + words(PI2),
-    SumPI = compress_profile(Exits, Fails, Redos, Excps, Quanta,
+    SumPI = compress_profile(Exits, Fails, Redos, Excps, Quanta, CallSeqs,
         Allocs, Words).
 
 add_own_to_own(PI1, PI2) = SumPI :-
@@ -195,10 +229,11 @@
     Redos = redos(PI1) + redos(PI2),
     Excps = excps(PI1) + excps(PI2),
     Quanta = quanta(PI1) + quanta(PI2),
+    CallSeqs = call_seqs(PI1) + call_seqs(PI2),
     Allocs = allocs(PI1) + allocs(PI2),
     Words = words(PI1) + words(PI2),
-    SumPI = compress_profile(Exits, Fails, Redos, Excps,
-        Quanta, Allocs, Words).
+    SumPI = compress_profile(Exits, Fails, Redos, Excps, Quanta, CallSeqs,
+        Allocs, Words).
 
 sum_own_infos(Owns) =
     list.foldl(add_own_to_own, Owns, zero_own_prof_info).
@@ -206,7 +241,8 @@
 sum_inherit_infos(Inherits) =
     list.foldl(add_inherit_to_inherit, Inherits, zero_inherit_prof_info).
 
-compress_profile(Exits, Fails, Redos, Excps, Quanta, Allocs, Words) = PI :-
+compress_profile(Exits, Fails, Redos, Excps, Quanta, CallSeqs, Allocs, Words)
+        = PI :-
     (
         Redos = 0,
         Excps = 0,
@@ -214,24 +250,26 @@
         Allocs = 0,
         Words = 0
     ->
-        PI = own_prof_fast_nomem_semi(Exits, Fails)
+        PI = own_prof_fast_nomem_semi(Exits, Fails, CallSeqs)
     ;
         Fails = 0,
         Redos = 0,
         Excps = 0
     ->
         ( Quanta = 0 ->
-            PI = own_prof_fast_det(Exits, Allocs, Words)
+            PI = own_prof_fast_det(Exits, CallSeqs, Allocs, Words)
         ;
-            PI = own_prof_det(Exits, Quanta, Allocs, Words)
+            PI = own_prof_det(Exits, Quanta, CallSeqs, Allocs, Words)
         )
     ;
-        PI = own_prof_all(Exits, Fails, Redos, Excps, Quanta, Allocs, Words)
+        PI = own_prof_all(Exits, Fails, Redos, Excps, Quanta, CallSeqs,
+            Allocs, Words)
     ).
 
 compress_profile(PI0) = PI :-
     (
-        PI0 = own_prof_all(Exits, Fails, Redos, Excps, Quanta, Allocs, Words),
+        PI0 = own_prof_all(Exits, Fails, Redos, Excps, Quanta, CallSeqs,
+            Allocs, Words),
         (
             Redos = 0,
             Excps = 0,
@@ -239,63 +277,64 @@
             Allocs = 0,
             Words = 0
         ->
-            PI = own_prof_fast_nomem_semi(Exits, Fails)
+            PI = own_prof_fast_nomem_semi(Exits, Fails, CallSeqs)
         ;
             Fails = 0,
             Redos = 0,
             Excps = 0
         ->
             ( Quanta = 0 ->
-                PI = own_prof_fast_det(Exits, Allocs, Words)
+                PI = own_prof_fast_det(Exits, CallSeqs, Allocs, Words)
             ;
-                PI = own_prof_det(Exits, Quanta, Allocs, Words)
+                PI = own_prof_det(Exits, Quanta, CallSeqs, Allocs, Words)
             )
         ;
             PI = PI0
         )
     ;
-        PI0 = own_prof_det(Exits, Quanta, Allocs, Words),
+        PI0 = own_prof_det(Exits, Quanta, CallSeqs, Allocs, Words),
         ( Allocs = 0, Words = 0 ->
-            PI = own_prof_fast_nomem_semi(Exits, 0)
+            PI = own_prof_fast_nomem_semi(Exits, 0, CallSeqs)
         ; Quanta = 0 ->
-            PI = own_prof_fast_det(Exits, Allocs, Words)
+            PI = own_prof_fast_det(Exits, CallSeqs, Allocs, Words)
         ;
             PI = PI0
         )
     ;
-        PI0 = own_prof_fast_det(Exits, Allocs, Words),
+        PI0 = own_prof_fast_det(Exits, CallSeqs, Allocs, Words),
         ( Allocs = 0, Words = 0 ->
-            PI = own_prof_fast_nomem_semi(Exits, 0)
+            PI = own_prof_fast_nomem_semi(Exits, 0, CallSeqs)
         ;
             PI = PI0
         )
     ;
-        PI0 = own_prof_fast_nomem_semi(_, _),
+        PI0 = own_prof_fast_nomem_semi(_, _, _),
         PI = PI0
     ).
 
 %-----------------------------------------------------------------------------%
 
-decompress_profile(Own, Calls, Exits, Fails, Redos, Excps,
-        Quanta, Allocs, Words) :-
+decompress_profile(Own, Calls, Exits, Fails, Redos, Excps, Quanta, CallSeqs,
+        Allocs, Words) :-
     (
-        Own = own_prof_all(Exits, Fails, Redos, Excps, Quanta, Allocs, Words),
+        Own = own_prof_all(Exits, Fails, Redos, Excps, Quanta, CallSeqs,
+            Allocs, Words),
         Calls = Exits + Fails + Redos
     ;
-        Own = own_prof_det(Exits, Quanta, Allocs, Words),
+        Own = own_prof_det(Exits, Quanta, CallSeqs, Allocs, Words),
         Calls = Exits,
         Fails = 0,
         Redos = 0,
         Excps = 0
     ;
-        Own = own_prof_fast_det(Exits, Allocs, Words),
+        Own = own_prof_fast_det(Exits, CallSeqs, Allocs, Words),
         Calls = Exits,
         Fails = 0,
         Redos = 0,
         Excps = 0,
         Quanta = 0
     ;
-        Own = own_prof_fast_nomem_semi(Exits, Fails),
+        Own = own_prof_fast_nomem_semi(Exits, Fails, CallSeqs),
         Calls = Exits + Fails,
         Redos = 0,
         Excps = 0,
@@ -304,39 +343,44 @@
         Words = 0
     ).
 
-own_to_string(own_prof_all(Exits, Fails, Redos, Excps, Quanta, Allocs, Words)) =
+own_to_string(own_prof_all(Exits, Fails, Redos, Excps, Quanta, CallSeqs,
+        Allocs, Words)) =
     "all(" ++
     string.int_to_string(Exits) ++ ", " ++
     string.int_to_string(Fails) ++ ", " ++
     string.int_to_string(Redos) ++ ", " ++
     string.int_to_string(Excps) ++ ", " ++
     string.int_to_string(Quanta) ++ ", " ++
+    string.int_to_string(CallSeqs) ++ ", " ++
     string.int_to_string(Allocs) ++ ", " ++
     string.int_to_string(Words) ++
     ")".
-own_to_string(own_prof_det(Exits, Quanta, Allocs, Words)) =
+own_to_string(own_prof_det(Exits, Quanta, CallSeqs, Allocs, Words)) =
     "det(" ++
     string.int_to_string(Exits) ++ ", " ++
     string.int_to_string(Quanta) ++ ", " ++
+    string.int_to_string(CallSeqs) ++ ", " ++
     string.int_to_string(Allocs) ++ ", " ++
     string.int_to_string(Words) ++
     ")".
-own_to_string(own_prof_fast_det(Exits, Allocs, Words)) =
+own_to_string(own_prof_fast_det(Exits, CallSeqs, Allocs, Words)) =
     "fast_det(" ++
     string.int_to_string(Exits) ++ ", " ++
+    string.int_to_string(CallSeqs) ++ ", " ++
     string.int_to_string(Allocs) ++ ", " ++
     string.int_to_string(Words) ++
     ")".
-own_to_string(own_prof_fast_nomem_semi(Exits, Fails)) =
+own_to_string(own_prof_fast_nomem_semi(Exits, Fails, CallSeqs)) =
     "fast_det(" ++
     string.int_to_string(Exits) ++ ", " ++
-    string.int_to_string(Fails) ++
+    string.int_to_string(Fails) ++ ", " ++
+    string.int_to_string(CallSeqs) ++
     ")".
 
-is_inactive(own_prof_all(0, 0, 0, 0, _, _, _)).
-is_inactive(own_prof_det(0, _, _, _)).
-is_inactive(own_prof_fast_det(0, _, _)).
-is_inactive(own_prof_fast_nomem_semi(0, 0)).
+is_inactive(own_prof_all(0, 0, 0, 0, _, _, _, _)).
+is_inactive(own_prof_det(0, _, _, _, _)).
+is_inactive(own_prof_fast_det(0, _, _, _)).
+is_inactive(own_prof_fast_nomem_semi(0, 0, _)).
 
 %----------------------------------------------------------------------------%
 :- end_module measurements.
Index: deep_profiler/read_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.15
diff -u -r1.15 read_profile.m
--- deep_profiler/read_profile.m	29 Sep 2006 06:15:11 -0000	1.15
+++ deep_profiler/read_profile.m	4 Oct 2006 04:47:32 -0000
@@ -123,7 +123,7 @@
 % This must the same string as the one written by MR_write_out_id_string
 % in runtime/mercury_deep_profiling.c.
 
-id_string = "Mercury deep profiler data version 1\n".
+id_string = "Mercury deep profiler data version 2\n".
 
 :- func init_deep(int, int, int, int, int, int, int, int, int, int)
     = initial_deep.
@@ -620,15 +620,17 @@
                 !MaybeError, !IO),
             maybe_read_num_handle_error(Mask, 0x0004, Fails,
                 !MaybeError, !IO),
-            maybe_read_num_handle_error(Mask, 0x0008, Redos,
+            maybe_read_num_handle_error(Mask, 0x0040, Redos,
                 !MaybeError, !IO),
-            maybe_read_num_handle_error(Mask, 0x0010, Excps,
+            maybe_read_num_handle_error(Mask, 0x0080, Excps,
                 !MaybeError, !IO),
-            maybe_read_num_handle_error(Mask, 0x0020, Quanta,
+            maybe_read_num_handle_error(Mask, 0x0100, Quanta,
                 !MaybeError, !IO),
-            maybe_read_num_handle_error(Mask, 0x0040, Mallocs,
+            maybe_read_num_handle_error(Mask, 0x0008, CallSeqs,
                 !MaybeError, !IO),
-            maybe_read_num_handle_error(Mask, 0x0080, Words,
+            maybe_read_num_handle_error(Mask, 0x0010, Allocs,
+                !MaybeError, !IO),
+            maybe_read_num_handle_error(Mask, 0x0020, Words,
                 !MaybeError, !IO),
             LastMaybeError = !.MaybeError
         ),
@@ -638,7 +640,7 @@
         ;
             LastMaybeError = no,
             Res = ok(compress_profile(Exits, Fails, Redos, Excps,
-                Quanta, Mallocs, Words))
+                Quanta, CallSeqs, Allocs, Words))
         )
     ;
         Res0 = error(Error),
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/exception.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.115
diff -u -r1.115 exception.m
--- library/exception.m	1 Oct 2006 23:32:09 -0000	1.115
+++ library/exception.m	4 Oct 2006 04:20:54 -0000
@@ -1588,7 +1588,7 @@
         entry_layout = return_label_layout->MR_sll_entry;
         if (!MR_DETISM_DET_STACK(entry_layout->MR_sle_detism)
             && MR_redoip_slot(base_curfr) ==
-            MR_ENTRY(MR_exception_handler_do_fail))
+                MR_ENTRY(MR_exception_handler_do_fail))
         {
             return NULL;
         }
@@ -1624,8 +1624,7 @@
         }
 
     #ifndef MR_USE_ACTIVATION_COUNTS
-        old_outermost_slot = proc_static->
-            MR_ps_old_outermost_stack_slot;
+        old_outermost_slot = proc_static->MR_ps_old_outermost_stack_slot;
 
         if (old_outermost_slot <= 0) {
             MR_fatal_error(""builtin_throw: no old_outer slot"");
@@ -1639,32 +1638,31 @@
                 MR_based_stackvar(base_sp, middle_csd_slot);
     #ifndef MR_USE_ACTIVATION_COUNTS
             old_outermost = (MR_ProcDynamic *)
-                MR_based_stackvar(base_sp,
-                    old_outermost_slot);
+                MR_based_stackvar(base_sp, old_outermost_slot);
     #endif
         } else {
             top_csd = (MR_CallSiteDynamic *)
                 MR_based_framevar(base_curfr, top_csd_slot);
             middle_csd = (MR_CallSiteDynamic *)
-                MR_based_framevar(base_curfr,
-                    middle_csd_slot);
+                MR_based_framevar(base_curfr, middle_csd_slot);
     #ifndef MR_USE_ACTIVATION_COUNTS
             old_outermost = (MR_ProcDynamic *)
-                MR_based_framevar(base_curfr,
-                    old_outermost_slot);
+                MR_based_framevar(base_curfr, old_outermost_slot);
     #endif
         }
 
         csd = middle_csd;
-        MR_deep_assert(csd, NULL, NULL,
-            csd == MR_current_call_site_dynamic);
+        MR_deep_assert(csd, NULL, NULL, csd == MR_current_call_site_dynamic);
 
     #ifdef MR_DEEP_PROFILING_PORT_COUNTS
         csd->MR_csd_own.MR_own_excps++;
     #endif
 
-        MR_deep_assert(csd, NULL, NULL,
-            csd->MR_csd_callee_ptr != NULL);
+    #ifdef MR_DEEP_PROFILING_CALL_SEQ
+        csd->MR_csd_own.MR_own_call_seqs += MR_deep_prof_cur_call_seq;
+    #endif
+
+        MR_deep_assert(csd, NULL, NULL, csd->MR_csd_callee_ptr != NULL);
         pl = csd->MR_csd_callee_ptr->MR_pd_proc_layout;
         MR_deep_assert(csd, pl, NULL, pl != NULL);
         ps = pl->MR_sle_proc_static;
@@ -1721,7 +1719,7 @@
 #define swap_heaps()                                                \\
 {                                                                   \\
     /* save the current heap */                                     \\
-    MR_Word     *swap_heaps_temp_hp;                                \\
+    MR_Word         *swap_heaps_temp_hp;                            \\
     MR_MemoryZone   *swap_heaps_temp_hp_zone;                       \\
                                                                     \\
     swap_heaps_temp_hp = MR_hp;                                     \\
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.88
diff -u -r1.88 mercury_conf_param.h
--- runtime/mercury_conf_param.h	20 Mar 2006 23:43:17 -0000	1.88
+++ runtime/mercury_conf_param.h	4 Oct 2006 04:12:07 -0000
@@ -534,7 +534,10 @@
 ** Enables deep profiling of port counts.
 **
 ** MR_DEEP_PROFILING_TIMING.
-** Enables deep profiling of time.
+** Enables deep profiling of time (obtained via clock interrupt signals).
+**
+** MR_DEEP_PROFILING_CALL_SEQ.
+** Enables deep profiling of time (obtained by counting call sequence numbers).
 **
 ** MR_DEEP_PROFILING_MEMORY.
 ** Enables deep profiling of memory usage.
@@ -545,11 +548,13 @@
   #define MR_DEEP_PROFILING_PORT_COUNTS
   #ifndef MR_DEEP_PROFILING_PERF_TEST
     #define MR_DEEP_PROFILING_TIMING
+    #define MR_DEEP_PROFILING_CALL_SEQ
     #define MR_DEEP_PROFILING_MEMORY
   #endif
 #else
   #undef  MR_DEEP_PROFILING_PORT_COUNTS
   #undef  MR_DEEP_PROFILING_TIMING
+  #undef  MR_DEEP_PROFILING_CALL_SEQ
   #undef  MR_DEEP_PROFILING_MEMORY
 #endif
 
Index: runtime/mercury_deep_call_port_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_call_port_body.h,v
retrieving revision 1.5
diff -u -r1.5 mercury_deep_call_port_body.h
--- runtime/mercury_deep_call_port_body.h	19 May 2004 03:59:44 -0000	1.5
+++ runtime/mercury_deep_call_port_body.h	4 Oct 2006 04:17:30 -0000
@@ -67,6 +67,11 @@
     #endif
   #endif
 
+  #ifdef MR_DEEP_PROFILING_CALL_SEQ
+	MR_deep_prof_cur_call_seq++;
+	csd->MR_csd_own.MR_own_call_seqs -= MR_deep_prof_cur_call_seq;
+  #endif
+
   #ifdef MR_DEEP_PROFILING_LOWLEVEL_DEBUG
 	/* After we copy it, MR_next_call_site_dynamic is not meaningful; */
 	/* zeroing it makes debugging output less cluttered. */
Index: runtime/mercury_deep_leave_port_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_leave_port_body.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_deep_leave_port_body.h
--- runtime/mercury_deep_leave_port_body.h	19 May 2004 03:59:44 -0000	1.4
+++ runtime/mercury_deep_leave_port_body.h	4 Oct 2006 04:16:07 -0000
@@ -58,6 +58,10 @@
     #endif
   #endif
 
+  #ifdef MR_DEEP_PROFILING_CALL_SEQ
+	csd->MR_csd_own.MR_own_call_seqs += MR_deep_prof_cur_call_seq;
+  #endif
+
 	MR_deep_assert(csd, NULL, NULL, csd->MR_csd_callee_ptr != NULL);
 	pl = csd->MR_csd_callee_ptr->MR_pd_proc_layout;
 	MR_deep_assert(csd, pl, NULL, pl != NULL);
Index: runtime/mercury_deep_profiling.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_profiling.c,v
retrieving revision 1.20
diff -u -r1.20 mercury_deep_profiling.c
--- runtime/mercury_deep_profiling.c	3 Oct 2006 03:29:58 -0000	1.20
+++ runtime/mercury_deep_profiling.c	4 Oct 2006 04:46:49 -0000
@@ -105,10 +105,15 @@
 MR_CallSiteDynamic  *MR_next_call_site_dynamic = NULL;
 MR_CallSiteDynList  **MR_current_callback_site = (MR_CallSiteDynList **)
                         &MR_main_parent_call_site_dynamics[0];
+
 volatile MR_bool    MR_inside_deep_profiling_code = MR_FALSE;
 volatile unsigned   MR_quanta_inside_deep_profiling_code = 0;
 volatile unsigned   MR_quanta_outside_deep_profiling_code = 0;
 
+#ifdef  MR_DEEP_PROFILING_CALL_SEQ
+unsigned            MR_deep_prof_cur_call_seq = 0;
+#endif
+
 #ifdef  MR_DEEP_PROFILING_STATISTICS
 
 int MR_deep_num_csd_nodes = 0;
@@ -636,7 +641,7 @@
 MR_write_out_id_string(FILE *fp)
 {
     /* Must be the same as id_string in deep_profiler/read_profile.m */
-    const char  *id_string = "Mercury deep profiler data version 1\n";
+    const char  *id_string = "Mercury deep profiler data version 2\n";
 
     fputs(id_string, fp);
 }
@@ -909,7 +914,7 @@
         bitmask |= 0x0004;
     }
     if (csd->MR_csd_own.MR_own_redos != 0) {
-        bitmask |= 0x0008;
+        bitmask |= 0x0040;
     }
     if (csd->MR_csd_own.MR_own_excps != 0) {
         bitmask |= 0x0010;
@@ -917,15 +922,20 @@
 #endif
 #ifdef MR_DEEP_PROFILING_TIMING
     if (csd->MR_csd_own.MR_own_quanta != 0) {
-        bitmask |= 0x0020;
+        bitmask |= 0x0100;
+    }
+#endif
+#ifdef MR_DEEP_PROFILING_CALL_SEQ
+    if (csd->MR_csd_own.MR_own_call_seqs != 0) {
+        bitmask |= 0x0008;
     }
 #endif
 #ifdef MR_DEEP_PROFILING_MEMORY
     if (csd->MR_csd_own.MR_own_allocs != 0) {
-        bitmask |= 0x0040;
+        bitmask |= 0x0010;
     }
     if (csd->MR_csd_own.MR_own_words != 0) {
-        bitmask |= 0x0080;
+        bitmask |= 0x0020;
     }
 #endif
 
Index: runtime/mercury_deep_profiling.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_profiling.h,v
retrieving revision 1.14
diff -u -r1.14 mercury_deep_profiling.h
--- runtime/mercury_deep_profiling.h	20 May 2004 22:53:31 -0000	1.14
+++ runtime/mercury_deep_profiling.h	4 Oct 2006 04:13:13 -0000
@@ -41,6 +41,9 @@
 #ifdef MR_DEEP_PROFILING_TIMING
 	volatile unsigned			MR_own_quanta;
 #endif
+#ifdef MR_DEEP_PROFILING_CALL_SEQ
+	unsigned				MR_own_call_seqs;
+#endif
 #ifdef MR_DEEP_PROFILING_MEMORY
 	unsigned				MR_own_allocs;
 	unsigned				MR_own_words;
@@ -148,6 +151,16 @@
   	((void) 0)
 #endif
 
+#ifdef MR_DEEP_PROFILING_CALL_SEQ
+  #define MR_init_own_call_seqs(csd)					\
+  	do {								\
+		(csd)->MR_csd_own.MR_own_call_seqs = 0;			\
+	} while (0)
+#else
+  #define MR_init_own_call_seqs(csd)					\
+  	((void) 0)
+#endif
+
 #ifdef MR_DEEP_PROFILING_MEMORY
   #define MR_init_own_memory(csd)					\
   	do {								\
@@ -176,6 +189,7 @@
 		newcsd->MR_csd_callee_ptr = NULL;			\
 		MR_init_own_ports(newcsd);				\
 		MR_init_own_quanta(newcsd);				\
+		MR_init_own_call_seqs(newcsd);				\
 		MR_init_own_memory(newcsd);				\
 		MR_init_depth_count(newcsd);				\
 	} while (0)
@@ -309,6 +323,10 @@
 extern	volatile unsigned		MR_quanta_inside_deep_profiling_code;
 extern	volatile unsigned		MR_quanta_outside_deep_profiling_code;
 
+#ifdef MR_DEEP_PROFILING_CALL_SEQ
+extern	unsigned			MR_deep_prof_cur_call_seq;
+#endif
+
 #ifdef MR_DEEP_PROFILING_STATISTICS
 
 #define MR_MAX_CLOSURE_LIST_LENGTH 256
Index: runtime/mercury_deep_redo_port_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_redo_port_body.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_deep_redo_port_body.h
--- runtime/mercury_deep_redo_port_body.h	19 May 2004 03:59:44 -0000	1.4
+++ runtime/mercury_deep_redo_port_body.h	4 Oct 2006 04:17:34 -0000
@@ -43,6 +43,10 @@
 	csd->MR_csd_own.MR_own_redos++;
   #endif
 
+  #ifdef MR_DEEP_PROFILING_CALL_SEQ
+	csd->MR_csd_own.MR_own_call_seqs -= MR_deep_prof_cur_call_seq;
+  #endif
+
 	pd = csd->MR_csd_callee_ptr;
 	MR_deep_assert(csd, NULL, NULL, pd != NULL);
 	pl = pd->MR_pd_proc_layout;
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.65
diff -u -r1.65 mercury_grade.h
--- runtime/mercury_grade.h	2 Oct 2006 09:06:50 -0000	1.65
+++ runtime/mercury_grade.h	4 Oct 2006 04:47:16 -0000
@@ -62,7 +62,7 @@
 
 #define MR_GRADE_PART_0	v14_
 #define MR_GRADE_EXEC_TRACE_VERSION_NO	6
-#define MR_GRADE_DEEP_PROF_VERSION_NO	1
+#define MR_GRADE_DEEP_PROF_VERSION_NO	2
 
 #ifdef MR_HIGHLEVEL_CODE
 
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post 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