diff options
author | Mark Wielaard <mark@klomp.org> | 2013-08-07 23:52:44 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-08 19:13:41 +0000 |
commit | 3cf0b5cdb05e1d77610431b1b1328102bf05b602 (patch) | |
tree | f397b8734e97ca5858c541eb99c5481d049402ce /sal | |
parent | 9cf4be5ce8116eb447abea024f07456275d4ef4a (diff) |
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/5308
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/strimp.hxx | 10 | ||||
-rw-r--r-- | sal/rtl/ustring.cxx | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sal/rtl/strimp.hxx b/sal/rtl/strimp.hxx index 544d5796560f..997d72c4c814 100644 --- a/sal/rtl/strimp.hxx +++ b/sal/rtl/strimp.hxx @@ -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 */ diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index 1c02dfc9d041..abf9db7b388b 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -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 ); |