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:
rslopes 2003-03-21 16:18:42 +00:00
parent 0418e54be4
commit 1febfedc9d
4 changed files with 60 additions and 0 deletions

View File

@ -106,6 +106,10 @@ STATIC_PROTO(void a_fetch_cv, (void));
STATIC_PROTO(void a_fetch_vc, (void));
STATIC_PROTO(void a_f2, (int));
#ifdef LOW_PROF
int PROFSIZE;
#endif
#define CELLSIZE sizeof(CELL)
#define MaxLabels 2048
@ -2614,6 +2618,11 @@ Yap_assemble(int mode)
YAPLeaveCriticalSection();
{
Clause *cl = (Clause *)code_addr; /* lcc, why? */
#ifdef LOW_PROF
PROFSIZE=code_p;
#endif
return(cl->ClCode);
}
}

View File

@ -2896,6 +2896,35 @@ Yap_cclause(Term inp_clause, int NOfArgs, int mod)
#endif
/* phase 3: assemble code */
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 */
if (acode == NIL) {
/* make sure we have enough space */

View File

@ -1323,6 +1323,10 @@ MSCHandleSignal(DWORD dwCtrlType) {
static void
InitSignals (void)
{
#ifdef LOW_PROF
return;
#endif
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
my_signal (SIGQUIT, ReceiveSignal);
my_signal (SIGKILL, ReceiveSignal);
@ -2001,7 +2005,11 @@ p_alarm(void)
Int left;
Term tout;
#ifdef LOW_PROF
left=0;
#else
left = alarm(IntegerOfTerm(t));
#endif
tout = MkIntegerTerm(left);
return(Yap_unify(ARG2,tout));
}

14
configure vendored
View File

@ -832,6 +832,7 @@ Optional Features:
--enable-wam-profile support low level profiling of abstract machine
--enable-depth-limit support depth-bound computation
--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-tabling support tabling as: batched,local
--enable-threads support system threads
@ -2005,6 +2006,13 @@ if test "${enable_depth_limit+set}" = set; then
else
depthlimit=no
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.
if test "${enable_or_parallelism+set}" = set; then
enableval="$enable_or_parallelism"
@ -4915,6 +4923,12 @@ if test "$depthlimit" = "yes"
YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1"
fi
if test "$lowprofile" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DLOW_PROF=1"
fi
if test "$use_april" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1 -DAPRIL"