1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-16 15:02:33 +03:00

Enable probes to work with Mac OS X Leopard and other OSes that will

support DTrace in the future.

Switch from using DTRACE_PROBEn macros to the dynamically generated macros.
Use "dtrace -h" to create a header file that contains the dynamically
generated macros to be used in the source code instead of the DTRACE_PROBEn
macros.  A dummy header file is generated for builds without DTrace support.

Author: Robert Lor <Robert.Lor@sun.com>
This commit is contained in:
Peter Eisentraut
2008-03-17 19:44:41 +00:00
parent e7115a224a
commit a7b7b07af3
9 changed files with 64 additions and 62 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.182 2008/03/04 19:54:06 tgl Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.183 2008/03/17 19:44:41 petere Exp $
*
* NOTES
* A lock table is a shared memory hash table. When
@@ -40,6 +40,7 @@
#include "utils/memutils.h"
#include "utils/ps_status.h"
#include "utils/resowner.h"
#include "pg_trace.h"
/* This configuration variable is used to set the lock table size */
@@ -786,11 +787,11 @@ LockAcquire(const LOCKTAG *locktag,
* Sleep till someone wakes me up.
*/
PG_TRACE2(lock__startwait, locktag->locktag_field2, lockmode);
TRACE_POSTGRESQL_LOCK_STARTWAIT(locktag->locktag_field2, lockmode);
WaitOnLock(locallock, owner);
PG_TRACE2(lock__endwait, locktag->locktag_field2, lockmode);
TRACE_POSTGRESQL_LOCK_ENDWAIT(locktag->locktag_field2, lockmode);
/*
* NOTE: do not do any material change of state between here and

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.50 2008/01/01 19:45:52 momjian Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.51 2008/03/17 19:44:41 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,6 +28,7 @@
#include "storage/ipc.h"
#include "storage/proc.h"
#include "storage/spin.h"
#include "pg_trace.h"
/* We use the ShmemLock spinlock to protect LWLockAssign */
@@ -447,7 +448,7 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
block_counts[lockid]++;
#endif
PG_TRACE2(lwlock__startwait, lockid, mode);
TRACE_POSTGRESQL_LWLOCK_STARTWAIT(lockid, mode);
for (;;)
{
@@ -458,7 +459,7 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
extraWaits++;
}
PG_TRACE2(lwlock__endwait, lockid, mode);
TRACE_POSTGRESQL_LWLOCK_ENDWAIT(lockid, mode);
LOG_LWDEBUG("LWLockAcquire", lockid, "awakened");
@@ -469,7 +470,7 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
/* We are done updating shared state of the lock itself. */
SpinLockRelease(&lock->mutex);
PG_TRACE2(lwlock__acquire, lockid, mode);
TRACE_POSTGRESQL_LWLOCK_ACQUIRE(lockid, mode);
/* Add lock to list of locks held by this backend */
held_lwlocks[num_held_lwlocks++] = lockid;
@@ -540,13 +541,13 @@ LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode)
/* Failed to get lock, so release interrupt holdoff */
RESUME_INTERRUPTS();
LOG_LWDEBUG("LWLockConditionalAcquire", lockid, "failed");
PG_TRACE2(lwlock__condacquire__fail, lockid, mode);
TRACE_POSTGRESQL_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);
TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(lockid, mode);
}
return !mustwait;
@@ -631,7 +632,7 @@ LWLockRelease(LWLockId lockid)
/* We are done updating shared state of the lock itself. */
SpinLockRelease(&lock->mutex);
PG_TRACE1(lwlock__release, lockid);
TRACE_POSTGRESQL_LWLOCK_RELEASE(lockid);
/*
* Awaken any waiters I removed from the queue.