1: /* #define DEBUG */
   2: #define CHAR
   3: #define STATIC
   4: /*
   5:  * pxp - Pascal execution profiler
   6:  *
   7:  * Bill Joy
   8:  * University of California, Berkeley (UCB)
   9:  * Version 1.1 February 1978
  10:  */
  11: 
  12: /*
  13:  * Option flags
  14:  *
  15:  * The following options are recognized on the command line by pxp.
  16:  * Only the u, w, and z options here have effect in comments in the
  17:  * program; the others are command line only, and unrelated
  18:  * to the options with the same designations in comments.
  19:  *
  20:  *	a	Print all routines in a profile; normally, routines
  21:  *		which have never been executed have their bodies suppressed.
  22:  *
  23:  *	c	Extract profile data from the file core, or the file
  24:  *		named after the last argument rather than the file 'pmon.out'.
  25:  *		Must be used with z to have an effect.
  26:  *
  27:  *	d	Suppress declarations
  28:  *
  29:  *	f	Fully parenthesize expressions.
  30:  *
  31:  *	j	Left justify all procedures and functions rather than
  32:  *		indenting them.
  33:  *
  34:  *	n	Eject a new page in the listing as each 'include' file
  35:  *		is incorporated into the profile.
  36:  *
  37:  *	o	Put output prettyprint in first argument file
  38:  *
  39:  *	p	Pretty print a main program without processing
  40:  *		the include statements.
  41:  *
  42:  *	t	Print a table summarizing procedure and function call counts.
  43:  *
  44:  *	u	Card image mode; only the first 72 chars on a line count.
  45:  *
  46:  *	w	Suppress certain warning diagnostics.
  47:  *
  48:  *	z	Generate an execution profile of the program.
  49:  *		May also be followed by a list of procedure and function
  50:  *		names mixed, if desired, with include file names.
  51:  *		Only these procedures and functions, and the contents
  52:  *		of the specified include files will then be profiled.
  53:  *
  54:  *  [23456789]	Use the specified number of spaces for the basic
  55:  *		indenting unit in the program.
  56:  *
  57:  *	_	Underline keywords in the output.
  58:  */
  59: 
  60: char    all, core, nodecl, full, justify, pmain, stripcomm, table, underline;
  61: char    profile, onefile;
  62: char    *firstname, *stdoutn;
  63: #ifdef DEBUG
  64: char    fulltrace, errtrace, testtrace, yyunique, typetest;
  65: #endif
  66: int unit;
  67: 
  68: /*
  69:  * The flag nojunk means that header lines
  70:  * of procedures and functions are to be suppressed
  71:  * when the z option is off.
  72:  * It is the default when command line z option
  73:  * control is specified.
  74:  *
  75:  * The flag noinclude indicates that include statements are not
  76:  * to be processed since we are pretty-printing the contents
  77:  * of a single file.
  78:  *
  79:  * The flag bracket indicates that the source code should be
  80:  * bracketed with lines of the form
  81:  *	program x(output);
  82:  * and
  83:  *	begin end.
  84:  * so that an include will pretty print without syntax errors.
  85:  */
  86: char    nojunk, noinclude, bracket;
  87: 
  88: /*
  89:  * IMPORTANT NOTE
  90:  *
  91:  * Many of the following globals are shared by pi and pxp.
  92:  * For more discussion of these see the available documentation
  93:  * on the structure of pi.
  94:  */
  95: 
  96: /*
  97:  * Each option has a stack of 17 option values, with opts giving
  98:  * the current, top value, and optstk the value beneath it.
  99:  * One refers to option `l' as, e.g., opt('l') in the text for clarity.
 100:  */
 101: char    opts[26];
 102: int optstk[26];
 103: 
 104: #define opt(c) opts[c-'a']
 105: 
 106: /*
 107:  * NOTES ON THE DYNAMIC NATURE OF THE DATA STRUCTURES
 108:  *
 109:  * Pxp uses expandable tables for its string table
 110:  * hash table, and parse tree space.  The following
 111:  * definitions specify the size of the increments
 112:  * for these items in fundamental units so that
 113:  * each uses approximately 1024 bytes.
 114:  */
 115: 
 116: #define STRINC  1024        /* string space increment */
 117: #define TRINC   512     /* tree space increment */
 118: #define HASHINC 509     /* hash table size in words, each increment */
 119: 
 120: /*
 121:  * The initial sizes of the structures.
 122:  * These should be large enough to profile
 123:  * an "average" sized program so as to minimize
 124:  * storage requests.
 125:  * On a small system or and 11/34 or 11/40
 126:  * these numbers can be trimmed to make the
 127:  * profiler smaller.
 128:  */
 129: #define ITREE   2000
 130: #define IHASH   509
 131: 
 132: /*
 133:  * The following limits on hash and tree tables currently
 134:  * allow approximately 1200 symbols and 20k words of tree
 135:  * space.  The fundamental limit of 64k total data space
 136:  * should be exceeded well before these are full.
 137:  */
 138: #define MAXHASH 4
 139: #define MAXTREE 30
 140: #define MAXDEPTH 150
 141: 
 142: /*
 143:  * ERROR RELATED DEFINITIONS
 144:  */
 145: 
 146: /*
 147:  * Exit statuses to pexit
 148:  *
 149:  * AOK
 150:  * ERRS		Compilation errors inhibit obj productin
 151:  * NOSTART	Errors before we ever got started
 152:  * DIED		We ran out of memory or some such
 153:  */
 154: #define AOK 0
 155: #define ERRS    1
 156: #define NOSTART 2
 157: #define DIED    3
 158: 
 159: char    Recovery;
 160: /*
 161:  * The flag eflg is set whenever we have a hard error.
 162:  * The character in errpfx will precede the next error message.
 163:  */
 164: int eflg;
 165: char    errpfx;
 166: 
 167: #define setpfx(x)   errpfx = x
 168: 
 169: #define standard()  setpfx('s')
 170: #define warning()   setpfx('w')
 171: #define recovered() setpfx('e')
 172: #define quit()      setpfx('Q')
 173: 
 174: /*
 175:  * SEMANTIC DEFINITIONS
 176:  */
 177: 
 178: #define NIL 0
 179: 
 180: /*
 181:  * NOCON and SAWCON are flags in the tree telling whether
 182:  * a constant set is part of an expression.
 183:  */
 184: #define NOCON   0
 185: #define SAWCON  1
 186: 
 187: /*
 188:  * The variable cbn gives the current block number.
 189:  * The variable lastbn gives the block number before
 190:  * it last changed and is used to know that we were
 191:  * in a nested procedure so that we can print
 192:  *	begin { solve }
 193:  * when solve has nested procedures or functions in it.
 194:  */
 195: int cbn, lastbn;
 196: 
 197: /*
 198:  * The variable line is the current semantic
 199:  * line and is set in stat.c from the numbers
 200:  * embedded in statement type tree nodes.
 201:  */
 202: int line;
 203: 
 204: /*
 205:  * The size of the display
 206:  * which defines the maximum nesting
 207:  * of procedures and functions allowed.
 208:  */
 209: #define DSPLYSZ 20
 210: 
 211: /*
 212:  * Routines which need types
 213:  * other than "integer" to be
 214:  * assumed by the compiler.
 215:  */
 216: int *tree();
 217: int *hash();
 218: char    *alloc();
 219: long    cntof();
 220: long    nowcnt();
 221: 
 222: /*
 223:  * Funny structures to use
 224:  * pointers in wild and wooly ways
 225:  */
 226: struct {
 227:     char    pchar;
 228: };
 229: struct {
 230:     int pint;
 231:     int pint2;
 232: };
 233: struct {
 234:     long    plong;
 235: };
 236: struct {
 237:     double  pdouble;
 238: };
 239: 
 240: #define OCT 1
 241: #define HEX 2
 242: 
 243: /*
 244:  * MAIN PROGRAM GLOBALS, MISCELLANY
 245:  */
 246: 
 247: /*
 248:  * Variables forming a data base referencing
 249:  * the command line arguments with the "z" option.
 250:  */
 251: char    **pflist;
 252: int pflstc;
 253: int pfcnt;
 254: 
 255: char    *filename;      /* current source file name */
 256: char    *lastname;      /* last file name printed */
 257: int tvec[2];        /* mod time of the source file */
 258: int ptvec[2];       /* time profiled */
 259: char    printed;        /* current file has been printed */
 260: char    hadsome;        /* had some output */
 261: 
 262: /*
 263:  * PROFILING AND FORMATTING DEFINITIONS
 264:  */
 265: 
 266: /*
 267:  * The basic counter information recording structure.
 268:  * This is global only because people outside
 269:  * the cluster in pmon.c need to know its size.
 270:  */
 271: struct pxcnt {
 272:     long    ntimes;     /* the count this structure is all about */
 273:     int counter;    /* a unique counter number for us */
 274:     int gos;        /* global goto count when we hatched */
 275:     int printed;    /* are we considered to have been printed? */
 276: } pfcnts[DSPLYSZ];
 277: 
 278: /*
 279:  * The pieces we divide the output line indents into:
 280:  *	line#  PRFN  label:   STAT  999.---|  DECL   text
 281:  */
 282: #define STAT    0
 283: #define DECL    1
 284: #define PRFN    2
 285: 
 286: /*
 287:  * Gocnt records the total number of goto's and
 288:  * cnts records the current counter for generating
 289:  * COUNT operators.
 290:  */
 291: int gocnt;
 292: int cnts;
 293: 
 294: int fout[259];
 295: int flush(), putchar();

