2 * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
\r
4 * This software is available to you under the OpenIB.org BSD license
\r
7 * Redistribution and use in source and binary forms, with or
\r
8 * without modification, are permitted provided that the following
\r
9 * conditions are met:
\r
11 * - Redistributions of source code must retain the above
\r
12 * copyright notice, this list of conditions and the following
\r
15 * - Redistributions in binary form must reproduce the above
\r
16 * copyright notice, this list of conditions and the following
\r
17 * disclaimer in the documentation and/or other materials
\r
18 * provided with the distribution.
\r
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
\r
24 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
25 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
26 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
32 #ifndef _IBSP_PERFMON_H_
\r
33 #define _IBSP_PERFMON_H_
\r
37 #include <winperf.h>
\r
38 #include "wsd/ibsp_regpath.h"
\r
41 /* invalid instance index value to initialize */
\r
42 #define INVALID_IDX 0xffffffff
\r
44 #define IBSP_PM_SEC_STRING \
\r
45 TEXT("D:(A;CIOI;GAFA;;;SY)" /* SDDL_LOCAL_SYSTEM */ \
\r
46 "(A;CIOI;GAFA;;;BA)" /* SDDL_BUILTIN_ADMIN */ \
\r
47 "(A;CIOI;GAFA;;;NS)" /* SDDL_NETWORK_SERVICE */ \
\r
48 "(A;CIOI;GAFA;;;LS)" /* SDDL_LOCAL_SERVICE */ \
\r
49 "(A;CIOI;GAFA;;;SU)" /* SDDL_SERVICE */ \
\r
50 "(A;CIOI;GAFA;;;MU)" /* SDDL_PERFMON_USERS */ \
\r
51 "(A;CIOI;GAFA;;;LU)") /* SDDL_PERFLOG_USERS */
\r
53 #define IBSP_PM_NUM_OBJECT_TYPES 1
\r
54 #define IBSP_PM_NUM_INSTANCES 100 /* how many processes we can handle */
\r
56 #define IBSP_PM_APP_NAME_SIZE 24 /* Must be multiple of 8 */
\r
57 #define IBSP_PM_TOTAL_COUNTER_NAME L"_Total"
\r
58 #define IBSP_PM_MAPPED_OBJ_NAME TEXT("Global\\ibwsd_perfmon_data")
\r
61 /* Structures used to report counter information to perfmon. */
\r
62 typedef struct _ibsp_pm_definition
\r
64 PERF_OBJECT_TYPE perf_obj;
\r
65 PERF_COUNTER_DEFINITION counter[IBSP_PM_NUM_COUNTERS];
\r
67 } ibsp_pm_definition_t;
\r
69 typedef struct _ibsp_pm_counters
\r
71 PERF_COUNTER_BLOCK pm_block;
\r
72 LONG64 data[IBSP_PM_NUM_COUNTERS];
\r
74 } ibsp_pm_counters_t;
\r
77 /* Structures used to manage counters internally */
\r
78 typedef struct _mem_obj
\r
80 volatile LONG taken;
\r
81 WCHAR app_name[IBSP_PM_APP_NAME_SIZE];
\r
82 LONG64 data[IBSP_PM_NUM_COUNTERS];
\r
86 typedef struct _pm_shmem
\r
88 mem_obj_t obj[IBSP_PM_NUM_INSTANCES];
\r
93 /* global data for every process linked to this DLL */
\r
96 struct _pm_shmem* p_shmem; /* base pointer to shared memory for this process */
\r
97 volatile LONG64* pdata; /* pointer to data collected */
\r
99 HANDLE h_evlog; /* event log handle */
\r
100 DWORD threads; /* number of threads open */
\r
101 DWORD idx; /* slot index assigned for this process */
\r
102 LONG64 fall_back_data[IBSP_PM_NUM_COUNTERS];
\r
108 IBSPPmInit( void );
\r
111 IBSPPmClose( void );
\r
114 IBSPPmGetSlot( void );
\r
117 IBSPPmReleaseSlot( void );
\r
119 #endif /* _IBSP_PERFMON_H_ */
\r