EssDumpPerfStats

Description

EssDumpPerfStats() dumps performance statistics tables to a character array.

Syntax

ESS_FUNC_M EssDumpPerfStats (hCtx, pStatBuf)

ESS_HCTX_ThCtx;
ESS_STR_TpStatBuf;

Parameters

hCtxEssbase API context handle
pStatBufPointer to the address where performance statistics tables will be dumped

Return Value

Notes

Before you call EssDumpPerfStats(), call EssGetStatBufSize() to ascertain how much memory to allocate for the performance statistics tables at the address pointed to by pStatBuf.

Access

The caller of this function must have supervisor access.

Example

/* This function gets the array of performance stats */

ESS_STS_T ESSGetPerfStats(ESS_HCTX_T *context)
{
  ESS_STS_T    sts;
  ESS_ULONG_T  bufsize;
  ESS_PUCHAR_T poutarray;  /* Pointer to the stats staging area */

  /* Get the size of the output buffer */
  if(sts = EssGetStatBufSize(context, &bufsize))
    return(sts);

  if(bufsize)
  {
    /* Allocate a staging area */
    (ESS_PVOID_T)(poutarray) = malloc (bufsize);

    /* Fill the staging area */
    sts = EssDumpPerfStats(context, poutarray);
    if(sts)
      return(sts);

    /* Do something useful with the stats here */
    /* ....................................... */
	
    /* Free the staging area */
    sts = EssFree(context, poutarray);
    if(sts)
      return(sts);
  }
  else
  {
    printf("Performance Statistics not enabled, call ResetPerfStats()\n");
  }
  return(ESS_STS_NOERR);
}

See Also

EssGetStatBufSize()
EssResetPerfStats()