[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: profiler implementation
From: |
Daniel Kraft |
Subject: |
Re: profiler implementation |
Date: |
Wed, 10 Aug 2011 19:45:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 08/10/11 19:29, John W. Eaton wrote:
> Is the nested "enter" class really needed? Wouldn't it be possible
> to simply write
>
> { if (Vprofiling) profile_data_accumulator pda (name);
>
> ... }
Again, I think that would not work because of the scoping of pda. And
further, we don't want to create a new data_accumulator -- we just want
a object which manages stack unwinding. The data_accumulator must
persist, since it has to store also other function entries/exits and
collect the data.
Thus yes, I don't see how we could do without *two* different classes.
> This could even be written as
>
> #define BEGIN_PROFILE_BLOCK \ { \ if (Vprofiling) \
> profile_data_accumulator pda (name);
>
> #define END_PROFILE_BLOCK \ }
>
> BEGIN_PROFILE_BLOCK ... END_PROFILE_BLOCK
>
> to make it less likely that someone who doesn't understand the way
> the profiler works will come along later and remove the braces.
*That* is something I could actually do; if you think that this would be
worthwhile and not obfuscate the code (because I think a lot of people
don't really like such "code generating" macros; although I use them
some times and don't think they're too bad), I'll happily do that. BTW,
this would also make "changing the profiler object" as per your other
comment a "single place" thing again. (Independent of whether we
introduce a "current_profiler()" function, leave it as it is, or whatever.)
Should I do that?
Yours,
Daniel
- --
OpenPGP: 3BA2 3DDB 7758 F010 BDAB 0DCF 527E 79BA A3B5 3998
or use https://safesend.domob.eu/
- --
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/
iQIcBAEBAgAGBQJOQsOcAAoJEFJ+ebqjtTmYnTIP/RpKmSMNQr3jF0KUbSOWa32S
IdiGYyBXs//RRY6Vfo3EOF039QiRUJJ2YPD0GHX8dLqbt5lxWcKZzSFNAb4uCWOV
DJn4gPIDOFZEi3RL5jQQUyLfTP1uH9UMmqC/7h6gs6NwsiIiAq7C5LCDj99xVnL6
Y19jTJES0FrF846zc8zUMnEyevJU/ANmcxtuiakYI909iy8X7tUNFSD/IxIS8vV6
+k1jy6UllLTPIht/cg2mtGeomQDgRqXHPoEU/sVZHZMZXFuLaUyVN8m3Ms6knVTh
PsH4DjhJ0p7X+CKlVj8OdU4HvW4sn1+MOdIjEA9H5AB3I/HrOqJ4Y11OAmKy/iKY
yTtpX4Xq5+ezO9ffLSdlw6k0VTj/FLGS8Px7HIzzVETT8KmRWq/CZGn8lLk/3KUM
sHJxEOKWcPWq3oWmFAYq0m5NO1Kx4foL7jcwS4qNs9+LxiL1QhlBQeIlpIIZz3cR
bwdsbHQ2Ih1IXYdhNbVJhgsrl8yiD33qIIiwuDi3TKrOUwfUc3Zbpteh4io3+pJe
bBn6y5hi+L/vzyPf61C/3kS9mK1Z1p2PUJRuTeBcHnPKnhqQdroVJ3/9MnhK1LRM
IfdmeAjtIldak4+RwWdjqrAjrVwXNsT7/f1aFKYK76GspMmG9YkHCmWuhowzdn+7
8ByUR0l1ZpCPKDDKf9Hp
=GmSY
-----END PGP SIGNATURE-----
smime.p7s
Description: S/MIME Cryptographic Signature