ReactOS 0.4.16-dev-1948-gd260c1d
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 *WINAPI PerfCreateInstance (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 185 of file main.c.

188{
190 struct counterset_template *template;
191 struct counterset_instance *inst;
192 unsigned int i;
193 ULONG size;
194
195 FIXME( "handle %p, guid %s, name %s, id %lu semi-stub.\n", handle, debugstr_guid(guid), debugstr_w(name), id );
196
197 if (!prov || !guid || !name)
198 {
200 return NULL;
201 }
202
203 for (i = 0; i < prov->counterset_count; ++i)
204 if (IsEqualGUID(guid, &prov->countersets[i]->counterset.CounterSetGuid)) break;
205
206 if (i == prov->counterset_count)
207 {
209 return NULL;
210 }
211
212 template = prov->countersets[i];
213
215 {
216 if (inst->template == template && inst->instance.InstanceId == id)
217 {
219 return NULL;
220 }
221 }
222
223 size = (sizeof(PERF_COUNTERSET_INSTANCE) + template->counterset.NumCounters * sizeof(UINT64)
224 + (lstrlenW( name ) + 1) * sizeof(WCHAR) + 7) & ~7;
225 inst = heap_alloc_zero( offsetof(struct counterset_instance, instance) + size );
226 if (!inst)
227 {
229 return NULL;
230 }
231
232 inst->template = template;
234 inst->instance.dwSize = size;
235 inst->instance.InstanceId = id;
237 + template->counterset.NumCounters * sizeof(UINT64);
238 inst->instance.InstanceNameSize = (lstrlenW( name ) + 1) * sizeof(WCHAR);
240 list_add_tail( &prov->instance_list, &inst->entry );
241
242 return &inst->instance;
243}
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:1014
__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 248 of file main.c.

249{
250 struct perf_provider *prov = perf_provider_from_handle( provider );
251 struct counterset_instance *inst;
252
253 TRACE( "provider %p, block %p.\n", provider, block );
254
255 if (!prov || !block) return ERROR_INVALID_PARAMETER;
256
258 list_remove( &inst->entry );
259 heap_free( inst );
260
261 return ERROR_SUCCESS;
262}
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 312 of file main.c.

314{
315 struct perf_provider *prov = perf_provider_from_handle( provider );
316 struct counterset_template *template;
317 struct counterset_instance *inst;
318 unsigned int i;
319
320 FIXME( "provider %p, instance %p, counterid %lu, address %p semi-stub.\n",
321 provider, instance, counterid, address );
322
323 if (!prov || !instance || !address) return ERROR_INVALID_PARAMETER;
324
326 template = inst->template;
327
328 for (i = 0; i < template->counterset.NumCounters; ++i)
329 if (template->counter[i].CounterId == counterid) break;
330
331 if (i == template->counterset.NumCounters) return ERROR_NOT_FOUND;
332 *(void **)((BYTE *)&inst->instance + sizeof(PERF_COUNTERSET_INSTANCE) + template->counter[i].Offset) = address;
333
334 return STATUS_SUCCESS;
335}
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 267 of file main.c.

268{
270 struct counterset_template **new_array;
271 struct counterset_template *new;
272 unsigned int i;
273
274 FIXME( "handle %p, template %p, size %lu semi-stub.\n", handle, template, size );
275
276 if (!prov || !template) return ERROR_INVALID_PARAMETER;
277 if (!template->NumCounters) return ERROR_INVALID_PARAMETER;
278 if (size < sizeof(*template) || (size - (sizeof(*template))) / sizeof(PERF_COUNTER_INFO) < template->NumCounters)
280
281 for (i = 0; i < prov->counterset_count; ++i)
282 {
283 if (IsEqualGUID( &template->CounterSetGuid, &prov->countersets[i]->counterset.CounterSetGuid ))
285 }
286
287 size = offsetof( struct counterset_template, counter[template->NumCounters] );
288 if (!(new = heap_alloc( size ))) return ERROR_OUTOFMEMORY;
289
290 if (prov->counterset_count)
291 new_array = heap_realloc( prov->countersets, sizeof(*prov->countersets) * (prov->counterset_count + 1) );
292 else
293 new_array = heap_alloc( sizeof(*prov->countersets) );
294
295 if (!new_array)
296 {
297 heap_free( new );
298 return ERROR_OUTOFMEMORY;
299 }
300 memcpy( new, template, size );
301 for (i = 0; i < template->NumCounters; ++i)
302 new->counter[i].Offset = i * sizeof(UINT64);
303 new_array[prov->counterset_count++] = new;
304 prov->countersets = new_array;
305
306 return STATUS_SUCCESS;
307}
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 340 of file main.c.

341{
343
344 FIXME( "guid %s, callback %p, provider %p semi-stub.\n", debugstr_guid(guid), callback, provider );
345
346 memset( &ctx, 0, sizeof(ctx) );
347 ctx.ContextSize = sizeof(ctx);
348 ctx.ControlCallback = callback;
349
350 return PerfStartProviderEx( guid, &ctx, provider );
351}
ULONG WINAPI PerfStartProviderEx(GUID *guid, PERF_PROVIDER_CONTEXT *context, HANDLE *provider)
Definition: main.c:356
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 356 of file main.c.

357{
358 struct perf_provider *prov;
359
360 FIXME( "guid %s, context %p, provider %p semi-stub.\n", debugstr_guid(guid), context, provider );
361
362 if (!guid || !context || !provider) return ERROR_INVALID_PARAMETER;
363 if (context->ContextSize < sizeof(*context)) return ERROR_INVALID_PARAMETER;
364
365 if (context->MemAllocRoutine || context->MemFreeRoutine)
366 FIXME("Memory allocation routine is not supported.\n");
367
368 if (!(prov = heap_alloc_zero( sizeof(*prov) ))) return ERROR_OUTOFMEMORY;
369 list_init( &prov->instance_list );
370 memcpy( &prov->guid, guid, sizeof(prov->guid) );
371 prov->callback = context->ControlCallback;
372 *provider = prov;
373
374 return STATUS_SUCCESS;
375}
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 380 of file main.c.

381{
383 struct counterset_instance *inst, *next;
384 unsigned int i;
385
386 TRACE( "handle %p.\n", handle );
387
388 if (!list_empty( &prov->instance_list ))
389 WARN( "Stopping provider with active counter instances.\n" );
390
392 {
393 list_remove( &inst->entry );
394 heap_free( inst );
395 }
396
397 for (i = 0; i < prov->counterset_count; ++i)
398 heap_free( prov->countersets[i] );
399 heap_free( prov->countersets );
400 heap_free( prov );
401 return STATUS_SUCCESS;
402}
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