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);
|
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)
|
static Int p_show_low_level_trace(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Call counter=%lld\n",vsc_count);
|
fprintf(stderr,"Call counter=%lld\n",vsc_count);
|
||||||
@ -414,6 +424,8 @@ Yap_InitLowLevelTrace(void)
|
|||||||
#endif
|
#endif
|
||||||
Yap_InitCPred("stop_low_level_trace", 0, p_stop_low_level_trace, SafePredFlag);
|
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("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);
|
Yap_InitCPred("vsc_wait", 0, p_vsc_wait, SafePredFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,6 +731,12 @@ Macros to check the limits of stacks
|
|||||||
while ( pt0 > XREGS ); \
|
while ( pt0 > XREGS ); \
|
||||||
ENDP(pt0)
|
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 *
|
* Do the bulk of work in creating a choice-point *
|
||||||
* AP: alternative pointer *
|
* AP: alternative pointer *
|
||||||
@ -747,6 +753,7 @@ Macros to check the limits of stacks
|
|||||||
|
|
||||||
#define store_yaam_regs(AP,I) \
|
#define store_yaam_regs(AP,I) \
|
||||||
{ /* Jump to CP_BASE */ \
|
{ /* Jump to CP_BASE */ \
|
||||||
|
COUNT_CPS(); \
|
||||||
S_YREG = (CELL *)((choiceptr)((S_YREG)-(I))-1); \
|
S_YREG = (CELL *)((choiceptr)((S_YREG)-(I))-1); \
|
||||||
/* Save Information */ \
|
/* Save Information */ \
|
||||||
HBREG = H; \
|
HBREG = H; \
|
||||||
@ -760,6 +767,7 @@ Macros to check the limits of stacks
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define store_yaam_regs_for_either(AP,d0) \
|
#define store_yaam_regs_for_either(AP,d0) \
|
||||||
|
COUNT_CPS(); \
|
||||||
pt1 --; /* Jump to CP_BASE */ \
|
pt1 --; /* Jump to CP_BASE */ \
|
||||||
/* Save Information */ \
|
/* Save Information */ \
|
||||||
HBREG = H; \
|
HBREG = H; \
|
||||||
|
@ -95,6 +95,9 @@
|
|||||||
#define TotGcRecovered WL->tot_gc_recovered
|
#define TotGcRecovered WL->tot_gc_recovered
|
||||||
#define LastGcTime WL->last_gc_time
|
#define LastGcTime WL->last_gc_time
|
||||||
#define LastSSTime WL->last_ss_time
|
#define LastSSTime WL->last_ss_time
|
||||||
|
#if LOW_LEVEL_TRACER
|
||||||
|
#define Yap_total_choicepoints WL->total_cps
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
#define SignalLock WL->signal_lock
|
#define SignalLock WL->signal_lock
|
||||||
|
@ -97,6 +97,9 @@ typedef struct worker_local {
|
|||||||
YAP_ULONG_LONG tot_gc_recovered;
|
YAP_ULONG_LONG tot_gc_recovered;
|
||||||
Int last_gc_time;
|
Int last_gc_time;
|
||||||
Int last_ss_time;
|
Int last_ss_time;
|
||||||
|
#if LOW_LEVEL_TRACER
|
||||||
|
Int total_cps;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
lockvar signal_lock;
|
lockvar signal_lock;
|
||||||
|
@ -95,6 +95,9 @@ static void InitWorker(int wid) {
|
|||||||
FOREIGN_WL(wid)->tot_gc_recovered = 0L;
|
FOREIGN_WL(wid)->tot_gc_recovered = 0L;
|
||||||
FOREIGN_WL(wid)->last_gc_time = 0L;
|
FOREIGN_WL(wid)->last_gc_time = 0L;
|
||||||
FOREIGN_WL(wid)->last_ss_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)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
INIT_LOCK(FOREIGN_WL(wid)->signal_lock);
|
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)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
REINIT_LOCK(FOREIGN_WL(wid)->signal_lock);
|
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_gc_time LastGcTime =0L
|
||||||
Int last_ss_time LastSSTime =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
|
// global variables that cannot be global in a thread/or-p implementation
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
lockvar signal_lock SignalLock MkLock
|
lockvar signal_lock SignalLock MkLock
|
||||||
|
Reference in New Issue
Block a user