[m-rev.] diff: mercury_debug.c fixes
Zoltan Somogyi
zs at csse.unimelb.edu.au
Mon Oct 30 12:31:01 AEDT 2006
runtime/mercury_debug.c:
Update some debugging code for the recent addition of a new field
in the deep profiling measurement structure.
Fix some deviations from our style guide.
Zoltan.
cvs diff: Diffing .
Index: mercury_debug.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_debug.c,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_debug.c
--- mercury_debug.c 15 Sep 2006 04:08:53 -0000 1.25
+++ mercury_debug.c 29 Oct 2006 09:40:33 -0000
@@ -48,10 +48,10 @@
#ifdef MR_DEEP_PROFILING
static void MR_check_watch_csd_start(MR_Code *proc);
-static MR_bool MR_csds_are_different(MR_CallSiteDynamic *csd1,
- MR_CallSiteDynamic *csd2);
+static MR_bool MR_csds_are_different(const MR_CallSiteDynamic *csd1,
+ const MR_CallSiteDynamic *csd2);
static void MR_assign_csd(MR_CallSiteDynamic *csd1,
- MR_CallSiteDynamic *csd2);
+ const MR_CallSiteDynamic *csd2);
#endif
static void MR_count_call(MR_Code *proc);
@@ -597,7 +597,6 @@
printf("min %lu, max %lu, more <%s>\n",
MR_lld_print_min, MR_lld_print_max,
MR_lld_print_more_min_max);
-
}
}
@@ -657,8 +656,7 @@
printf("offset %3ld words\n",
(long) (MR_Integer) (h - MR_ENGINE(MR_eng_heap_zone)->min));
#else
- printf("ptr %p\n",
- (const void *) h);
+ printf("ptr %p\n", (const void *) h);
#endif
}
@@ -740,8 +738,7 @@
#ifndef MR_CONSERVATIVE_GC
if ((MR_Integer) MR_ENGINE(MR_eng_heap_zone)->min <= value
- && value < (MR_Integer)
- MR_ENGINE(MR_eng_heap_zone)->top)
+ && value < (MR_Integer) MR_ENGINE(MR_eng_heap_zone)->top)
{
printf("(heap) ");
}
@@ -770,6 +767,9 @@
#ifdef MR_DEEP_PROFILING_TIMING
/* MR_own_quanta */ 0,
#endif
+ #ifdef MR_DEEP_PROFILING_CALL_SEQ
+ /* MR_own_call_seqs */ 0,
+ #endif
#ifdef MR_DEEP_PROFILING_MEMORY
/* MR_own_allocs */ 0,
/* MR_own_words */ 0,
@@ -789,8 +789,7 @@
if (MR_proc_matches_name(proc, MR_watch_csd_start_name)) {
if (MR_watch_csd_addr == MR_next_call_site_dynamic) {
/*
- ** Optimize future checks and make
- ** MR_watch_csd_addr static.
+ ** Optimize future checks and make MR_watch_csd_addr static.
*/
MR_watch_csd_started = MR_TRUE;
MR_watch_csd_start_name = NULL;
@@ -800,48 +799,63 @@
}
static MR_bool
-MR_csds_are_different(MR_CallSiteDynamic *csd1, MR_CallSiteDynamic *csd2)
+MR_csds_are_different(const MR_CallSiteDynamic *csd1,
+ const MR_CallSiteDynamic *csd2)
{
- MR_ProfilingMetrics *pm1;
- MR_ProfilingMetrics *pm2;
+ const MR_ProfilingMetrics *pm1;
+ const MR_ProfilingMetrics *pm2;
- if (csd1->MR_csd_callee_ptr != csd2->MR_csd_callee_ptr)
+ if (csd1->MR_csd_callee_ptr != csd2->MR_csd_callee_ptr) {
return MR_TRUE;
+ }
pm1 = &csd1->MR_csd_own;
pm2 = &csd2->MR_csd_own;
#ifdef MR_DEEP_PROFILING_PORT_COUNTS
#ifdef MR_DEEP_PROFILING_EXPLICIT_CALL_COUNTS
- if (pm1->MR_own_calls != pm2->MR_own_calls)
+ if (pm1->MR_own_calls != pm2->MR_own_calls) {
return MR_TRUE;
+ }
#endif
- if (pm1->MR_own_exits != pm2->MR_own_exits)
+ if (pm1->MR_own_exits != pm2->MR_own_exits) {
return MR_TRUE;
- if (pm1->MR_own_fails != pm2->MR_own_fails)
+ }
+ if (pm1->MR_own_fails != pm2->MR_own_fails) {
return MR_TRUE;
- if (pm1->MR_own_redos != pm2->MR_own_redos)
+ }
+ if (pm1->MR_own_redos != pm2->MR_own_redos) {
return MR_TRUE;
+ }
#endif
#ifdef MR_DEEP_PROFILING_TIMING
- if (pm1->MR_own_quanta != pm2->MR_own_quanta)
+ if (pm1->MR_own_quanta != pm2->MR_own_quanta) {
+ return MR_TRUE;
+ }
+ #endif
+ #ifdef MR_DEEP_PROFILING_CALL_SEQ
+ if (pm1->MR_own_call_seqs != pm2->MR_own_call_seqs) {
return MR_TRUE;
+ }
#endif
#ifdef MR_DEEP_PROFILING_MEMORY
- if (pm1->MR_own_allocs != pm2->MR_own_allocs)
+ if (pm1->MR_own_allocs != pm2->MR_own_allocs) {
return MR_TRUE;
- if (pm1->MR_own_words != pm2->MR_own_words)
+ }
+ if (pm1->MR_own_words != pm2->MR_own_words) {
return MR_TRUE;
+ }
#endif
- if (csd1->MR_csd_depth_count != csd2->MR_csd_depth_count)
+ if (csd1->MR_csd_depth_count != csd2->MR_csd_depth_count) {
return MR_TRUE;
+ }
return MR_FALSE;
};
static void
-MR_assign_csd(MR_CallSiteDynamic *csd1, MR_CallSiteDynamic *csd2)
+MR_assign_csd(MR_CallSiteDynamic *csd1, const MR_CallSiteDynamic *csd2)
{
csd1->MR_csd_callee_ptr = csd2->MR_csd_callee_ptr;
@@ -854,9 +868,11 @@
csd1->MR_csd_own.MR_own_redos = csd2->MR_csd_own.MR_own_redos;
#endif
#ifdef MR_DEEP_PROFILING_TIMING
- /* MR_own_quanta */ 0,
csd1->MR_csd_own.MR_own_quanta = csd2->MR_csd_own.MR_own_quanta;
#endif
+ #ifdef MR_DEEP_PROFILING_CALL_SEQ
+ csd1->MR_csd_own.MR_own_call_seqs = csd2->MR_csd_own.MR_own_call_seqs;
+ #endif
#ifdef MR_DEEP_PROFILING_MEMORY
csd1->MR_csd_own.MR_own_allocs = csd2->MR_csd_own.MR_own_allocs;
csd1->MR_csd_own.MR_own_words = csd2->MR_csd_own.MR_own_words;
@@ -881,11 +897,9 @@
if (MR_csds_are_different(&MR_watched_csd_last_value,
MR_watch_csd_addr))
{
- MR_assign_csd(&MR_watched_csd_last_value,
- MR_watch_csd_addr);
+ MR_assign_csd(&MR_watched_csd_last_value, MR_watch_csd_addr);
printf("current call: %lu\n", MR_lld_cur_call);
- MR_print_deep_prof_var(stdout, "watch_csd",
- MR_watch_csd_addr);
+ MR_print_deep_prof_var(stdout, "watch_csd", MR_watch_csd_addr);
}
}
}
@@ -937,8 +951,7 @@
printf("ptr %p, ", (const void *) s);
}
- printf("offset %3ld words\n",
- (long) (MR_Integer) MR_det_stack_offset(s));
+ printf("offset %3ld words\n", (long) (MR_Integer) MR_det_stack_offset(s));
}
void
@@ -950,12 +963,10 @@
void
MR_print_nondstackptr(FILE *fp, const MR_Word *s)
{
- fprintf(fp, "non %3ld",
- (long) (MR_Integer) MR_non_stack_offset(s));
+ fprintf(fp, "non %3ld", (long) (MR_Integer) MR_non_stack_offset(s));
if (MR_print_raw_addrs) {
- fprintf(fp, " (%p)",
- (const void *) s);
+ fprintf(fp, " (%p)", (const void *) s);
}
}
@@ -966,8 +977,7 @@
printf("ptr %p, ", (const void *) s);
}
- printf("offset %3ld words\n",
- (long) (MR_Integer) MR_non_stack_offset(s));
+ printf("offset %3ld words\n", (long) (MR_Integer) MR_non_stack_offset(s));
}
#endif /* !MR_HIGHLEVEL_CODE */
@@ -1001,8 +1011,7 @@
}
#ifdef MR_DEBUG_LABEL_GOAL_PATHS
if (internal->i_layout != NULL) {
- fprintf(fp, " <%s>",
- MR_label_goal_path(internal->i_layout));
+ fprintf(fp, " <%s>", MR_label_goal_path(internal->i_layout));
}
#endif
} else {
@@ -1014,8 +1023,7 @@
if (entry->e_name != NULL) {
fprintf(fp, "entry label %s", entry->e_name);
} else {
- fprintf(fp, "unnamed entry label %p",
- entry->e_addr);
+ fprintf(fp, "unnamed entry label %p", entry->e_addr);
}
} else {
fprintf(fp, "label UNKNOWN %p", w);
@@ -1051,8 +1059,7 @@
const MR_ProcStatic *ps;
const MR_Proc_Id *proc_id;
- fprintf(fp, ", depth %d,",
- csd->MR_csd_depth_count);
+ fprintf(fp, ", depth %d,", csd->MR_csd_depth_count);
#ifdef MR_DEEP_PROFILING_EXPLICIT_CALL_COUNTS
fprintf(fp, " calls %d,",
@@ -1076,31 +1083,24 @@
proc_id = &pl->MR_sle_proc_id;
if (MR_PROC_ID_IS_UCI(*proc_id)) {
fprintf(fp, " %s:%s %s/%d-%d\n ",
- proc_id->MR_proc_uci.
- MR_uci_type_module,
- proc_id->MR_proc_uci.
- MR_uci_type_name,
- proc_id->MR_proc_uci.
- MR_uci_pred_name,
- proc_id->MR_proc_uci.
- MR_uci_type_arity,
+ proc_id->MR_proc_uci.MR_uci_type_module,
+ proc_id->MR_proc_uci.MR_uci_type_name,
+ proc_id->MR_proc_uci.MR_uci_pred_name,
+ proc_id->MR_proc_uci.MR_uci_type_arity,
proc_id->MR_proc_uci.MR_uci_mode);
} else {
fprintf(fp, " %s.%s/%d-%d\n ",
- proc_id->MR_proc_user.
- MR_user_decl_module,
+ proc_id->MR_proc_user.MR_user_decl_module,
proc_id->MR_proc_user.MR_user_name,
proc_id->MR_proc_user.MR_user_arity,
proc_id->MR_proc_user.MR_user_mode);
}
#ifdef MR_USE_ACTIVATION_COUNTS
- fprintf(fp, "active %d, ",
- ps->MR_ps_activation_count);
+ fprintf(fp, "active %d, ", ps->MR_ps_activation_count);
#endif
fprintf(fp, "outermost %p, array %d\n",
- ps->MR_ps_outermost_activation_ptr,
- ps->MR_ps_num_call_sites);
+ ps->MR_ps_outermost_activation_ptr, ps->MR_ps_num_call_sites);
}
}
#endif
cvs diff: Diffing GETOPT
cvs diff: Diffing machdeps
--------------------------------------------------------------------------
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