Defined variables

all defined in line 60; used 2 times
cbn defined in line 195; used 26 times
cnts defined in line 292; used 6 times
core defined in line 60; used 4 times
errpfx defined in line 165; used 11 times
firstname defined in line 62; used 4 times
full defined in line 60; used 5 times
gocnt defined in line 291; used 5 times
hadsome defined in line 260; used 6 times
lastbn defined in line 195; used 5 times
lastname defined in line 256; used 5 times
nojunk defined in line 86; used 2 times
onefile defined in line 61; used 3 times
opts defined in line 101; used 8 times
optstk defined in line 102; used 8 times
pfcnt defined in line 253; used 4 times
pfcnts defined in line 276; used 2 times
pflist defined in line 251; used 2 times
pflstc defined in line 252; used 4 times
pmain defined in line 60; never used
printed defined in line 259; used 18 times
ptvec defined in line 258; used 3 times
stdoutn defined in line 62; used 7 times
typetest defined in line 64; used 2 times
underline defined in line 60; used 2 times

Defined struct's

pxcnt defined in line 271; used 18 times

Defined macros

AOK defined in line 154; used 1 times
DSPLYSZ defined in line 209; used 1 times
HASHINC defined in line 118; used 8 times
HEX defined in line 241; used 2 times
IHASH defined in line 130; never used
ITREE defined in line 129; used 2 times
MAXDEPTH defined in line 140; used 3 times
MAXHASH defined in line 138; used 2 times
MAXTREE defined in line 139; used 2 times
NIL defined in line 178; used 201 times
NOCON defined in line 184; used 7 times
OCT defined in line 240; used 3 times
PRFN defined in line 284; used 8 times
SAWCON defined in line 185; used 6 times
STAT defined in line 282; used 15 times
STRINC defined in line 116; used 3 times
TRINC defined in line 117; used 1 times
quit defined in line 172; never used
standard defined in line 169; used 1 times
warning defined in line 170; used 2 times

Usage of this include

0.h used 39 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1344
Valid CSS Valid XHTML 1.0 Strict