[m-rev.] for review: print more statistics when generating the EDT

Ian MacLarty maclarty at cs.mu.OZ.AU
Sun Jun 12 18:54:53 AEST 2005


For review by Zoltan.

Estimated hours taken: 0.1
Branches: main

trace/mercury_trace_declarative.c:
	Print the resident set size after garbage collection when printing the
	EDT generation stats for the declarative debugger.

	Also print the time before garbage collection (the time after GC is
	already printed).

	Reformat the output slightly.

Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.90
diff -u -r1.90 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	11 Jun 2005 04:15:03 -0000	1.90
+++ trace/mercury_trace_declarative.c	12 Jun 2005 08:52:23 -0000
@@ -2462,7 +2462,9 @@
 MR_decl_print_edt_stats()
 {
     MR_Event_Details    event_details;
-    MR_bool            debug_enabled_before = MR_debug_enabled;
+    MR_bool             debug_enabled_before = MR_debug_enabled;
+    pid_t               pid;
+    char                cmdstr[200];

     MR_edt_stats_total_constructed_nodes +=
         MR_edt_stats_constructed_nodes_this_time;
@@ -2474,16 +2476,18 @@
     ** writes to stderr.
     */
     fprintf(stderr, "EDT construction stats: \n");
-    fprintf(stderr, "\tTotal reexecutions so far = %i\n",
+    fprintf(stderr, "Total reexecutions so far = %i\n",
         MR_edt_stats_total_reexecutions);
-    fprintf(stderr, "\tNodes constructed in this run = %i\n",
+    fprintf(stderr, "Nodes constructed in this run = %i\n",
         MR_edt_stats_constructed_nodes_this_time);
-    fprintf(stderr, "\tMax depth for this run = %i\n",
+    fprintf(stderr, "Max depth for this run = %i\n",
         MR_edt_max_depth);
-    fprintf(stderr, "\tTotal nodes constructed so far = %i\n",
+    fprintf(stderr, "Total nodes constructed so far = %i\n",
         MR_edt_stats_total_constructed_nodes);
-    fprintf(stderr, "\tCurrent event = %i\n", MR_trace_event_number);
-    fprintf(stderr, "Benchmarking stats follow:\n");
+    fprintf(stderr, "Current event = %i\n", MR_trace_event_number);
+    fprintf(stderr, "Total CPU time (before GC) = %.2f\n",
+        MR_get_user_cpu_miliseconds() / 1000.0);
+    fprintf(stderr, "Performing GC...\n");

     MR_debug_enabled = MR_FALSE;
     MR_update_trace_func_enabled();
@@ -2499,6 +2503,12 @@
         ML_garbage_collect();
         ML_report_stats();
     );
+
+    pid = getpid();
+    sprintf(cmdstr, "ps -o pid,rss | grep %i | awk '{print $2}' 1>&2", pid);
+    fprintf(stderr, "\tRSS (After GC) = ");
+    system(cmdstr);
+    fprintf(stderr, "\n");

     /*
     ** Restore the trace globals in case the called Mercury code is traced.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list