List Info

Thread: Re: Mapping (profile:report-time) over a list of profiled functions?




Re: Mapping (profile:report-time) over a list of profiled functions?
user name
2007-09-27 22:51:32
Helu
* "Denis Papathanasiou" 
<e4044eb40709270657s7a0d28det7e5ee26088d2b4b4mail.gmail.com> :

| I'm profiling an application, and since I don't know where
to look, I
| start by calling (profile:profile-all).
|
| After the app has run a bit, I run (profile:report-time)
on one of the
| functions, and it works, i.e. I get a report as expected.
|
| But when I try to map (profile:report-time) across all the
functions
| being profiled (as defined in profiletimed-functi
ons*), I get this,
| and I'm not sure why:
|
| * (mapcar #'(lambda (fn-name) (profile:report-time
fn-name))
| profiletimed-functi
ons*)
|
| ; Note: Variable FN-NAME defined but never used.
|
|
| Error in FWRAPPERS:FIND-FWRAPPER:  the function FN-NAME is
undefined.
|    [Condition of type UNDEFINED-FUNCTION]
|
| profiletimed-functi
ons* does contain a list of functions, and if I
| try any of those one at a time in (profile:report-time),
it works.
|
| So why is the mapping problematic?

PROFILE:PROFILE-TIME is a Macro.

* (macroexpand-1 '(profile:report-time fn-name))

=> (PROFILE::%REPORT-TIMES '(FN-NAME))

i.e.  it ends up looking for #'FN-NAME and so it is not to
be used
programatically.  In this respect it is similar to the
TRACE/UNTRACE

--
Madhu


Re: Mapping (profile:report-time) over a list of profiled functions?
country flaguser name
France
2007-09-28 04:27:53
Madhu writes:
> Helu
> * "Denis Papathanasiou" 
<e4044eb40709270657s7a0d28det7e5ee26088d2b4b4mail.gmail.com> :
> 
> | I'm profiling an application, and since I don't know
where to look, I
> | start by calling (profile:profile-all).
> |
> | After the app has run a bit, I run
(profile:report-time) on one of the
> | functions, and it works, i.e. I get a report as
expected.
> |
> | But when I try to map (profile:report-time) across
all the functions
> | being profiled (as defined in profiletimed-functi
ons*), I get this,
> | and I'm not sure why:
> |
> | * (mapcar #'(lambda (fn-name) (profile:report-time
fn-name))
> | profiletimed-functi
ons*)
> |
> | ; Note: Variable FN-NAME defined but never used.
> |
> |
> | Error in FWRAPPERS:FIND-FWRAPPER:  the function
FN-NAME is undefined.
> |    [Condition of type UNDEFINED-FUNCTION]
> |
> | profiletimed-functi
ons* does contain a list of functions, and if I
> | try any of those one at a time in
(profile:report-time), it works.
> |
> | So why is the mapping problematic?
> 
> PROFILE:PROFILE-TIME is a Macro.
> 
> * (macroexpand-1 '(profile:report-time fn-name))
> 
> => (PROFILE::%REPORT-TIMES '(FN-NAME))
> 
> i.e.  it ends up looking for #'FN-NAME and so it is not
to be used
> programatically.  In this respect it is similar to the
TRACE/UNTRACE

We could add that we can of course attain the desired
effects by using
the macro expansion, which in this case is simple:

(mapcar (lambda (fn-name) (profile::%report-times fn-name))

But of course we cannot expect it to continue to work with a
different
release of the profiler, since we have the *double* *hint* 
"::%" 
But if there is no report-times* function doing the
equivalent of the
macro, then it's all we can do.

-- 
__Pascal Bourguignon__                     http://www.informatimag
o.com/


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )