summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authordas <das>2007-09-13 15:28:09 (GMT)
committerdas <das>2007-09-13 15:28:09 (GMT)
commiteeee76826cef4b3047d9b328989dd6e2519209a9 (patch)
tree593d357422c91ee5b5623ed463f7d5629d99a4a5 /generic/tclInt.h
parent3c4ff78790f36151917e3409056d4296b11a399a (diff)
downloadtcl-eeee76826cef4b3047d9b328989dd6e2519209a9.zip
tcl-eeee76826cef4b3047d9b328989dd6e2519209a9.tar.gz
tcl-eeee76826cef4b3047d9b328989dd6e2519209a9.tar.bz2
* generic/tclDTrace.d (new file): add DTrace provider for Tcl; allows
* generic/tclCompile.h: tracing of proc and command entry & * generic/tclBasic.c: return, bytecode execution, object * generic/tclExecute.c: allocation and more; with essentially * generic/tclInt.h: zero cost when tracing is inactive; * generic/tclObj.c: enable with --enable-dtrace configure * generic/tclProc.c: arg (disabled by default, will only * unix/Makefile.in: enable if DTrace is present). * unix/configure.in: [Patch 1793984] * macosx/Makefile: enable DTrace support. * unix/configure: autoconf-2.13
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 9d05bd4..76544c0 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -8,11 +8,12 @@
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
+ * Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.118.2.29 2007/08/23 00:27:21 das Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.118.2.30 2007/09/13 15:28:13 das Exp $
*/
#ifndef _TCLINT
@@ -2300,6 +2301,19 @@ EXTERN Tcl_Obj *TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
*----------------------------------------------------------------
*/
+/*
+ * DTrace object allocation probe macros.
+ */
+
+#ifdef USE_DTRACE
+#include "tclDTrace.h"
+#define TCL_DTRACE_OBJ_CREATE(objPtr) TCL_OBJ_CREATE(objPtr)
+#define TCL_DTRACE_OBJ_FREE(objPtr) TCL_OBJ_FREE(objPtr)
+#else /* USE_DTRACE */
+#define TCL_DTRACE_OBJ_CREATE(objPtr) {}
+#define TCL_DTRACE_OBJ_FREE(objPtr) {}
+#endif /* USE_DTRACE */
+
#ifdef TCL_COMPILE_STATS
# define TclIncrObjsAllocated() \
tclObjsAlloced++
@@ -2316,7 +2330,8 @@ EXTERN Tcl_Obj *TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
(objPtr)->refCount = 0; \
(objPtr)->bytes = tclEmptyStringRep; \
(objPtr)->length = 0; \
- (objPtr)->typePtr = NULL
+ (objPtr)->typePtr = NULL; \
+ TCL_DTRACE_OBJ_CREATE(objPtr)
#ifdef TCL_MEM_DEBUG
@@ -2325,6 +2340,7 @@ EXTERN Tcl_Obj *TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
#else
# define TclDecrRefCount(objPtr) \
if (--(objPtr)->refCount <= 0) { \
+ TCL_DTRACE_OBJ_FREE(objPtr); \
if (((objPtr)->typePtr != NULL) \
&& ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
(objPtr)->typePtr->freeIntRepProc(objPtr); \
@@ -2356,7 +2372,9 @@ EXTERN Tcl_Obj *TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
(objPtr)->bytes = tclEmptyStringRep; \
(objPtr)->length = 0; \
(objPtr)->typePtr = NULL; \
- TclIncrObjsAllocated()
+ TclIncrObjsAllocated(); \
+ TCL_DTRACE_OBJ_CREATE(objPtr)
+
#elif defined(PURIFY)