System Preprocessors
|
Go to the source code of this file.
Functions | |
PetscErrorCode | SysProDefaultTrace (void *ctx, const char *fmt, va_list argp) |
PetscErrorCode | SysProDeclareTraceFunction (PetscErrorCode(*fn)(void *, const char *, va_list)) |
PetscErrorCode | SysProDeclareTraceContext (void *ctx) |
PetscErrorCode | SysProTraceMessage (const char *fmt,...) |
PetscErrorCode | SysProHasTrace (PetscTruth *flg) |
Variables | |
static PetscErrorCode(* | sysprotrace )(void *, const char *fmt, va_list) = NULL |
static size_t | sysprotracectx = (size_t)NULL |
PetscErrorCode SysProDeclareTraceContext | ( | void * | ctx | ) |
Definition at line 77 of file tracing.c.
References sysprotracectx.
PetscErrorCode SysProDeclareTraceFunction | ( | PetscErrorCode(*)(void *, const char *, va_list) | fn | ) |
Specify a trace function.
The trace function has a prototype
PetscErrorCode tracefunction(void*,char*,va_list)
which means that it has an arbitrary number of arguments, much like printf
. The first argument is a context, which can be set by SysProDeclareTraceContext().
Here is an example of how you would write a trace function:
#include <stdarg.h> PetscErrorCode tracefunction(void *ctx,char *fmt,va_list argp) { char *prefix = (char*)ctx; PetscFunctionBegin; printf("%s ",prefix); vprintf(fmt, argp); PetscFunctionReturn(0); }
Consult string.h
(probably in /usr/include
) to see which "v" versions of printf
are available.
There is a default trace function SysProDefaultTrace().
You can undeclare a trace function by passing NULL.
See also SysProTraceMessage().
Definition at line 64 of file tracing.c.
References sysprotrace.
Referenced by main().
PetscErrorCode SysProDefaultTrace | ( | void * | ctx, |
const char * | fmt, | ||
va_list | argp | ||
) |
PetscErrorCode SysProHasTrace | ( | PetscTruth * | flg | ) |
Test whether a trace function has been declared; see SysProDeclareTraceFunction(). Normally you would use SysProTraceMessage() which performs this test internally, but this function can be useful if a large amount of processing has to be performed to construct the trace message to begin with.
Definition at line 109 of file tracing.c.
References sysprotrace.
Referenced by ReportEnabledPreprocessors(), ReportSysProCallStackState(), ScreenOutputTab(), and ScreenOutputTabLine().
PetscErrorCode SysProTraceMessage | ( | const char * | fmt, |
... | |||
) |
This function prints a trace message if a trace function has been declared; see SysProDeclareTraceFunction().
Definition at line 89 of file tracing.c.
References CHKERRQ(), ierr, sysprotrace, and sysprotracectx.
Referenced by adder(), ChooseFirstTransform(), PreprocessedSolution(), ReportEnabledPreprocessors(), ReportSysProCallStackState(), ScreenOutputTab(), ScreenOutputTabLine(), and solvebycopy().
PetscErrorCode(* sysprotrace)(void *, const char *fmt, va_list) = NULL [static] |
Definition at line 17 of file tracing.c.
Referenced by SysProDeclareTraceFunction(), SysProHasTrace(), and SysProTraceMessage().
size_t sysprotracectx = (size_t)NULL [static] |
Definition at line 18 of file tracing.c.
Referenced by SysProDeclareTraceContext(), and SysProTraceMessage().