2 * Copyright (C) 2017 Austin English
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 typedef LPVOID (CDECL
* PERF_MEM_ALLOC
)(SIZE_T
,LPVOID
);
27 typedef void (CDECL
* PERF_MEM_FREE
)(LPVOID
,LPVOID
);
28 typedef ULONG (WINAPI
* PERFLIBREQUEST
)(ULONG
,PVOID
,ULONG
);
30 typedef struct _PERF_COUNTERSET_INFO
{
35 } PERF_COUNTERSET_INFO
, * PPERF_COUNTERSET_INFO
;
37 /* PERF_COUNTERSET_INFO InstanceType values. */
38 #define PERF_COUNTERSET_FLAG_MULTIPLE 0x00000002
39 #define PERF_COUNTERSET_FLAG_AGGREGATE 0x00000004
40 #define PERF_COUNTERSET_FLAG_HISTORY 0x00000008
41 #define PERF_COUNTERSET_FLAG_INSTANCE 0x00000010
43 #define PERF_COUNTERSET_SINGLE_INSTANCE 0
44 #define PERF_COUNTERSET_MULTI_INSTANCES PERF_COUNTERSET_FLAG_MULTIPLE
45 #define PERF_COUNTERSET_SINGLE_AGGREGATE PERF_COUNTERSET_FLAG_AGGREGATE
46 #define PERF_COUNTERSET_MULTI_AGGREGATE (PERF_COUNTERSET_FLAG_AGGREGATE | PERF_COUNTERSET_FLAG_MULTIPLE)
47 #define PERF_COUNTERSET_SINGLE_AGGREGATE_HISTORY (PERF_COUNTERSET_FLAG_HISTORY | PERF_COUNTERSET_SINGLE_AGGREGATE)
48 #define PERF_COUNTERSET_INSTANCE_AGGREGATE (PERF_COUNTERSET_MULTI_AGGREGATE | PERF_COUNTERSET_FLAG_INSTANCE)
50 typedef struct _PERF_COUNTERSET_INSTANCE
{
54 ULONG InstanceNameOffset
;
55 ULONG InstanceNameSize
;
56 } PERF_COUNTERSET_INSTANCE
, * PPERF_COUNTERSET_INSTANCE
;
58 typedef struct _PERF_COUNTER_INFO
{
66 } PERF_COUNTER_INFO
, *PPERF_COUNTER_INFO
;
68 /* PERF_COUNTER_INFO Attrib flags. */
69 #define PERF_ATTRIB_BY_REFERENCE 0x00000001
70 #define PERF_ATTRIB_NO_DISPLAYABLE 0x00000002
71 #define PERF_ATTRIB_NO_GROUP_SEPARATOR 0x00000004
72 #define PERF_ATTRIB_DISPLAY_AS_REAL 0x00000008
73 #define PERF_ATTRIB_DISPLAY_AS_HEX 0x00000010
75 typedef struct _PROVIDER_CONTEXT
{
78 PERFLIBREQUEST ControlCallback
;
79 PERF_MEM_ALLOC MemAllocRoutine
;
80 PERF_MEM_FREE MemFreeRoutine
;
82 } PERF_PROVIDER_CONTEXT
, * PPERF_PROVIDER_CONTEXT
;
84 typedef struct _PERF_COUNTER_IDENTIFIER
{
92 } PERF_COUNTER_IDENTIFIER
, *PPERF_COUNTER_IDENTIFIER
;
94 #define PERF_WILDCARD_COUNTER 0xFFFFFFFF
95 #define PERF_WILDCARD_INSTANCE L"*"
97 typedef struct _PERF_DATA_HEADER
{
100 LONGLONG PerfTimeStamp
;
101 LONGLONG PerfTime100NSec
;
103 SYSTEMTIME SystemTime
;
104 } PERF_DATA_HEADER
, *PPERF_DATA_HEADER
;
106 PERF_COUNTERSET_INSTANCE WINAPI
*PerfCreateInstance(HANDLE
, const GUID
*, const WCHAR
*, ULONG
);
107 ULONG WINAPI
PerfDeleteInstance(HANDLE
, PERF_COUNTERSET_INSTANCE
*);
108 ULONG WINAPI
PerfSetCounterRefValue(HANDLE
, PERF_COUNTERSET_INSTANCE
*, ULONG
, void *);
109 ULONG WINAPI
PerfSetCounterSetInfo(HANDLE
, PERF_COUNTERSET_INFO
*, ULONG
);
110 ULONG WINAPI
PerfStartProvider(GUID
*, PERFLIBREQUEST
, HANDLE
*);
111 ULONG WINAPI
PerfStartProviderEx(GUID
*, PERF_PROVIDER_CONTEXT
*, HANDLE
*);
112 ULONG WINAPI
PerfStopProvider(HANDLE
);
114 ULONG WINAPI
PerfAddCounters(HANDLE
, PERF_COUNTER_IDENTIFIER
*, DWORD
);
115 ULONG WINAPI
PerfCloseQueryHandle(HANDLE
);
116 ULONG WINAPI
PerfOpenQueryHandle(const WCHAR
*, HANDLE
*);
117 ULONG WINAPI
PerfQueryCounterData(HANDLE
, PERF_DATA_HEADER
*, DWORD
, DWORD
*);
123 #endif /* _PERFLIB_H_ */