Changed mechanism for coputing amount of memory used
This commit is contained in:
parent
3ac24b282b
commit
06e487359b
1 changed files with 6 additions and 3 deletions
|
@ -35,10 +35,12 @@ extern comfatal();
|
||||||
extern copyfile();
|
extern copyfile();
|
||||||
extern install();
|
extern install();
|
||||||
extern char *mktemp();
|
extern char *mktemp();
|
||||||
|
extern char *sbrk();
|
||||||
|
|
||||||
main(argc,argv) register string argv[]; {
|
main(argc,argv) register string argv[]; {
|
||||||
register string arg;
|
register string arg;
|
||||||
string libpath();
|
string libpath();
|
||||||
|
char *beg_sbrk;
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
|
||||||
|
@ -110,6 +112,9 @@ main(argc,argv) register string argv[]; {
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verbose) beg_sbrk = sbrk(0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now check wether the sets should include nonterminals
|
* Now check wether the sets should include nonterminals
|
||||||
*/
|
*/
|
||||||
|
@ -164,13 +169,11 @@ main(argc,argv) register string argv[]; {
|
||||||
UNLINK(f_temp);
|
UNLINK(f_temp);
|
||||||
UNLINK(f_pars);
|
UNLINK(f_pars);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
extern char *sbrk(), *end;
|
|
||||||
|
|
||||||
fprintf(stderr, "number of nonterminals: %d\n", nnonterms);
|
fprintf(stderr, "number of nonterminals: %d\n", nnonterms);
|
||||||
fprintf(stderr, "number of tokens: %d\n", ntokens);
|
fprintf(stderr, "number of tokens: %d\n", ntokens);
|
||||||
fprintf(stderr, "number of term structures: %d\n", nterms);
|
fprintf(stderr, "number of term structures: %d\n", nterms);
|
||||||
fprintf(stderr, "number of alternation structures: %d\n", nalts);
|
fprintf(stderr, "number of alternation structures: %d\n", nalts);
|
||||||
fprintf(stderr, "total memory used: %ld\n", (long)(sbrk(0) - (char *) &end));
|
fprintf(stderr, "total memory used: %ld\n", (long)(sbrk(0) - beg_sbrk));
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue