25#ifndef _GPUMETRICINTERFACE_H
26#define _GPUMETRICINTERFACE_H
33#if defined(__cplusplus)
38#define MAX_STR_LEN 256
46#define M_ACCUMULATE 0x0
67typedef struct DeviceInfo_S {
78typedef struct DataEntry_S {
90typedef struct MetricData_S {
100typedef struct MetricNode_S {
114#define DCODE_MASK 0xfff
115#define IDX_MASK 0xffff
117#define CreateDeviceCode(drv, dev, sdev) \
118 ((((drv)&DMASK)<<(SDEV_BITS+DEV_BITS)) | \
119 (((dev)&DMASK)<<SDEV_BITS) | \
125#define CreateIdxCode(devcode, idx) ((((devcode)&DCODE_MASK)<<IDX_BITS)|((idx)&IDX_MASK))
127#define GetDeviceCode(handle) (((handle) >> IDX_BITS) & DCODE_MASK)
128#define GetIdx(handle) ((handle) & IDX_MASK)
129#define GetSDev(handle) (((handle) >> IDX_BITS) & DMASK)
130#define GetDev(handle) (((handle) >> (IDX_BITS+SDEV_BITS)) & DMASK)
131#define GetDrv(handle) (((handle) >> (IDX_BITS+SDEV_BITS+DEV_BITS)) & DMASK)
132#define IsDeviceHandle(devcode, handle) ((devcode) == (((handle)>>IDX_BITS)&DCODE_MASK))
138#define METRIC_GROUP_MASK 0xff00
139#define METRIC_MASK 0x00ff
141#define CreateGroupCode(mGroupId) (((mGroupId+1)<<METRIC_BITS) & METRIC_GROUP_MASK)
142#define CreateMetricCode(mGroupId, mId) ((CreateGroupCode(mGroupId)) | ((mId+1)&METRIC_MASK))
143#define GetGroupIdx(code) (((code) & METRIC_GROUP_MASK) >> METRIC_BITS)
144#define GetMetricIdx(code) ((code) & METRIC_MASK)
147#define MAX_METRICS 128
149#define MAX_NUM_REPORTS 20
152#define METRIC_SAMPLE 0x1
153#define METRIC_SUMMARY 0x2
154#define METRIC_RESET 0x4
255 char *metricGroupName, uint32_t metricGroupCode, uint32_t mtype,
256 uint32_t period, uint32_t numReports);
276 uint32_t numMetrics, uint32_t mtype,
277 uint32_t period, uint32_t numReports);
363#if defined(__cplusplus)
int GPUGetMetricList(DEVICE_HANDLE handle, char *groupName, uint32_t mtype, MetricInfo *data)
list available metrics in the named group. If name is "", list all available metrics in all groups
void strncpy_se(char *dest, size_t destSize, char *src, size_t count)
int GPUEnableMetricGroup(DEVICE_HANDLE handle, char *metricGroupName, uint32_t metricGroupCode, uint32_t mtype, uint32_t period, uint32_t numReports)
MetricInfo * GPUAllocMetricInfo(uint32_t count)
int GPUGetMetricGroups(DEVICE_HANDLE handle, uint32_t mtype, MetricInfo *data)
list available metric groups for the selected type
void GPUFreeMetricInfo(MetricInfo *info, uint32_t count)
char NAMESTR[MAX_STR_LEN]
int GPUEnableMetrics(DEVICE_HANDLE handle, char **metricNameList, uint32_t numMetrics, uint32_t mtype, uint32_t period, uint32_t numReports)
int GPUStop(DEVICE_HANDLE handle)
int GPUDisableMetricGroup(DEVICE_HANDLE handle, uint32_t mtype)
int GPUDetectDevice(DEVICE_HANDLE **handle, uint32_t *numDevice)
Detect the named device which has performance monitoring feature availale.
MetricData * GPUReadMetricData(DEVICE_HANDLE handle, uint32_t mode, uint32_t *reportCounts)
read metric data
int GPUPrintDeviceInfo(DEVICE_HANDLE handle, FILE *stream)
Get the device properties, which is mainly in <name, value> format.
void GPUFreeMetricData(MetricData *data, uint32_t count)
int GPUSetMetricControl(DEVICE_HANDLE handle, uint32_t mode)
set control for metric data collection
int GPUGetDeviceInfo(DEVICE_HANDLE handle, MetricInfo *data)
Get the device properties, which is mainly in <name, value> format.
MetricData * GPUAllocMetricData(uint32_t count, uint32_t numSets, uint32_t numMetrics)
int GPUStart(DEVICE_HANDLE handle)
start collection
void GPUFreeDevice(DEVICE_HANDLE handle)
free the resouce related this device handle
static papi_handle_t handle
MetricInfo * metricGroups