Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/matt-nb6-plus]: src/sys/sys Sync with HEAD.



details:   https://anonhg.NetBSD.org/src/rev/20d2cd6834a2
branches:  matt-nb6-plus
changeset: 774564:20d2cd6834a2
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Feb 19 07:19:40 2013 +0000

description:
Sync with HEAD.

diffstat:

 sys/sys/kernhist.h |  26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diffs (73 lines):

diff -r b74c8bb193ba -r 20d2cd6834a2 sys/sys/kernhist.h
--- a/sys/sys/kernhist.h        Tue Feb 19 02:31:55 2013 +0000
+++ b/sys/sys/kernhist.h        Tue Feb 19 07:19:40 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernhist.h,v 1.4 2011/11/21 04:36:05 christos Exp $    */
+/*     $NetBSD: kernhist.h,v 1.4.6.1 2013/02/19 07:19:40 matt Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -93,9 +93,11 @@
  */
 #ifndef KERNHIST
 #define KERNHIST_DECL(NAME)
+#define KERNHIST_DEFINE(NAME)
 #define KERNHIST_INIT(NAME,N)
 #define KERNHIST_INIT_STATIC(NAME,BUF)
 #define KERNHIST_LOG(NAME,FMT,A,B,C,D)
+#define KERNHIST_CALLARGS(NAME,FMT,A,B,C,D)
 #define KERNHIST_CALLED(NAME)
 #define KERNHIST_FUNC(FNAME)
 #define kernhist_dump(NAME)
@@ -106,7 +108,8 @@
 
 extern struct kern_history_head kern_histories;
 
-#define KERNHIST_DECL(NAME) struct kern_history NAME
+#define KERNHIST_DECL(NAME) extern struct kern_history NAME
+#define KERNHIST_DEFINE(NAME) struct kern_history NAME
 
 #define KERNHIST_INIT(NAME,N) \
 do { \
@@ -130,13 +133,18 @@
        LIST_INSERT_HEAD(&kern_histories, &(NAME), list); \
 } while (/*CONSTCOND*/ 0)
 
+#ifndef KERNHIST_DELAY
+#define KERNHIST_DELAY 100000
+#endif
+
 #if defined(KERNHIST_PRINT)
 extern int kernhist_print_enabled;
 #define KERNHIST_PRINTNOW(E) \
 do { \
                if (kernhist_print_enabled) { \
                        kernhist_entry_print(E); \
-                       DELAY(100000); \
+                       if (KERNHISTDELAY != 0) \
+                               DELAY(KERNHIST_DELAY); \
                } \
 } while (/*CONSTCOND*/ 0)
 #else
@@ -172,10 +180,20 @@
        KERNHIST_LOG(NAME, "called!", 0, 0, 0, 0); \
 } while (/*CONSTCOND*/ 0)
 
+/*
+ * This extends kernhist to avoid wasting a separate "called!" entry on every
+ * function.
+ */
+#define KERNHIST_CALLARGS(NAME, FMT, A, B, C, D) \
+do { \
+       _kernhist_call = atomic_inc_uint_nv(&_kernhist_cnt); \
+       KERNHIST_LOG(NAME, "called: "FMT, (A), (B), (C), (D)); \
+} while (/*CONSTCOND*/ 0)
+
 #define KERNHIST_FUNC(FNAME) \
        static unsigned int _kernhist_cnt = 0; \
        static const char *const _kernhist_name = FNAME; \
-       int _kernhist_call = 0;
+       unsigned int _kernhist_call = 0;
 
 static inline void kernhist_entry_print(const struct kern_history_ent *);
 



Home | Main Index | Thread Index | Old Index