Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

lock_timing.H

Go to the documentation of this file.
00001 // Copyright (C) 2004, Kenneth C. Schalk
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // lock_timing.H - declarations for performance debugging of
00020 // StableLock and VolatileRootLock.
00021 
00022 // Last modified on Thu Dec  9 17:11:16 EST 2004 by ken@xorian.net
00023 
00024 #ifndef _LOCK_TIMING_H_
00025 #define _LOCK_TIMING_H_
00026 
00027 #if defined(REPOS_PERF_DEBUG)
00028 
00029 class ReadersWritersLock;
00030 
00031 // These are meant to be called inside the ReadersWritersLock class.
00032 void rwlock_acquire_read_start(ReadersWritersLock *lock_p);
00033 
00034 #define RWLOCK_ACQUIRE_READ_START(lock) rwlock_acquire_read_start(lock)
00035 
00036 void rwlock_acquire_read_done(ReadersWritersLock *lock_p, bool failed);
00037 
00038 #define RWLOCK_ACQUIRE_READ_DONE(lock, fail) rwlock_acquire_read_done(lock, fail)
00039 
00040 void rwlock_acquire_write_start(ReadersWritersLock *lock_p);
00041 
00042 #define RWLOCK_ACQUIRE_WRITE_START(lock) rwlock_acquire_write_start(lock)
00043 
00044 void rwlock_acquire_write_done(ReadersWritersLock *lock_p,bool failed);
00045 
00046 #define RWLOCK_ACQUIRE_WRITE_DONE(lock, fail) rwlock_acquire_write_done(lock, fail)
00047 
00048 void rwlock_release_start(ReadersWritersLock *lock_p);
00049 
00050 #define RWLOCK_RELEASE_START(lock) rwlock_release_start(lock)
00051 
00052 void rwlock_release_done(ReadersWritersLock *lock_p);
00053 
00054 #define RWLOCK_RELEASE_DONE(lock) rwlock_release_done(lock)
00055 
00056 // Record the reason a lock was acquired
00057 void rwlock_locked_reason(ReadersWritersLock *lock_p, const char *reason);
00058 
00059 #define RWLOCK_LOCKED_REASON(lock,reason) rwlock_locked_reason(lock,reason)
00060 
00061 #if defined(__cplusplus)
00062 
00063 // Turn timing recording on or off.
00064 void rwlock_timing_control(bool enable);
00065 
00066 #endif
00067 
00068 #else // defined(REPOS_PERF_DEBUG)
00069 
00070 #define RWLOCK_ACQUIRE_READ_START(lock) ((void)0)
00071 #define RWLOCK_ACQUIRE_READ_DONE(lock, fail) ((void)0)
00072 #define RWLOCK_ACQUIRE_WRITE_START(lock) ((void)0)
00073 #define RWLOCK_ACQUIRE_WRITE_DONE(lock, fail) ((void)0)
00074 #define RWLOCK_RELEASE_START(lock) ((void)0)
00075 #define RWLOCK_RELEASE_DONE(lock) ((void)0)
00076 #define RWLOCK_LOCKED_REASON(lock,reason) ((void)0)
00077 
00078 #endif // defined(REPOS_PERF_DEBUG)
00079 
00080 #endif

Generated on Mon May 8 00:48:44 2006 for Vesta by  doxygen 1.4.2