Initial revision
This commit is contained in:
35
lang/cem/ctest/ctprof/makefile
Normal file
35
lang/cem/ctest/ctprof/makefile
Normal file
@@ -0,0 +1,35 @@
|
||||
.SILENT:
|
||||
CEM=pdp
|
||||
head: gen
|
||||
diffs:
|
||||
echo No diffs in ctprof
|
||||
egen: tp.e
|
||||
echo comparing tp.e
|
||||
-if test -f tp.e.g ; then diff tp.cem.r tp.e.g ; else echo creating tp.e.g ; cp tp.cem.r tp.e.g ; fi
|
||||
rm -f tp.e
|
||||
tp.e: tp.c $(CEM)
|
||||
$(CEM) -p -c.e tp.c
|
||||
tp.cem.r: tp.cem
|
||||
echo running tp
|
||||
-tp.cem >tp.cem.r
|
||||
rm -f tp.cem
|
||||
procentry.k: procentry.c
|
||||
$(CEM) -c.k procentry.c
|
||||
tp.cem: tp.c procentry.k
|
||||
echo $(CEM) tp.c procentry.k
|
||||
$(CEM) -p -o tp.cem -O tp.c procentry.k
|
||||
rm -f procentry.[kosm] tp.[kmos]
|
||||
gen: tp.cem.r
|
||||
echo comparing tp
|
||||
-if test -f tp.cem.g ; then diff tp.cem.r tp.cem.g ; else echo creating tp.cem.g ; cp tp.cem.r tp.cem.g ; fi
|
||||
|
||||
pr:
|
||||
@pr `pwd`/*.c tp.cem.g
|
||||
|
||||
opr:
|
||||
make pr | opr
|
||||
|
||||
cleanup:
|
||||
-rm -f *.[kosme] *.old
|
||||
|
||||
transI transM cmpI cmpM:
|
||||
36
lang/cem/ctest/ctprof/procentry.c
Normal file
36
lang/cem/ctest/ctprof/procentry.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
*/
|
||||
|
||||
static int level = 0 ;
|
||||
int procentry(name) char *name ; {
|
||||
register int count ;
|
||||
|
||||
count=level++ ;
|
||||
while ( count-- ) {
|
||||
printf(" ") ;
|
||||
}
|
||||
printf("Entering %s\n",name) ;
|
||||
}
|
||||
int procexit(name) char *name ; {
|
||||
register int count ;
|
||||
|
||||
count= --level ;
|
||||
while ( count-- ) {
|
||||
printf(" ") ;
|
||||
}
|
||||
printf("Leaving %s\n",name) ;
|
||||
}
|
||||
2
lang/cem/ctest/ctprof/run
Normal file
2
lang/cem/ctest/ctprof/run
Normal file
@@ -0,0 +1,2 @@
|
||||
echo test profiling
|
||||
make -k "`grep CEM= ../makefile`" ${1-gen}
|
||||
27
lang/cem/ctest/ctprof/tp.c
Normal file
27
lang/cem/ctest/ctprof/tp.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
*/
|
||||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
int fac(n) { return ( n==0 ? 1 : n*fac(n-1)) ; }
|
||||
|
||||
main() {
|
||||
{ int dummy ;
|
||||
if ( fac(6) != 720 ) printf("vernielt return waarde\n") ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
16
lang/cem/ctest/ctprof/tp.cem.g
Normal file
16
lang/cem/ctest/ctprof/tp.cem.g
Normal file
@@ -0,0 +1,16 @@
|
||||
Entering main
|
||||
Entering fac
|
||||
Entering fac
|
||||
Entering fac
|
||||
Entering fac
|
||||
Entering fac
|
||||
Entering fac
|
||||
Entering fac
|
||||
Leaving fac
|
||||
Leaving fac
|
||||
Leaving fac
|
||||
Leaving fac
|
||||
Leaving fac
|
||||
Leaving fac
|
||||
Leaving fac
|
||||
Leaving main
|
||||
Reference in New Issue
Block a user