summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2013-08-02 20:49:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-08-03 09:32:03 +0200
commiteeb3b8dc5c771915f9c011e95ae20babdf70bd02 (patch)
treef1602f8e92a9a0f9873bf0335e03cf23433b9e34 /sal
parentc2e2fbe6601ef14122371c380d91a48425a2b669 (diff)
Add SDT probes for RTL_LOG_STRING_NEW/DELETE.
Change-Id: I938259f90aee9d277c9ff5b72c9120b93311cbd3 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/strimp.hxx18
-rw-r--r--sal/rtl/string.cxx7
-rw-r--r--sal/rtl/ustrbuf.cxx4
-rw-r--r--sal/rtl/ustring.cxx4
4 files changed, 29 insertions, 4 deletions
diff --git a/sal/rtl/strimp.hxx b/sal/rtl/strimp.hxx
index f54b88231fed..544d5796560f 100644
--- a/sal/rtl/strimp.hxx
+++ b/sal/rtl/strimp.hxx
@@ -20,6 +20,11 @@
#ifndef INCLUDED_RTL_SOURCE_STRIMP_HXX
#define INCLUDED_RTL_SOURCE_STRIMP_HXX
+#include <config_probes.h>
+#if USE_SDT_PROBES
+#include <sys/sdt.h>
+#endif
+
#include <osl/interlck.h>
#include "sal/types.h"
@@ -46,8 +51,21 @@ sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix );
sal_Bool rtl_ImplIsWhitespace( sal_Unicode c );
// string lifetime instrumentation / diagnostics
+#if USE_SDT_PROBES
+# define PROBE_SNAME(n,b) n ## _ ## b
+# 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 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)
+#else
# define RTL_LOG_STRING_NEW(s)
# define RTL_LOG_STRING_DELETE(s)
+#endif /* USE_SDT_PROBES */
#endif /* INCLUDED_RTL_SOURCE_STRIMP_HXX */
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index a68c0932d115..313706d797e8 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -61,10 +61,9 @@ static rtl_String const aImplEmpty_rtl_String =
#define IMPL_RTL_STRINGDATA rtl_String
#define IMPL_RTL_EMPTYSTRING aImplEmpty_rtl_String
-#undef RTL_LOG_STRING_NEW
-#define RTL_LOG_STRING_NEW(s)
-#undef RTL_LOG_STRING_DELETE
-#define RTL_LOG_STRING_DELETE(s)
+#if USE_SDT_PROBES
+#define RTL_LOG_STRING_BITS 8
+#endif
/* ======================================================================= */
diff --git a/sal/rtl/ustrbuf.cxx b/sal/rtl/ustrbuf.cxx
index 9010a0ea0cdd..30f4efe39c7f 100644
--- a/sal/rtl/ustrbuf.cxx
+++ b/sal/rtl/ustrbuf.cxx
@@ -24,6 +24,10 @@
#include <rtl/ustrbuf.hxx>
#include <strimp.hxx>
+#if USE_SDT_PROBES
+#define RTL_LOG_STRING_BITS 16
+#endif
+
void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength( rtl_uString ** newStr,
const sal_Unicode * value,
sal_Int32 count)
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index bdebd897a71b..1c02dfc9d041 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -69,6 +69,10 @@ static rtl_uString const aImplEmpty_rtl_uString =
#define IMPL_RTL_INTERN
static void internRelease (rtl_uString *pThis);
+#if USE_SDT_PROBES
+#define RTL_LOG_STRING_BITS 16
+#endif
+
/* ======================================================================= */
/* Include String/UString template code */