DTrace not working after SUBSYS.o reorg - Mailing list pgsql-patches

From Magne Mæhre
Subject DTrace not working after SUBSYS.o reorg
Date
Msg-id 47C4185B.7000505@sun.com
Whole thread Raw
Responses Re: DTrace not working after SUBSYS.o reorg
Re: DTrace not working after SUBSYS.o reorg
List pgsql-patches
I noticed that the dtrace code wouldn't build after the recent SUBSYS.o
reorganization.

Attached is a small patch that expands the files..

--Magne
? src/include/probes.h
? src/include/probes_null.h
Index: src/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/Makefile,v
retrieving revision 1.42
diff -c -r1.42 Makefile
*** src/Makefile    21 Aug 2007 01:11:12 -0000    1.42
--- src/Makefile    22 Feb 2008 18:33:58 -0000
***************
*** 14,19 ****
--- 14,22 ----


  all install installdirs uninstall distprep:
+ ifeq ($(enable_dtrace), yes)
+     $(DTRACE) -h -s $(top_builddir)/src/backend/utils/probes.d -o $(top_builddir)/src/include/probes.h
+ endif
      $(MAKE) -C port $@
      $(MAKE) -C timezone $@
      $(MAKE) -C backend $@
Index: src/backend/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/Makefile,v
retrieving revision 1.125
diff -c -r1.125 Makefile
*** src/backend/Makefile    1 Jan 2008 19:45:45 -0000    1.125
--- src/backend/Makefile    22 Feb 2008 18:33:58 -0000
***************
*** 20,28 ****
--- 20,30 ----

  SUBSYSOBJS = $(DIRS:%=%/SUBSYS.o)

+ ifeq ($(PORTNAME), solaris)
  ifeq ($(enable_dtrace), yes)
  LOCALOBJS += utils/probes.o
  endif
+ endif

  OBJS = $(SUBSYSOBJS) $(LOCALOBJS) $(top_builddir)/src/port/libpgport_srv.a

***************
*** 141,148 ****
--- 143,152 ----
          $(LN_S) ../../../$(subdir)/utils/fmgroids.h .


+ ifeq ($(PORTNAME), solaris)
  utils/probes.o: utils/probes.d $(SUBSYSOBJS)
      $(DTRACE) $(DTRACEFLAGS) -G -s $^ -o $@
+ endif


  ##########################################################################
Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.257
diff -c -r1.257 xact.c
*** src/backend/access/transam/xact.c    15 Jan 2008 18:56:59 -0000    1.257
--- src/backend/access/transam/xact.c    22 Feb 2008 18:33:58 -0000
***************
*** 1479,1485 ****
      Assert(MyProc->backendId == vxid.backendId);
      MyProc->lxid = vxid.localTransactionId;

!     PG_TRACE1(transaction__start, vxid.localTransactionId);

      /*
       * set transaction_timestamp() (a/k/a now()).  We want this to be the same
--- 1479,1485 ----
      Assert(MyProc->backendId == vxid.backendId);
      MyProc->lxid = vxid.localTransactionId;

!     DATABASE_TRANSACTION_START(vxid.localTransactionId);

      /*
       * set transaction_timestamp() (a/k/a now()).  We want this to be the same
***************
*** 1604,1610 ****
       */
      latestXid = RecordTransactionCommit();

!     PG_TRACE1(transaction__commit, MyProc->lxid);

      /*
       * Let others know about no transaction in progress by me. Note that this
--- 1604,1610 ----
       */
      latestXid = RecordTransactionCommit();

!     DATABASE_TRANSACTION_COMMIT(MyProc->lxid);

      /*
       * Let others know about no transaction in progress by me. Note that this
***************
*** 1990,1996 ****
       */
      latestXid = RecordTransactionAbort(false);

!     PG_TRACE1(transaction__abort, MyProc->lxid);

      /*
       * Let others know about no transaction in progress by me. Note that this
--- 1990,1996 ----
       */
      latestXid = RecordTransactionAbort(false);

!     DATABASE_TRANSACTION_ABORT(MyProc->lxid);

      /*
       * Let others know about no transaction in progress by me. Note that this
Index: src/backend/storage/lmgr/lock.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v
retrieving revision 1.181
diff -c -r1.181 lock.c
*** src/backend/storage/lmgr/lock.c    2 Feb 2008 22:26:17 -0000    1.181
--- src/backend/storage/lmgr/lock.c    22 Feb 2008 18:33:59 -0000
***************
*** 787,797 ****
           * Sleep till someone wakes me up.
           */

!         PG_TRACE2(lock__startwait, locktag->locktag_field2, lockmode);

          WaitOnLock(locallock, owner);

!         PG_TRACE2(lock__endwait, locktag->locktag_field2, lockmode);

          /*
           * NOTE: do not do any material change of state between here and
--- 787,797 ----
           * Sleep till someone wakes me up.
           */

!         POSTGRESQL_LOCK_STARTWAIT(locktag->locktag_field2, lockmode);

          WaitOnLock(locallock, owner);

