Re: [PATCH] log error details

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Thu, 14 Oct 2010 12:04:38 +0300

On 10/14/2010 12:58 AM, Amos Jeffries wrote:
> On Wed, 13 Oct 2010 16:25:34 +0300, Tsantilas Christos
> <chtsanti_at_users.sourceforge.net> wrote:
> .....
>>
>>>
>>> * Can FileNameHashCached() be made a private static method of
>>> TextException and work with the file and line details passed in to
>>> cnstructor please?
>> Will not work Amos.
>
> Ah I overlooked the static local.
>
> FileNameHash() could still be a member, but protected with friend function
> FileNameHashCached().
>
>>> The singleton hack making local copies in almost every file .o is
> likely
>>> to symbol clash on the more picky compilers like MacOSX.
>>
>> We need a copy of the FileNameHashCached in each .o file, which will
>> compute and cache once the hash of its filename. Alternatively we can
>> compute the hash when the Must exception called (direct use of the
>> FileNameHash).
>
> IMO that would be better. A system throwing and failing a lot of Must()
> requirements has worse problems than a few cycles of hashing.
Probably you are right here. In the other hand some thousands of
transactions aborted the same time for the same reason, will cause squid
to compute the same hash value some thousand times.

If we decide to not cache the hash value and there is not any objection
from others developers I will do the followings:
  - remove the FileNaneHashCached and the FileNameHashCached class.
  - make FilenameHash a private method of the TextException class.
  - Compute the hash only in TextException::id() method. This will
compute the hash value only if it is requested, not for all Must()

>
> * NP: if performance is _that_ much of a problem we had best look into
> pre-calculating FileNameHash() results as a const parameter to the
> Must/TextcHere macros during build.
I can not find any simple way for this one. Any hint? But if we decide
to not cache the hash value of the file name we do not need it.

>
>>
>> Does the MacOSX compiler has problems with static functions with the
>> same name on different .cc files?
>
> I've not heard of any problems with static functions if both defined and
> used inside.
> Template and class instances do. You have one such class listed there as
> FileNameHashCachedUser. Since you can't get rid of it for GCC I guess we
> shall have to see what shows up in building.
If we do not use the FileNameHashCached, this class is not needed

>
> Amos
>
Regards,
    Christos
Received on Thu Oct 14 2010 - 09:04:46 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 14 2010 - 12:00:04 MDT