-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoPAPI_status.h
More file actions
46 lines (40 loc) · 1021 Bytes
/
oPAPI_status.h
File metadata and controls
46 lines (40 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef _OPAPI_STATUS_H_
#define _OPAPI_STATUS_H_
#include "mex.h"
#define OPAPI_STATUS_NONE -2
#define OPAPI_STATUS_INIT -1
#define OPAPI_STATUS_COUNTING 0
/* OPAPI_STATUS_1, 2, 3,... number of active counters */
/*
* Set global variable oPAPI_status
*/
void oPAPI_setGlobalStatus(int initial_value)
{
mxArray *oPAPI_status = mxCreateNumericMatrix(1, 1, mxINT32_CLASS, mxREAL);
int *status = (int *)mxGetData(oPAPI_status);
*status = initial_value;
mexPutVariable("global", "oPAPI_status", oPAPI_status);
}
/*
* Get global variable oPAPI_status
*/
int oPAPI_getGlobalStatus()
{
mxArray *oPAPI_status = mexGetVariable("global", "oPAPI_status");
if (oPAPI_status == 0)
{
return OPAPI_STATUS_NONE;
}
return *((int *)mxGetData(oPAPI_status));
}
int oPAPI_getNumRunningCounters()
{
int current_status = oPAPI_getGlobalStatus();
if (current_status > OPAPI_STATUS_COUNTING)
{
return current_status;
}
return 0;
}
/* _OPAPI_STATUS_H_ */
#endif