summaryrefslogtreecommitdiffstats
path: root/src/H5trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5trace.c')
-rw-r--r--src/H5trace.c163
1 files changed, 81 insertions, 82 deletions
diff --git a/src/H5trace.c b/src/H5trace.c
index e6a091c..41f3418 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -15,11 +15,11 @@
/*-------------------------------------------------------------------------
*
- * Created: H5trace.c
- * Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5trace.c
+ * Aug 21 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
*
- * Purpose: Internal code for tracing API calls
+ * Purpose: Internal code for tracing API calls
*
*-------------------------------------------------------------------------
*/
@@ -27,18 +27,17 @@
/****************/
/* Module Setup */
/****************/
-#define H5I_PACKAGE /*suppress error about including H5Ipkg */
-
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Ipkg.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Ipkg.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
/* datatypes of predefined drivers needed by H5_trace() */
@@ -83,36 +82,36 @@
/*-------------------------------------------------------------------------
- * Function: H5_trace
+ * Function: H5_trace
*
- * Purpose: This function is called whenever an API function is called
- * and tracing is turned on. If RETURNING is non-zero then
- * the caller is about to return and RETURNING points to the
+ * Purpose: This function is called whenever an API function is called
+ * and tracing is turned on. If RETURNING is non-zero then
+ * the caller is about to return and RETURNING points to the
* time for the corresponding function call event. Otherwise
* we print the function name and the arguments.
*
- * The TYPE argument is a string which gives the type of each of
- * the following argument pairs. Each type is zero or more
- * asterisks (one for each level of indirection, although some
- * types have one level of indirection already implied) followed
- * by either one letter (lower case) or two letters (first one
- * uppercase).
+ * The TYPE argument is a string which gives the type of each of
+ * the following argument pairs. Each type is zero or more
+ * asterisks (one for each level of indirection, although some
+ * types have one level of indirection already implied) followed
+ * by either one letter (lower case) or two letters (first one
+ * uppercase).
*
- * The variable argument list consists of pairs of values. Each
- * pair is a string which is the formal argument name in the
- * calling function, followed by the argument value. The type
- * of the argument value is given by the TYPE string.
+ * The variable argument list consists of pairs of values. Each
+ * pair is a string which is the formal argument name in the
+ * calling function, followed by the argument value. The type
+ * of the argument value is given by the TYPE string.
*
- * Note: The TYPE string is meant to be terse and is generated by a
- * separate perl script.
+ * Note: The TYPE string is meant to be terse and is generated by a
+ * separate perl script.
*
- * WARNING: DO NOT CALL ANY HDF5 FUNCTION THAT CALLS FUNC_ENTER(). DOING
- * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY
- * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED.
+ * WARNING: DO NOT CALL ANY HDF5 FUNCTION THAT CALLS FUNC_ENTER(). DOING
+ * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY
+ * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED.
*
- * Return: Execution time for an API call
+ * Return: Execution time for an API call
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, June 16, 1998
*
*-------------------------------------------------------------------------
@@ -120,14 +119,14 @@
double
H5_trace(const double *returning, const char *func, const char *type, ...)
{
- va_list ap;
- char buf[64], *rest;
- const char *argname;
- int argno = 0, ptr, asize_idx;
- hssize_t asize[16];
- hssize_t i;
- void *vp = NULL;
- FILE *out = H5_debug_g.trace;
+ va_list ap;
+ char buf[64], *rest;
+ const char *argname;
+ int argno = 0, ptr, asize_idx;
+ hssize_t asize[16];
+ hssize_t i;
+ void *vp = NULL;
+ FILE *out = H5_debug_g.trace;
H5_timer_t event_time;
static H5_timer_t first_time = {0.0F, 0.0F, 0.0F};
static int current_depth = 0;
@@ -206,48 +205,48 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* Parse the argument types */
for(argno = 0; *type; argno++, type += (HDisupper(*type) ? 2 : 1)) {
- /* Count levels of indirection */
- for(ptr = 0; '*' == *type; type++)
+ /* Count levels of indirection */
+ for(ptr = 0; '*' == *type; type++)
ptr++;
- if('[' == *type) {
- if('a' == type[1]) {
- asize_idx = (int)HDstrtol(type + 2, &rest, 10);
+ if('[' == *type) {
+ if('a' == type[1]) {
+ asize_idx = (int)HDstrtol(type + 2, &rest, 10);
HDassert(0 <= asize_idx && asize_idx < (int) NELMTS(asize));
- HDassert(']'==*rest);
- type = rest + 1;
- } else {
- rest = (char *)HDstrchr(type, ']');
- HDassert(rest);
- type = rest + 1;
- asize_idx = -1;
- }
- } /* end if */
+ HDassert(']'==*rest);
+ type = rest + 1;
+ } else {
+ rest = (char *)HDstrchr(type, ']');
+ HDassert(rest);
+ type = rest + 1;
+ asize_idx = -1;
+ }
+ } /* end if */
else
- asize_idx = -1;
-
- /*
- * The argument name. Leave off the `_id' part. If the argument
- * name is the null pointer then don't print the argument or the
- * following `='. This is used for return values.
- */
- argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */
- if(argname) {
- unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */
-
- if(!HDstrcmp(argname + n, "_id")) {
- HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n));
- buf[MIN((int)sizeof(buf) - 1, n)] = '\0';
- argname = buf;
- } /* end if */
- fprintf(out, "%s%s=", argno?", ":"", argname);
- } /* end if */
+ asize_idx = -1;
+
+ /*
+ * The argument name. Leave off the `_id' part. If the argument
+ * name is the null pointer then don't print the argument or the
+ * following `='. This is used for return values.
+ */
+ argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */
+ if(argname) {
+ unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */
+
+ if(!HDstrcmp(argname + n, "_id")) {
+ HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n));
+ buf[MIN((int)sizeof(buf) - 1, n)] = '\0';
+ argname = buf;
+ } /* end if */
+ fprintf(out, "%s%s=", argno?", ":"", argname);
+ } /* end if */
else
- argname = "";
+ argname = "";
- /* The value */
- if(ptr)
+ /* The value */
+ if(ptr)
vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */
- switch(type[0]) {
+ switch(type[0]) {
case 'a':
if(ptr) {
if(vp)
@@ -268,7 +267,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
- } /* end if */
+ } /* end if */
else {
hbool_t bool_var = va_arg(ap, hbool_t); /*lint !e732 Loss of sign not really occuring */
@@ -2554,7 +2553,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
else
fprintf(out, "BADTYPE(%c)", type[0]);
goto error;
- } /* end switch */
+ } /* end switch */
} /* end for */
/* Display event time for return */
@@ -2565,10 +2564,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
error:
va_end(ap);
if(returning)
- fprintf(out, ";\n");
+ fprintf(out, ";\n");
else {
- last_call_depth = current_depth++;
- fprintf (out, ")");
+ last_call_depth = current_depth++;
+ fprintf (out, ")");
} /* end else */
HDfflush(out);