ReactOS 0.4.16-dev-1409-g71b6fab
perflib.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PERF_COUNTERSET_INFO
 
struct  _PERF_COUNTERSET_INSTANCE
 
struct  _PERF_COUNTER_INFO
 
struct  _PROVIDER_CONTEXT
 
struct  _PERF_COUNTER_IDENTIFIER
 
struct  _PERF_DATA_HEADER
 

Macros

#define PERF_COUNTERSET_FLAG_MULTIPLE   0x00000002
 
#define PERF_COUNTERSET_FLAG_AGGREGATE   0x00000004
 
#define PERF_COUNTERSET_FLAG_HISTORY   0x00000008
 
#define PERF_COUNTERSET_FLAG_INSTANCE   0x00000010
 
#define PERF_COUNTERSET_SINGLE_INSTANCE   0
 
#define PERF_COUNTERSET_MULTI_INSTANCES   PERF_COUNTERSET_FLAG_MULTIPLE
 
#define PERF_COUNTERSET_SINGLE_AGGREGATE   PERF_COUNTERSET_FLAG_AGGREGATE
 
#define PERF_COUNTERSET_MULTI_AGGREGATE   (PERF_COUNTERSET_FLAG_AGGREGATE | PERF_COUNTERSET_FLAG_MULTIPLE)
 
#define PERF_COUNTERSET_SINGLE_AGGREGATE_HISTORY   (PERF_COUNTERSET_FLAG_HISTORY | PERF_COUNTERSET_SINGLE_AGGREGATE)
 
#define PERF_COUNTERSET_INSTANCE_AGGREGATE   (PERF_COUNTERSET_MULTI_AGGREGATE | PERF_COUNTERSET_FLAG_INSTANCE)
 
#define PERF_ATTRIB_BY_REFERENCE   0x00000001
 
#define PERF_ATTRIB_NO_DISPLAYABLE   0x00000002
 
#define PERF_ATTRIB_NO_GROUP_SEPARATOR   0x00000004
 
#define PERF_ATTRIB_DISPLAY_AS_REAL   0x00000008
 
#define PERF_ATTRIB_DISPLAY_AS_HEX   0x00000010
 
#define PERF_WILDCARD_COUNTER   0xFFFFFFFF
 
#define PERF_WILDCARD_INSTANCE   L"*"
 

Typedefs

