[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Row and column of anonymous function
From: |
Daniel Kraft |
Subject: |
Row and column of anonymous function |
Date: |
Mon, 27 Jun 2011 22:21:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I have a quick question (at least it seems to me that it must be quick
to answer for someone more familiar with the Octave source than I am):
Currently I'm trying to "intercept" all function calls, so that I can
later add timing routines as well as analysis for a first profiler. It
seems to work well so far (printing out all entering / exists), thanks
to the hints by jwe in some previous email. However, I'm still
struggling to construct a meaningful "name" of anonymous functions.
Overall, I have this new routine in octave_user_function:
std::string
octave_user_function::profiler_name (void) const
{
std::ostringstream result;
if (is_inline_function ())
result << "anonymous@" << fcn_file_name () << ":42:42";
else if (is_subfunction ())
result << parent_fcn_name () << ">" << name ();
else
result << name ();
return result.str ();
}
(profiler_name is a new virtual method of octave_function, but for all
other types (user_script, builtin, mex) it seems to me that just
returning name() does fine.)
So, first: Does this sound reasonable so far? At least in very limited
tests it seems to do what I want. And now more interesting: How do I
get the line and column where the inline function was defined? I looked
up through the class hierarchy, but did not find any source location
information in octave_user_function, octave_function, octave_base_value,
octave_value -- probably I missed it; or is it somewhere else? How do I
get this information, so I can fill in the "42:42" above with the real
values?
Thanks a lot! When this is done, my next step will be to actually time
the execution and then make the profiler and its collected data
available via built-in functions. Then the fun can start! ;)
Yours,
Daniel
- --
http://www.pro-vegan.info/
- --
Done: Arc-Bar-Cav-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Mon-Pri
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJOCOZRAAoJEFJ+ebqjtTmYgecP/ix918+mnNXzfxv2dmCZUGd7
D7bqctWbL7c2HPv2QLki03o6VfHY8efDAfvwF0fKPaZPbPWdbpIMqZNOYbgQmnnp
9yv5BxwhZHWemUBmwjS9hrt8Mnrj9IMsW96vqSY7pJzsV83Ufo2uGWrRsUzqctd7
xzv+ZXS6DU3JwJuoas2ES6Ex3sZxyEOXVUxjJ+iuAdWa3CmmCsCXRTKpcaXSG52F
UJ63fCFRFun7JoWrC2+Ux/vjdFYMCnW1XAbPAW4o8BXswLfaYfkd2JgjbH6fCo9y
Uh3XxJ8tbtRL/OJvrKdNvSTAcojNn+cOjrMG0N9VnQk450WTooyEDBlpJ/ISEjBA
Al2k8FiJaEx0iQFLQnTJ8gwQxCYsuVjtyKkekAWGZYm/Kn+rKDKiBsnN/IRRy3WP
Aaig3UqBm9Wbks5hFSKamQ6/3D9wXnuPHJjxLKKJERZo15qXWhwDgqQ1PdAWc2ia
IVc2BiHprMaqidxMrRPap6/uE/VWDDqyEJi2ytKeFqaJRXjblGJ62ii8est5HHYc
mt6RFQMxgjJ1JOZJ7ico7/7+rdpoFURiILLxuJaY9ZDrhJS4B0jwnzAGhhebUoVv
wZhaQS/TFv1IhD0KbS6t1UWztit6aSSALCtyS9jO/Xq6C/dgez0XqntnHNMcROVa
6EvN3Unc3OaiHiPo52Up
=CZCG
-----END PGP SIGNATURE-----
- Row and column of anonymous function,
Daniel Kraft <=