diff options
| author | ad <ad@NetBSD.org> | 2007-02-09 21:55:00 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-02-09 21:55:00 +0000 |
| commit | b07ec3fc388a5aeae51e8871aa89eefea3ce1e53 (patch) | |
| tree | c93d3b23a29f98ac0e26c9d43afb509219d0ea42 /sys/dev/lockstat.h | |
| parent | 5c1aad3ad0b9d2403784bd52128e8e8399e22254 (diff) | |
Merge newlock2 to head.
Diffstat (limited to 'sys/dev/lockstat.h')
| -rw-r--r-- | sys/dev/lockstat.h | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/sys/dev/lockstat.h b/sys/dev/lockstat.h index 7caee54194e..ad316fbf0f3 100644 --- a/sys/dev/lockstat.h +++ b/sys/dev/lockstat.h @@ -1,4 +1,4 @@ -/* $NetBSD: lockstat.h,v 1.3 2007/01/29 01:52:45 hubertf Exp $ */ +/* $NetBSD: lockstat.h,v 1.4 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -119,7 +119,8 @@ typedef struct lsdisable { #define LB_RWLOCK 0x00000300 #define LB_LOCKMGR 0x00000400 #define LB_KERNEL_LOCK 0x00000500 -#define LB_NLOCK 0x00000500 +#define LB_MISC 0x00000600 +#define LB_NLOCK 0x00000600 #define LB_LOCK_MASK 0x0000ff00 #define LB_LOCK_SHIFT 8 @@ -143,32 +144,37 @@ typedef struct lsbuf { #if defined(_KERNEL) && defined(__HAVE_CPU_COUNTER) && NLOCKSTAT > 0 -#define LOCKSTAT_EVENT(lock, type, count, time) \ +#define LOCKSTAT_EVENT(flag, lock, type, count, time) \ do { \ - if (__predict_false(lockstat_enabled)) \ + if (__predict_false(flag)) \ lockstat_event((uintptr_t)(lock), \ (uintptr_t)__builtin_return_address(0), \ (type), (count), (time)); \ } while (/* CONSTCOND */ 0); -#define LOCKSTAT_EVENT_RA(lock, type, count, time, ra) \ +#define LOCKSTAT_EVENT_RA(flag, lock, type, count, time, ra) \ do { \ - if (__predict_false(lockstat_enabled)) \ + if (__predict_false(flag)) \ lockstat_event((uintptr_t)(lock), (uintptr_t)ra, \ (type), (count), (time)); \ } while (/* CONSTCOND */ 0); #define LOCKSTAT_TIMER(name) uint64_t name = 0 #define LOCKSTAT_COUNTER(name) uint64_t name = 0 +#define LOCKSTAT_FLAG(name) int name +#define LOCKSTAT_ENTER(name) name = lockstat_enabled +#define LOCKSTAT_EXIT(name) -#define LOCKSTAT_START_TIMER(name) \ +#define LOCKSTAT_START_TIMER(flag, name) \ do { \ - (name) -= cpu_counter(); \ + if (__predict_false(flag)) \ + (name) -= cpu_counter(); \ } while (/* CONSTCOND */ 0) -#define LOCKSTAT_STOP_TIMER(name) \ +#define LOCKSTAT_STOP_TIMER(flag, name) \ do { \ - (name) += cpu_counter(); \ + if (__predict_false(flag)) \ + (name) += cpu_counter(); \ } while (/* CONSTCOND */ 0) #define LOCKSTAT_COUNT(name, inc) \ @@ -182,13 +188,16 @@ extern volatile u_int lockstat_enabled; #else -#define LOCKSTAT_EVENT(lock, type, count, time) /* nothing */ -#define LOCKSTAT_EVENT_RA(lock, type, count, time, ra) /* nothing */ -#define LOCKSTAT_TIMER(void) /* nothing */ -#define LOCKSTAT_COUNTER(void) /* nothing */ -#define LOCKSTAT_START_TIMER(void) /* nothing */ -#define LOCKSTAT_STOP_TIMER(void) /* nothing */ -#define LOCKSTAT_COUNT(name, int) /* nothing */ +#define LOCKSTAT_FLAG(name) /* nothing */ +#define LOCKSTAT_ENTER(name) /* nothing */ +#define LOCKSTAT_EXIT(name) /* nothing */ +#define LOCKSTAT_EVENT(flag, lock, type, count, time) /* nothing */ +#define LOCKSTAT_EVENT_RA(flag, lock, type, count, time, ra) /* nothing */ +#define LOCKSTAT_TIMER(void) /* nothing */ +#define LOCKSTAT_COUNTER(void) /* nothing */ +#define LOCKSTAT_START_TIMER(flag, void) /* nothing */ +#define LOCKSTAT_STOP_TIMER(flag, void) /* nothing */ +#define LOCKSTAT_COUNT(name, int) /* nothing */ #endif |
