Kaydet (Commit) 3cf0b5cd authored tarafından Mark Wielaard's avatar Mark Wielaard Kaydeden (comit) Caolán McNamara

Add SDT probes for interning rtl_uStrings.

This adds RTL_LOG_STRING_INTERN_NEW and RTL_LOG_STRING_INTERN_DELETE
which are connected to SDT probes if available. It introduces two new
SDT probes. new_string_intern_16 and delete_string_intern_16
(there is currently no interning for 8-bit rtl_Strings).
For consistency both have the same 4 arguments as new_string_(8|16)
and delete_string_(8|16). new_string_intern_16 has as 5th argument
the address of the original rtl_uString being interned (which may
or may not be the same as $arg1).

Change-Id: Ib117bba932c1908abc70a7fdd4140c0af76d54cb
Reviewed-on: https://gerrit.libreoffice.org/5308Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 9cf4be5c
......@@ -56,15 +56,25 @@ sal_Bool rtl_ImplIsWhitespace( sal_Unicode c );
# define PROBE_NAME(n,b) PROBE_SNAME(n,b)
# define PROBE_NEW PROBE_NAME (new_string,RTL_LOG_STRING_BITS)
# define PROBE_DEL PROBE_NAME (delete_string,RTL_LOG_STRING_BITS)
# define PROBE_INTERN_NEW PROBE_NAME (new_string_intern,RTL_LOG_STRING_BITS)
# define PROBE_INTERN_DEL PROBE_NAME (delete_string_intern,RTL_LOG_STRING_BITS)
# define RTL_LOG_STRING_NEW(s) \
DTRACE_PROBE4(libreoffice, PROBE_NEW, s, \
(s)->refCount, (s)->length, (s)->buffer)
# define RTL_LOG_STRING_DELETE(s) \
DTRACE_PROBE4(libreoffice, PROBE_DEL, s, \
(s)->refCount, (s)->length, (s)->buffer)
# define RTL_LOG_STRING_INTERN_NEW(s,o) \
DTRACE_PROBE5(libreoffice, PROBE_INTERN_NEW, s, \
(s)->refCount, (s)->length, (s)->buffer, o)
# define RTL_LOG_STRING_INTERN_DELETE(s) \
DTRACE_PROBE4(libreoffice, PROBE_INTERN_DEL, s, \
(s)->refCount, (s)->length, (s)->buffer)
#else
# define RTL_LOG_STRING_NEW(s)
# define RTL_LOG_STRING_DELETE(s)
# define RTL_LOG_STRING_INTERN_NEW(s,o)
# define RTL_LOG_STRING_INTERN_DELETE(s)
#endif /* USE_SDT_PROBES */
#endif /* INCLUDED_RTL_SOURCE_STRIMP_HXX */
......
......@@ -817,6 +817,8 @@ static void rtl_ustring_intern_internal( rtl_uString ** newStr,
osl_releaseMutex( pPoolMutex );
RTL_LOG_STRING_INTERN_NEW(*newStr, str);
if( can_return && *newStr != str )
{ /* we dupped, then found a match */
rtl_freeMemory( str );
......@@ -947,6 +949,7 @@ internRelease (rtl_uString *pThis)
if ( SAL_STRING_REFCOUNT(
osl_atomic_decrement( &(pThis->refCount) ) ) == 0)
{
RTL_LOG_STRING_INTERN_DELETE(pThis);
pPoolMutex = getInternMutex();
osl_acquireMutex( pPoolMutex );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment