// Copyright (c) 2019 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.

/**
 * IDiagnostics is an interface enabling clients to obtain
 * diagnostic information.
 */

/** @cond */

struct IDiagnostics_HeapInfo
{
  uint32 totalSize;             /** Total size of heap */
  uint32 usedSize;              /** Amount of heap currently allocated */
  uint32 freeSize;              /** Amount of free space */
  uint32 overheadSize;          /** Amount of bytes consumed as overhead */
  uint32 wastedSize;            /** Amount of bytes not available for allocation */
  uint32 largestFreeBlockSize;  /** Size of largest free block */
};

/** @endcond */


/** @cond */
interface IDiagnostics {
/** @endcond */

  /**
   * @addtogroup IDiagnostics
   * @{
   */

  /**
    Provides the caller with information regarding heap usage in QTEE.

    @param[out] heapInfo  An output structure populated with heap
                          usage information.

    @return
    Object_OK on success.
  */
  method queryHeapInfo (out IDiagnostics_HeapInfo heapInfo);


  /**
    Provides the caller with a list of the currently loaded
    trusted applications.

    @param[out] loadedApps  An output buffer populated with the distinguished
                            name of every currently loaded app.
                            Each entry in the list is separated by a single
                            newline character.  A null-character is appended
                            at the end of the list.
                            The list has no guaranteed order.
                            The caller must provide a buffer large enough
                            for the entire output.

    @return
    Object_OK on success.
    Object_ERROR_SIZE_OUT if the output buffer is not sufficiently large.
  */
  method queryLoadedApps (out buffer loadedApps);

  /* @} */ /* end_addtogroup IDiagnostics */
};


