From: Bart D. <Bar...@cs...> - 2003-12-31 08:03:12
|
> The nextinstruction macro includes a test to see if the interrupt > bit has been set. That's the overhead I'd rather avoid. Would it be enough you think, to put the test only in control flow instructions (call, execute, try, retry ...) ? That would save some overhead. You would miss little in accuracy compared to what you do: failure can make my count go to another predicate than yours, but that seems all and no big deal. In addition, how about the following: have a call and a prof_call instruction (and similar for the other control flow instructions); the loader can change call (coming from a .O) to prof_call depending on a runtime(!) option. The prof_call gets as extra argument(s) over the call instruction just enough information to make the storing of the profiling information quick - basically the address of the counter to increase. I have done that in hProlog - but it is not based on an interrupt, it always does the count++ - and especially the possibility to do profiling on a portion of the program which you decide about on the fly, is a joy: set the profile flag and (re)consult the modules. No need to get out of Prolog and start a dedicated profiling system. The overhead is low (just measured 5% on a test which hProlog runs almost twice as fast as XSB) The code size overhead is from 5% for the hProlog equivalent of XSB's syslib (and of comparable source code size) to 20% for THE benchmark. That overhead includes the space for the counters (one per call site and per backtracking instruction). I don't have to deal with dynamic predicates - I am sure that makes my life easier. I have not done builtin predicates yet. Cheers Bart |