typedef void__WINE_ALLOC_SIZE(1) CDECL *PERF_MEM_ALLOC) (SIZE_T
 
typedef void void *typedef void(CDECLPERF_MEM_FREE) (LPVOID, LPVOID)
 
typedef ULONG(WINAPIPERFLIBREQUEST) (ULONG, PVOID, ULONG)
 
typedef struct _PERF_COUNTERSET_INFO PERF_COUNTERSET_INFO
 
typedef struct _PERF_COUNTERSET_INFOPPERF_COUNTERSET_INFO
 
typedef struct _PERF_COUNTERSET_INSTANCE PERF_COUNTERSET_INSTANCE
 
typedef struct _PERF_COUNTERSET_INSTANCEPPERF_COUNTERSET_INSTANCE
 
typedef struct _PERF_COUNTER_INFO PERF_COUNTER_INFO
 
typedef struct _PERF_COUNTER_INFOPPERF_COUNTER_INFO
 
typedef struct _PROVIDER_CONTEXT PERF_PROVIDER_CONTEXT
 
typedef struct _PROVIDER_CONTEXTPPERF_PROVIDER_CONTEXT
 
typedef struct _PERF_COUNTER_IDENTIFIER PERF_COUNTER_IDENTIFIER
 
typedef struct _PERF_COUNTER_IDENTIFIERPPERF_COUNTER_IDENTIFIER
 
typedef struct _PERF_DATA_HEADER PERF_DATA_HEADER
 
typedef struct _PERF_DATA_HEADERPPERF_DATA_HEADER
 

Functions

PERF_COUNTERSET_INSTANCE WINAPIPerfCreateInstance (HANDLE, const GUID *, const WCHAR *, ULONG)
 
ULONG WINAPI PerfDeleteInstance (HANDLE, PERF_COUNTERSET_INSTANCE *)
 
ULONG WINAPI PerfSetCounterRefValue (HANDLE, PERF_COUNTERSET_INSTANCE *, ULONG, void *)
 
ULONG WINAPI PerfSetCounterSetInfo (HANDLE, PERF_COUNTERSET_INFO *, ULONG)
 
ULONG WINAPI PerfStartProvider (GUID *, PERFLIBREQUEST, HANDLE *)
 
ULONG WINAPI PerfStartProviderEx (GUID *, PERF_PROVIDER_CONTEXT *, HANDLE *)
 
ULONG WINAPI PerfStopProvider (HANDLE)
 
ULONG WINAPI PerfAddCounters (HANDLE, PERF_COUNTER_IDENTIFIER *, DWORD)
 
ULONG WINAPI PerfCloseQueryHandle (HANDLE)
 
ULONG WINAPI PerfOpenQueryHandle (const WCHAR *, HANDLE *)
 
ULONG WINAPI PerfQueryCounterData (HANDLE, PERF_DATA_HEADER *, DWORD, DWORD *)
 

Macro Definition Documentation

◆ PERF_ATTRIB_BY_REFERENCE

#define PERF_ATTRIB_BY_REFERENCE   0x00000001

Definition at line 69 of file perflib.h.

◆ PERF_ATTRIB_DISPLAY_AS_HEX

#define PERF_ATTRIB_DISPLAY_AS_HEX   0x00000010

Definition at line 73 of file perflib.h.

◆ PERF_ATTRIB_DISPLAY_AS_REAL

#define PERF_ATTRIB_DISPLAY_AS_REAL   0x00000008

Definition at line 72 of file perflib.h.

◆ PERF_ATTRIB_NO_DISPLAYABLE

#define PERF_ATTRIB_NO_DISPLAYABLE   0x00000002

Definition at line 70 of file perflib.h.

◆ PERF_ATTRIB_NO_GROUP_SEPARATOR

#define PERF_ATTRIB_NO_GROUP_SEPARATOR   0x00000004

Definition at line 71 of file perflib.h.

◆ PERF_COUNTERSET_FLAG_AGGREGATE

#define PERF_COUNTERSET_FLAG_AGGREGATE   0x00000004

Definition at line 39 of file perflib.h.

◆ PERF_COUNTERSET_FLAG_HISTORY

#define PERF_COUNTERSET_FLAG_HISTORY   0x00000008

Definition at line 40 of file perflib.h.

◆ PERF_COUNTERSET_FLAG_INSTANCE

#define PERF_COUNTERSET_FLAG_INSTANCE   0x00000010

Definition at line 41 of file perflib.h.

◆ PERF_COUNTERSET_FLAG_MULTIPLE

#define PERF_COUNTERSET_FLAG_MULTIPLE   0x00000002

Definition at line 38 of file perflib.h.

◆ PERF_COUNTERSET_INSTANCE_AGGREGATE

#define PERF_COUNTERSET_INSTANCE_AGGREGATE   (PERF_COUNTERSET_MULTI_AGGREGATE | PERF_COUNTERSET_FLAG_INSTANCE)

Definition at line 48 of file perflib.h.

◆ PERF_COUNTERSET_MULTI_AGGREGATE

#define PERF_COUNTERSET_MULTI_AGGREGATE   (PERF_COUNTERSET_FLAG_AGGREGATE | PERF_COUNTERSET_FLAG_MULTIPLE)

Definition at line 46 of file perflib.h.

◆ PERF_COUNTERSET_MULTI_INSTANCES

#define PERF_COUNTERSET_MULTI_INSTANCES   PERF_COUNTERSET_FLAG_MULTIPLE

Definition at line 44 of file perflib.h.

◆ PERF_COUNTERSET_SINGLE_AGGREGATE

#define PERF_COUNTERSET_SINGLE_AGGREGATE   PERF_COUNTERSET_FLAG_AGGREGATE

Definition at line 45 of file perflib.h.

◆ PERF_COUNTERSET_SINGLE_AGGREGATE_HISTORY

#define PERF_COUNTERSET_SINGLE_AGGREGATE_HISTORY   (PERF_COUNTERSET_FLAG_HISTORY | PERF_COUNTERSET_SINGLE_AGGREGATE)

Definition at line 47 of file perflib.h.

◆ PERF_COUNTERSET_SINGLE_INSTANCE

#define PERF_COUNTERSET_SINGLE_INSTANCE   0

Definition at line 43 of file perflib.h.

◆ PERF_WILDCARD_COUNTER

#define PERF_WILDCARD_COUNTER   0xFFFFFFFF

Definition at line 94 of file perflib.h.

◆ PERF_WILDCARD_INSTANCE

#define PERF_WILDCARD_INSTANCE   L"*"

Definition at line 95 of file perflib.h.

Typedef Documentation

◆ __WINE_ALLOC_SIZE

typedef void * __WINE_ALLOC_SIZE(1) CDECL *PERF_MEM_ALLOC)(SIZE_T

Definition at line 26 of file perflib.h.

◆ PERF_COUNTER_IDENTIFIER

◆ PERF_COUNTER_INFO

◆ PERF_COUNTERSET_INFO

◆ PERF_COUNTERSET_INSTANCE

◆ PERF_DATA_HEADER

◆ PERF_MEM_FREE

typedef void void *typedef void(CDECL * PERF_MEM_FREE) (LPVOID, LPVOID)

Definition at line 27 of file perflib.h.

◆ PERF_PROVIDER_CONTEXT

◆ PERFLIBREQUEST

typedef ULONG(WINAPI * PERFLIBREQUEST) (ULONG, PVOID, ULONG)

Definition at line 28 of file perflib.h.

◆ PPERF_COUNTER_IDENTIFIER

◆ PPERF_COUNTER_INFO

◆ PPERF_COUNTERSET_INFO

◆ PPERF_COUNTERSET_INSTANCE

◆ PPERF_DATA_HEADER

◆ PPERF_PROVIDER_CONTEXT

Function Documentation

◆ PerfAddCounters()

ULONG WINAPI PerfAddCounters ( HANDLE  ,
PERF_COUNTER_IDENTIFIER ,
DWORD   
)

◆ PerfCloseQueryHandle()

ULONG WINAPI PerfCloseQueryHandle ( HANDLE  )

◆ PerfCreateInstance()

PERF_COUNTERSET_INSTANCE WINAPI * PerfCreateInstance ( HANDLE  handle,
const GUID guid,
const WCHAR name,
ULONG  id 
)

Definition at line 181 of file main.c.

183{
185 struct counterset_template *template;
186 struct counterset_instance *inst;
187 unsigned int i;
188 ULONG size;
189
190 FIXME( "handle %p, guid %s, name %s, id %lu semi-stub.\n", handle, debugstr_guid(guid), debugstr_w(name), id );
191
192 if (!prov || !guid || !name)
193 {
195 return NULL;
196 }
197
198 for (i = 0; i < prov->counterset_count; ++i)
199 if (IsEqualGUID(guid, &prov->countersets[i]->counterset.CounterSetGuid)) break;
200
201 if (i == prov->counterset_count)
202 {
204 return NULL;
205 }
206
207 template = prov->countersets[i];
208
210 {
211 if (inst->template == template && inst->instance.InstanceId == id)
212 {
214 return NULL;
215 }
216 }
217
218 size = (sizeof(PERF_COUNTERSET_INSTANCE) + template->counterset.NumCounters * sizeof(UINT64)
219 + (lstrlenW( name ) + 1) * sizeof(WCHAR) + 7) & ~7;
220 inst = heap_alloc_zero( offsetof(struct counterset_instance, instance) + size );
221 if (!inst)
222 {
224 return NULL;
225 }
226
227 inst->template = template;
229 inst->instance.dwSize = size;
230 inst->instance.InstanceId = id;
232 + template->counterset.NumCounters * sizeof(UINT64);
233 inst->instance.InstanceNameSize = (lstrlenW( name ) + 1) * sizeof(WCHAR);
235 list_add_tail( &prov->instance_list, &inst->entry );
236
237 return &inst->instance;
238}
unsigned long long UINT64
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define NULL
Definition: types.h:112
static HINSTANCE instance
Definition: main.c:40
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define lstrlenW
Definition: compat.h:750
static struct perf_provider * perf_provider_from_handle(HANDLE prov)
Definition: main.c:173
GUID guid
Definition: version.c:147
const UINT template
Definition: action.c:7511
GLsizeiptr size
Definition: glext.h:5919
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
struct _PERF_COUNTERSET_INSTANCE PERF_COUNTERSET_INSTANCE
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define offsetof(TYPE, MEMBER)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
PERF_COUNTERSET_INSTANCE instance
Definition: main.c:160
struct counterset_template * template
Definition: main.c:159
struct list entry
Definition: main.c:158
Definition: name.c:39
struct counterset_template ** countersets
Definition: main.c:167
unsigned int counterset_count
Definition: main.c:168
struct list instance_list
Definition: main.c:170
uint32_t ULONG
Definition: typedefs.h:59
#define ERROR_NOT_FOUND
Definition: winerror.h:690
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193

◆ PerfDeleteInstance()

ULONG WINAPI PerfDeleteInstance ( HANDLE  provider,
PERF_COUNTERSET_INSTANCE block 
)

Definition at line 243 of file main.c.

244{
245 struct perf_provider *prov = perf_provider_from_handle( provider );
246 struct counterset_instance *inst;
247
248 TRACE( "provider %p, block %p.\n", provider, block );
249
250 if (!prov || !block) return ERROR_INVALID_PARAMETER;
251
253 list_remove( &inst->entry );
254 heap_free( inst );
255
256 return ERROR_SUCCESS;
257}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRACE(s)
Definition: solgame.cpp:4
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static unsigned int block
Definition: xmlmemory.c:101

◆ PerfOpenQueryHandle()

ULONG WINAPI PerfOpenQueryHandle ( const WCHAR ,
HANDLE  
)

◆ PerfQueryCounterData()

ULONG WINAPI PerfQueryCounterData ( HANDLE  ,
PERF_DATA_HEADER ,
DWORD  ,
DWORD  
)

◆ PerfSetCounterRefValue()

ULONG WINAPI PerfSetCounterRefValue ( HANDLE  provider,
PERF_COUNTERSET_INSTANCE instance,
ULONG  counterid,
void address 
)

Definition at line 307 of file main.c.

309{
310 struct perf_provider *prov = perf_provider_from_handle( provider );
311 struct counterset_template *template;
312 struct counterset_instance *inst;
313 unsigned int i;
314
315 FIXME( "provider %p, instance %p, counterid %lu, address %p semi-stub.\n",
316 provider, instance, counterid, address );
317
318 if (!prov || !instance || !address) return ERROR_INVALID_PARAMETER;
319
321 template = inst->template;
322
323 for (i = 0; i < template->counterset.NumCounters; ++i)
324 if (template->counter[i].CounterId == counterid) break;
325
326 if (i == template->counterset.NumCounters) return ERROR_NOT_FOUND;
327 *(void **)((BYTE *)&inst->instance + sizeof(PERF_COUNTERSET_INSTANCE) + template->counter[i].Offset) = address;
328
329 return STATUS_SUCCESS;
330}
GLuint address
Definition: glext.h:9393
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ PerfSetCounterSetInfo()

ULONG WINAPI PerfSetCounterSetInfo ( HANDLE  handle,
PERF_COUNTERSET_INFO template,
ULONG  size 
)

Definition at line 262 of file main.c.

263{
265 struct counterset_template **new_array;
266 struct counterset_template *new;
267 unsigned int i;
268
269 FIXME( "handle %p, template %p, size %lu semi-stub.\n", handle, template, size );
270
271 if (!prov || !template) return ERROR_INVALID_PARAMETER;
272 if (!template->NumCounters) return ERROR_INVALID_PARAMETER;
273 if (size < sizeof(*template) || (size - (sizeof(*template))) / sizeof(PERF_COUNTER_INFO) < template->NumCounters)
275
276 for (i = 0; i < prov->counterset_count; ++i)
277 {
278 if (IsEqualGUID( &template->CounterSetGuid, &prov->countersets[i]->counterset.CounterSetGuid ))
280 }
281
282 size = offsetof( struct counterset_template, counter[template->NumCounters] );
283 if (!(new = heap_alloc( size ))) return ERROR_OUTOFMEMORY;
284
285 if (prov->counterset_count)
286 new_array = heap_realloc( prov->countersets, sizeof(*prov->countersets) * (prov->counterset_count + 1) );
287 else
288 new_array = heap_alloc( sizeof(*prov->countersets) );
289
290 if (!new_array)
291 {
292 heap_free( new );
293 return ERROR_OUTOFMEMORY;
294 }
295 memcpy( new, template, size );
296 for (i = 0; i < template->NumCounters; ++i)
297 new->counter[i].Offset = i * sizeof(UINT64);
298 new_array[prov->counterset_count++] = new;
299 prov->countersets = new_array;
300
301 return STATUS_SUCCESS;
302}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define new(TYPE, numElems)
Definition: treelist.c:54

◆ PerfStartProvider()

ULONG WINAPI PerfStartProvider ( GUID guid,
PERFLIBREQUEST  callback,
HANDLE provider 
)

Definition at line 335 of file main.c.

336{
338
339 FIXME( "guid %s, callback %p, provider %p semi-stub.\n", debugstr_guid(guid), callback, provider );
340
341 memset( &ctx, 0, sizeof(ctx) );
342 ctx.ContextSize = sizeof(ctx);
343 ctx.ControlCallback = callback;
344
345 return PerfStartProviderEx( guid, &ctx, provider );
346}
ULONG WINAPI PerfStartProviderEx(GUID *guid, PERF_PROVIDER_CONTEXT *context, HANDLE *provider)
Definition: main.c:351
static IPrintDialogCallback callback
Definition: printdlg.c:326
#define memset(x, y, z)
Definition: compat.h:39

◆ PerfStartProviderEx()

ULONG WINAPI PerfStartProviderEx ( GUID guid,
PERF_PROVIDER_CONTEXT context,
HANDLE provider 
)

Definition at line 351 of file main.c.

352{
353 struct perf_provider *prov;
354
355 FIXME( "guid %s, context %p, provider %p semi-stub.\n", debugstr_guid(guid), context, provider );
356
357 if (!guid || !context || !provider) return ERROR_INVALID_PARAMETER;
358 if (context->ContextSize < sizeof(*context)) return ERROR_INVALID_PARAMETER;
359
360 if (context->MemAllocRoutine || context->MemFreeRoutine)
361 FIXME("Memory allocation routine is not supported.\n");
362
363 if (!(prov = heap_alloc_zero( sizeof(*prov) ))) return ERROR_OUTOFMEMORY;
364 list_init( &prov->instance_list );
365 memcpy( &prov->guid, guid, sizeof(prov->guid) );
366 prov->callback = context->ControlCallback;
367 *provider = prov;
368
369 return STATUS_SUCCESS;
370}
static void list_init(struct list_entry *head)
Definition: list.h:51
Definition: http.c:7252
PERFLIBREQUEST callback
Definition: main.c:166
GUID guid
Definition: main.c:165

Referenced by PerfStartProvider().

◆ PerfStopProvider()

ULONG WINAPI PerfStopProvider ( HANDLE  handle)

Definition at line 375 of file main.c.

376{
378 struct counterset_instance *inst, *next;
379 unsigned int i;
380
381 TRACE( "handle %p.\n", handle );
382
383 if (!list_empty( &prov->instance_list ))
384 WARN( "Stopping provider with active counter instances.\n" );
385
387 {
388 list_remove( &inst->entry );
389 heap_free( inst );
390 }
391
392 for (i = 0; i < prov->counterset_count; ++i)
393 heap_free( prov->countersets[i] );
394 heap_free( prov->countersets );
395 heap_free( prov );
396 return STATUS_SUCCESS;
397}
static int list_empty(struct list_entry *head)
Definition: list.h:58
#define WARN(fmt,...)
Definition: precomp.h:61
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204