!         POSTGRESQL_LOCK_ENDWAIT(locktag->locktag_field2, lockmode);

          /*
           * NOTE: do not do any material change of state between here and
Index: src/backend/storage/lmgr/lwlock.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v
retrieving revision 1.50
diff -c -r1.50 lwlock.c
*** src/backend/storage/lmgr/lwlock.c    1 Jan 2008 19:45:52 -0000    1.50
--- src/backend/storage/lmgr/lwlock.c    22 Feb 2008 18:33:59 -0000
***************
*** 447,453 ****
          block_counts[lockid]++;
  #endif

!         PG_TRACE2(lwlock__startwait, lockid, mode);

          for (;;)
          {
--- 447,453 ----
          block_counts[lockid]++;
  #endif

!         POSTGRESQL_LWLOCK_STARTWAIT(lockid, mode);

          for (;;)
          {
***************
*** 458,464 ****
              extraWaits++;
          }

!         PG_TRACE2(lwlock__endwait, lockid, mode);

          LOG_LWDEBUG("LWLockAcquire", lockid, "awakened");

--- 458,464 ----
              extraWaits++;
          }

!         POSTGRESQL_LWLOCK_ENDWAIT(lockid, mode);

          LOG_LWDEBUG("LWLockAcquire", lockid, "awakened");

***************
*** 469,475 ****
      /* We are done updating shared state of the lock itself. */
      SpinLockRelease(&lock->mutex);

!     PG_TRACE2(lwlock__acquire, lockid, mode);

      /* Add lock to list of locks held by this backend */
      held_lwlocks[num_held_lwlocks++] = lockid;
--- 469,475 ----
      /* We are done updating shared state of the lock itself. */
      SpinLockRelease(&lock->mutex);

!     POSTGRESQL_LWLOCK_ACQUIRE(lockid, mode);

      /* Add lock to list of locks held by this backend */
      held_lwlocks[num_held_lwlocks++] = lockid;
***************
*** 540,552 ****
          /* Failed to get lock, so release interrupt holdoff */
          RESUME_INTERRUPTS();
          LOG_LWDEBUG("LWLockConditionalAcquire", lockid, "failed");
!         PG_TRACE2(lwlock__condacquire__fail, lockid, mode);
      }
      else
      {
          /* Add lock to list of locks held by this backend */
          held_lwlocks[num_held_lwlocks++] = lockid;
!         PG_TRACE2(lwlock__condacquire, lockid, mode);
      }

      return !mustwait;
--- 540,552 ----
          /* Failed to get lock, so release interrupt holdoff */
          RESUME_INTERRUPTS();
          LOG_LWDEBUG("LWLockConditionalAcquire", lockid, "failed");
!         POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(lockid, mode);
      }
      else
      {
          /* Add lock to list of locks held by this backend */
          held_lwlocks[num_held_lwlocks++] = lockid;
!         POSTGRESQL_LWLOCK_CONDACQUIRE(lockid, mode);
      }

      return !mustwait;
***************
*** 631,637 ****
      /* We are done updating shared state of the lock itself. */
      SpinLockRelease(&lock->mutex);

!     PG_TRACE1(lwlock__release, lockid);

      /*
       * Awaken any waiters I removed from the queue.
--- 631,637 ----
      /* We are done updating shared state of the lock itself. */
      SpinLockRelease(&lock->mutex);

!     POSTGRESQL_LWLOCK_RELEASE(lockid);

      /*
       * Awaken any waiters I removed from the queue.
Index: src/backend/utils/probes.d
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/probes.d,v
retrieving revision 1.2
diff -c -r1.2 probes.d
*** src/backend/utils/probes.d    2 Jan 2008 02:42:06 -0000    1.2
--- src/backend/utils/probes.d    22 Feb 2008 18:33:59 -0000
***************
*** 7,17 ****
   * ----------
   */

! provider postgresql {

  probe transaction__start(int);
  probe transaction__commit(int);
  probe transaction__abort(int);
  probe lwlock__acquire(int, int);
  probe lwlock__release(int);
  probe lwlock__startwait(int, int);
--- 7,22 ----
   * ----------
   */

! provider database {

  probe transaction__start(int);
  probe transaction__commit(int);
  probe transaction__abort(int);
+
+ };
+
+ provider postgresql {
+
  probe lwlock__acquire(int, int);
  probe lwlock__release(int);
  probe lwlock__startwait(int, int);
Index: src/include/c.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.222
diff -c -r1.222 c.h
*** src/include/c.h    1 Jan 2008 19:45:56 -0000    1.222
--- src/include/c.h    22 Feb 2008 18:33:59 -0000
***************
*** 57,63 ****
  #include "pg_config_os.h"        /* must be before any system header files */
  #endif
  #include "postgres_ext.h"
! #include "pg_trace.h"

  #if _MSC_VER >= 1400
  #define errcode __msvc_errcode
--- 57,67 ----
  #include "pg_config_os.h"        /* must be before any system header files */
  #endif
  #include "postgres_ext.h"
! #ifdef ENABLE_DTRACE
! #include "probes.h"
! #else
! #include "probes_null.h"
! #endif

  #if _MSC_VER >= 1400
  #define errcode __msvc_errcode

pgsql-patches by date:

Previous
From:
Date:
Subject: Re: [HACKERS] 2WRS [WIP]
Next
From: Magne Mæhre
Date:
Subject: Re: DTrace not working after SUBSYS.o reorg