[Libsysio-commit] HEAD: libsysio/include sysio-cmn.h
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2005-09-15 21:31:47
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19135/include Modified Files: sysio-cmn.h Log Message: Support user-defined entry/exit callbacks and switch existing trace-print support to the new mechanism. Introduces: _sysio_entry_trace_q and _sysio_exit_trace_q; pointers to the 2 callback queues. _sysio_register_trace; To register a callback _sysio_remove_trace; To remove a previously registered callback _sysio_run_trace_q; To execute the callbacks in a trace queue. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- sysio-cmn.h 25 Jan 2005 00:37:07 -0000 1.5 +++ sysio-cmn.h 15 Sep 2005 21:31:38 -0000 1.6 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2004 Sandia Corporation. + * Cplant(TM) Copyright 1998-2005 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -152,15 +152,35 @@ struct iovec; #if SYSIO_TRACING extern int _sysio_tracing; +extern void *_sysio_entry_trace_q; +extern void *_sysio_exit_trace_q; + +extern void *_sysio_register_trace(void *q, + void (*)(const char *file, + const char *func, + int line)); +extern void _sysio_remove_trace(void *q, void *p); +extern void _sysio_run_trace_q(void *q, + const char *file, + const char *func, + int line); #define SYSIO_ENTER \ - if (_sysio_tracing) _sysio_cprintf("+ENTER+ %s\n", __func__) + do { \ + _sysio_run_trace_q(_sysio_entry_trace_q, \ + __FILE__, __func__, __LINE__); \ + } while (0) + #define SYSIO_LEAVE \ - if (_sysio_tracing) _sysio_cprintf("+LEAVE+ %s\n", __func__) + do { \ + _sysio_run_trace_q(_sysio_exit_trace_q, \ + __FILE__, __func__, __LINE__); \ + } while (0) #else -#define SYSIO_ENTER -#define SYSIO_LEAVE - +#define SYSIO_ENTER \ + do { } while (0) +#define SYSIO_LEAVE \ + do { } while (0) #endif /* accounting for IO stats read and write char count */ |