Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!sdd.hp.com!news.cs.indiana.edu!purdue!yeh From: yeh@cs.purdue.EDU (Wei Jen Yeh) Newsgroups: comp.lang.lisp Subject: monitoring functions Keywords: modify code at runtime Message-ID: <14131@medusa.cs.purdue.edu> Date: 1 Apr 91 12:20:33 GMT Sender: news@cs.purdue.EDU Organization: Department of Computer Science, Purdue University Lines: 47 Hello, Has anyone written a ``wrapping'' function? This is what I mean. (BTW, I use akcl.) I need to selectively monitor the execution times of various functions at runtime. Thus some way of modifying the code at runtime is needed. The functions are compiled, so the short-cut of defining lambda-blocks won't work. I wrote up the following pieces of code: (defun monitor_1fun (fname) (if (fboundp fname) (if (get fname 'monitored) (progn (format T "function ~A is already being monitored~%" fname) NIL) (progn (si:fset (setq f (gentemp)) (symbol-function fname)) (si:putprop fname f 'monitored) (eval `(defun ,fname (&rest args) (start_bench ',fname) (myfuncall ',f args) (end_bench ',fname))) (setq *Monitor_List* (cons fname *Monitor_List*)) *Monitor_List*)) (progn (format T "function ~A is not bound~%" fname) NIL))) (defun myfuncall (old_fun args) (eval `(funcall (function ,old_fun) ,@args))) However, the two defun's (thus two eval's of the args) are causing problems. Does anyone see what's wrong with the above routines (and corrections?)? It may be an obvious error, but I am too sleepy and the brain is not meeting its specs...ZZZZZ thanks in advance for any help. Wei Jen Yeh yeh@cs.purdue.edu Department of Computer Science Purdue University West Lafayette, Indiana -- Wei Jen Yeh yeh@cs.purdue.edu Department of Computer Science Purdue University West Lafayette, Indiana