# EssDumpPerfStats

Description

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

Syntax

ESS_FUNC_M EssDumpPerfStats (hCtx, pStatBuf)

ESS_HCTX_T | hCtx;
ESS_STR_T | pStatBuf;

Parameters

hCtx | Essbase API context handle
pStatBuf | Pointer to the address where performance statistics tables will be dumped

Return Value

- If successful, EssDumpPerfStats()
  - Returns 0.
  - Dumps performance statistics tables to a character array that begins at the address pointed to by pStatBuf.
- The caller of EssDumpPerfStats() is responsible for allocating and freeing memory at the address pointed to by pStatBuf.
- For more information on performance statistics tables, see the ESSCMD commands GETPERFSTATS and RESETPERFSTATS in the Technical Reference.

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()