trace the total number of choice-points created in profiling mode.
This commit is contained in:
parent
7fd6faea64
commit
d0a5571900
12
C/tracer.c
12
C/tracer.c
@ -372,6 +372,16 @@ static Int p_start_low_level_trace(void)
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static Int p_total_choicepoints(void)
|
||||
{
|
||||
return Yap_unify(MkIntegerTerm(Yap_total_choicepoints),ARG1);
|
||||
}
|
||||
|
||||
static Int p_reset_total_choicepoints(void)
|
||||
{
|
||||
Yap_total_choicepoints = 0;
|
||||
}
|
||||
|
||||
static Int p_show_low_level_trace(void)
|
||||
{
|
||||
fprintf(stderr,"Call counter=%lld\n",vsc_count);
|
||||
@ -414,6 +424,8 @@ Yap_InitLowLevelTrace(void)
|
||||
#endif
|
||||
Yap_InitCPred("stop_low_level_trace", 0, p_stop_low_level_trace, SafePredFlag);
|
||||
Yap_InitCPred("show_low_level_trace", 0, p_show_low_level_trace, SafePredFlag);
|
||||
Yap_InitCPred("total_choicepoints", 1, p_total_choicepoints, SafePredFlag);
|
||||
Yap_InitCPred("reset_total_choicepoints", 0, p_reset_total_choicepoints, SafePredFlag);
|
||||
Yap_InitCPred("vsc_wait", 0, p_vsc_wait, SafePredFlag);
|
||||
}
|
||||
|
||||
|
@ -731,6 +731,12 @@ Macros to check the limits of stacks
|
||||
while ( pt0 > XREGS ); \
|
||||
ENDP(pt0)
|
||||
|
||||
#if LOW_LEVEL_TRACER
|
||||
#define COUNT_CPS() Yap_total_choicepoints++
|
||||
#else
|
||||
#define COUNT_CPS()
|
||||
#endif
|
||||
|
||||
/***************************************************************
|
||||
* Do the bulk of work in creating a choice-point *
|
||||
* AP: alternative pointer *
|
||||
@ -747,6 +753,7 @@ Macros to check the limits of stacks
|
||||
|
||||
#define store_yaam_regs(AP,I) \
|
||||
{ /* Jump to CP_BASE */ \
|
||||
COUNT_CPS(); \
|
||||
S_YREG = (CELL *)((choiceptr)((S_YREG)-(I))-1); \
|
||||
/* Save Information */ \
|
||||
HBREG = H; \
|
||||
@ -760,6 +767,7 @@ Macros to check the limits of stacks
|
||||
}
|
||||
|
||||
#define store_yaam_regs_for_either(AP,d0) \
|
||||
COUNT_CPS(); \
|
||||
pt1 --; /* Jump to CP_BASE */ \
|
||||
/* Save Information */ \
|
||||
HBREG = H; \
|
||||
|
@ -95,6 +95,9 @@
|
||||
#define TotGcRecovered WL->tot_gc_recovered
|
||||
#define LastGcTime WL->last_gc_time
|
||||
#define LastSSTime WL->last_ss_time
|
||||
#if LOW_LEVEL_TRACER
|
||||
#define Yap_total_choicepoints WL->total_cps
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define SignalLock WL->signal_lock
|
||||
|
@ -97,6 +97,9 @@ typedef struct worker_local {
|
||||
YAP_ULONG_LONG tot_gc_recovered;
|
||||
Int last_gc_time;
|
||||
Int last_ss_time;
|
||||
#if LOW_LEVEL_TRACER
|
||||
Int total_cps;
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar signal_lock;
|
||||
|
@ -95,6 +95,9 @@ static void InitWorker(int wid) {
|
||||
FOREIGN_WL(wid)->tot_gc_recovered = 0L;
|
||||
FOREIGN_WL(wid)->last_gc_time = 0L;
|
||||
FOREIGN_WL(wid)->last_ss_time = 0L;
|
||||
#if LOW_LEVEL_TRACER
|
||||
FOREIGN_WL(wid)->total_cps = 0;
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(FOREIGN_WL(wid)->signal_lock);
|
||||
|
@ -95,6 +95,9 @@ static void RestoreWorker(int wid) {
|
||||
|
||||
|
||||
|
||||
#if LOW_LEVEL_TRACER
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(FOREIGN_WL(wid)->signal_lock);
|
||||
|
@ -104,6 +104,10 @@ YAP_ULONG_LONG tot_gc_recovered TotGcRecovered =0L
|
||||
Int last_gc_time LastGcTime =0L
|
||||
Int last_ss_time LastSSTime =0L
|
||||
|
||||
#if LOW_LEVEL_TRACER
|
||||
Int total_cps Yap_total_choicepoints =0
|
||||
#endif
|
||||
|
||||
// global variables that cannot be global in a thread/or-p implementation
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar signal_lock SignalLock MkLock
|
||||
|
Reference in New Issue
Block a user