How to measure effects of OUString::intern ?

Stephan Bergmann sbergman at redhat.com
Sat Aug 3 00:35:30 PDT 2013


On 08/02/2013 09:30 PM, Mark Wielaard wrote:
> On Tue, Jul 30, 2013 at 09:29:31AM +0100, Michael Meeks wrote:
>>>> 	You saw the OUString debugging code: RTL_LOG_STRING_NEW /
>>>> _STRING_DELETE etc. that can produce a long but crunch-able set of
>>>> printfs on stdout: many of which are sadly not that useful due to
>>>> OUStringBuffer mutation (IIRC - but presumably some more work could
>>>> clean that up).
>>>
>>> I hadn't seen that yet, but that might be useful to see which strings
>>> are recreated multiple times and so are candidates for interning.
>>> Is there already code to enable/trigger RTL_LOG_STRING_NEW?
>>> Or should I just write my own hooks?
>>
>> 	I guess you just write your own fprintf(stderr,) etc. in the strimp.hxx
>> header ? of course, converting them to UTF8 and printing them is a bit
>> of a PITA since strimp.hxx is used in both 8bit and 16bit strings.
>
> I decided to add some SDT probes at the RTL_LOG_STRING_NEW/DELETE
> locations. With a little preprocessor magic you can easily split it
> in 8bit and 16bit variants (so this introduces probes for new_string_8,
> new_string_16, delete_string_8, delete_string_16 with as arguments the
> string, the refcount, length and buffer). The SDT probes have zero
> overhead (just adds a NOP and a special ELF NOTES section to the binary)
> and can be used with gdb or systemtap to collect some statistics
> (or simply just log/print all strings created/deleted). They are also
> source compatible with dtrace for systems that supports that (I have never
> used dtrace so I hope someone could test that). Could you have a look if
> that looks fine to integrate: https://gerrit.libreoffice.org/5256

Cool.  Pushed.  Thanks,
Stephan


More information about the LibreOffice mailing list