lac : diff 3642355a c69501b8

Branch: master

Commit: 3642355a08e524d20ef0ccb62d66c1f1840edaaf

Author: Gianluca Guida <glguida@tlbflush.org>
Date: Mon Mar 6 23:23:35 UTC 2017
Parent: c69501b81d0971374e66acad68d01067f409028d
Log message:

    repl: used timed eval

    1: diff --git a/src/repl/lac.c b/src/repl/lac.c
    2: index bd5d10a..8b2fb62 100644
    3: --- a/src/repl/lac.c
    4: +++ b/src/repl/lac.c
    5: @@ -38,6 +38,21 @@ sigint (int sig)
    6:       ? (_b)->tv_usec - (_a)->tv_usec					\
    7:       : (_b)->tv_usec + 1000000L - (_a)->tv_usec)
    8:  
    9: +lreg_t timed_eval(lreg_t lr, void *opq)
   10: +{
   11: +	lreg_t ret;
   12: +	struct timeval t1, t2;
   13: +	lenv_t *env = (lenv_t *)opq;
   14: +
   15: +	gettimeofday(&t1, NULL);
   16: +	ret = eval(lr, env);
   17: +	gettimeofday(&t2, NULL);
   18: +
   19: +	fprintf(stderr, "Evaluation took %ld seconds and %ld microseconds.\n",
   20: +		TDIFF_SEC(&t1, &t2), TDIFF_USEC(&t1, &t2));
   21: +
   22: +	return ret;
   23: +}
   24:  
   25:  int
   26:  repl (FILE * infd, FILE * outfd, FILE * errfd)
   27: @@ -62,7 +77,7 @@ restart:
   28:  	add_history (buf);
   29:  
   30:        res = sexpr_parse_string (buf,
   31: -				(lreg_t (*)(lreg_t, void *))eval,
   32: +				timed_eval,
   33:  				(void *)null_env);
   34:        if (isatty (fileno (outfd)))
   35:  	{

Generated by git2html.