From: Dave Benjamin <dave@ramenlabs.com>
To: blue storm <bluestorm.dylc@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Name of currently executing function
Date: Sun, 20 Jul 2008 16:41:00 -0700 [thread overview]
Message-ID: <4883CD0C.3090504@ramenlabs.com> (raw)
In-Reply-To: <527cf6bc0807201035x7b16999eha0f4cc4d7f18995a@mail.gmail.com>
blue storm wrote:
> Your combination of Profiler and Macros is really clever. I tried to do
> something with macros before coming to the Profiler solution, but i
> didn't work out.
Thanks! The idea of using macros didn't occur to me until this morning.
They certainly make it easier to work within the calling function's
environment.
> This solution is elegant because it integrates well with the other
> program-wide macros ( __LOCATION__ and __FILE__ ), and more powerful
> than the ad-hoc __LOG__ handling.
Glad you think so.
> The idea of directly modifying the decorate_this_expr declaration seemed
> a little awkward at first, but it actually is as useful as the functor
> solution (because all we can get anyway is the function name), while a
> lot simpler. I think you could even suggest it for inclusion in the main
> Camlp4 distribution (it should be doable to rebuild the old
> Camlp4Profiler features on top of that).
Well, I think you had the right idea in trying to generalize the
profiler code so that it can be used for multiple purposes. I opted for
the copy-and-modify approach mainly to keep the example small. My
knowledge of camlp4 is pretty limited, and I have to admit I don't
understand much of the profiler code. It's easier to suggest a slight
modification than to write a new functor from scratch and then try to
explain it.
Exposing __FILE__ isn't quite enough to reproduce the Camlp4Profiler's
functionality, since we also need a way to trigger some code to execute
at the start of every function. Either that, or we introduce a new
keyword (say, "PROFILE"), that has to be explicitly mentioned at the top
of each function to be profiled.
Dave
prev parent reply other threads:[~2008-07-20 23:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 5:27 Dave Benjamin
2008-07-14 13:53 ` [Caml-list] " blue storm
2008-07-15 6:13 ` Dave Benjamin
2008-07-20 16:17 ` Dave Benjamin
2008-07-20 17:35 ` blue storm
2008-07-20 23:41 ` Dave Benjamin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4883CD0C.3090504@ramenlabs.com \
--to=dave@ramenlabs.com \
--cc=bluestorm.dylc@gmail.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox