added Low Profiler to yap
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@804 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
0418e54be4
commit
1febfedc9d
@ -106,6 +106,10 @@ STATIC_PROTO(void a_fetch_cv, (void));
|
|||||||
STATIC_PROTO(void a_fetch_vc, (void));
|
STATIC_PROTO(void a_fetch_vc, (void));
|
||||||
STATIC_PROTO(void a_f2, (int));
|
STATIC_PROTO(void a_f2, (int));
|
||||||
|
|
||||||
|
#ifdef LOW_PROF
|
||||||
|
int PROFSIZE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CELLSIZE sizeof(CELL)
|
#define CELLSIZE sizeof(CELL)
|
||||||
|
|
||||||
#define MaxLabels 2048
|
#define MaxLabels 2048
|
||||||
@ -2614,6 +2618,11 @@ Yap_assemble(int mode)
|
|||||||
YAPLeaveCriticalSection();
|
YAPLeaveCriticalSection();
|
||||||
{
|
{
|
||||||
Clause *cl = (Clause *)code_addr; /* lcc, why? */
|
Clause *cl = (Clause *)code_addr; /* lcc, why? */
|
||||||
|
|
||||||
|
#ifdef LOW_PROF
|
||||||
|
PROFSIZE=code_p;
|
||||||
|
#endif
|
||||||
|
|
||||||
return(cl->ClCode);
|
return(cl->ClCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
C/compiler.c
29
C/compiler.c
@ -2896,6 +2896,35 @@ Yap_cclause(Term inp_clause, int NOfArgs, int mod)
|
|||||||
#endif
|
#endif
|
||||||
/* phase 3: assemble code */
|
/* phase 3: assemble code */
|
||||||
acode = Yap_assemble(ASSEMBLING_CLAUSE);
|
acode = Yap_assemble(ASSEMBLING_CLAUSE);
|
||||||
|
|
||||||
|
#ifdef LOW_PROF
|
||||||
|
{
|
||||||
|
static int pred_count=0;
|
||||||
|
FILE *f,*init;
|
||||||
|
extern int PROFSIZE;
|
||||||
|
|
||||||
|
if (!pred_count++) {
|
||||||
|
f=fopen("PROFPREDS","w");
|
||||||
|
init=fopen("PROFINIT","r");
|
||||||
|
if (init!=NULL) {
|
||||||
|
size_t nc; char buffer[4100];
|
||||||
|
do {
|
||||||
|
nc=fread(buffer,1,4096,init);
|
||||||
|
fwrite(buffer,1,nc,f);
|
||||||
|
} while(nc>0);
|
||||||
|
fclose(init);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
f=fopen("PROFPREDS","a");
|
||||||
|
}
|
||||||
|
if (f!=NULL) {
|
||||||
|
fprintf(f,"%x - %x - Pred(%d) - %s/%d\n",acode,PROFSIZE, CodeStart->rnd1, RepAtom(AtomOfTerm(MkAtomTerm((Atom) CodeStart->rnd1)))->StrOfAE, CodeStart->rnd2);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* check first if there was space for us */
|
/* check first if there was space for us */
|
||||||
if (acode == NIL) {
|
if (acode == NIL) {
|
||||||
/* make sure we have enough space */
|
/* make sure we have enough space */
|
||||||
|
@ -1323,6 +1323,10 @@ MSCHandleSignal(DWORD dwCtrlType) {
|
|||||||
static void
|
static void
|
||||||
InitSignals (void)
|
InitSignals (void)
|
||||||
{
|
{
|
||||||
|
#ifdef LOW_PROF
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
||||||
my_signal (SIGQUIT, ReceiveSignal);
|
my_signal (SIGQUIT, ReceiveSignal);
|
||||||
my_signal (SIGKILL, ReceiveSignal);
|
my_signal (SIGKILL, ReceiveSignal);
|
||||||
@ -2001,7 +2005,11 @@ p_alarm(void)
|
|||||||
Int left;
|
Int left;
|
||||||
Term tout;
|
Term tout;
|
||||||
|
|
||||||
|
#ifdef LOW_PROF
|
||||||
|
left=0;
|
||||||
|
#else
|
||||||
left = alarm(IntegerOfTerm(t));
|
left = alarm(IntegerOfTerm(t));
|
||||||
|
#endif
|
||||||
tout = MkIntegerTerm(left);
|
tout = MkIntegerTerm(left);
|
||||||
return(Yap_unify(ARG2,tout));
|
return(Yap_unify(ARG2,tout));
|
||||||
}
|
}
|
||||||
|
14
configure
vendored
14
configure
vendored
@ -832,6 +832,7 @@ Optional Features:
|
|||||||
--enable-wam-profile support low level profiling of abstract machine
|
--enable-wam-profile support low level profiling of abstract machine
|
||||||
--enable-depth-limit support depth-bound computation
|
--enable-depth-limit support depth-bound computation
|
||||||
--enable-or-parallelism support or-parallelism as: env-copy,sba,a-cow
|
--enable-or-parallelism support or-parallelism as: env-copy,sba,a-cow
|
||||||
|
--enable-low-profile support for low-level profiling
|
||||||
--enable-low-level-tracer support support for procedure-call tracing
|
--enable-low-level-tracer support support for procedure-call tracing
|
||||||
--enable-tabling support tabling as: batched,local
|
--enable-tabling support tabling as: batched,local
|
||||||
--enable-threads support system threads
|
--enable-threads support system threads
|
||||||
@ -2005,6 +2006,13 @@ if test "${enable_depth_limit+set}" = set; then
|
|||||||
else
|
else
|
||||||
depthlimit=no
|
depthlimit=no
|
||||||
fi;
|
fi;
|
||||||
|
#check whether --enable-low-profile or --disable-low-profile was given.
|
||||||
|
if test "${enable_low_profile+set}" = set; then
|
||||||
|
enableval="$enable_low_profile"
|
||||||
|
lowprofile="$enableval"
|
||||||
|
else
|
||||||
|
lowprofile=no
|
||||||
|
fi;
|
||||||
# Check whether --enable-or-parallelism or --disable-or-parallelism was given.
|
# Check whether --enable-or-parallelism or --disable-or-parallelism was given.
|
||||||
if test "${enable_or_parallelism+set}" = set; then
|
if test "${enable_or_parallelism+set}" = set; then
|
||||||
enableval="$enable_or_parallelism"
|
enableval="$enable_or_parallelism"
|
||||||
@ -4915,6 +4923,12 @@ if test "$depthlimit" = "yes"
|
|||||||
YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$lowprofile" = "yes"
|
||||||
|
then
|
||||||
|
YAP_EXTRAS="$YAP_EXTRAS -DLOW_PROF=1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "$use_april" = "yes"
|
if test "$use_april" = "yes"
|
||||||
then
|
then
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1 -DAPRIL"
|
YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1 -DAPRIL"
|
||||||
|
Reference in New Issue
Block a user