eecc24148ddbfcc0ed7690178d643f534f3f3e37
[gd/samba/.git] / source3 / include / rpc_perfcount.h
1 #ifndef _RPC_PERFCOUNT_H
2 #define _RPC_PERFCOUNT_H
3 /* 
4  *  Unix SMB/CIFS implementation.
5  *  Virtual Windows Registry Layer
6  *
7  *  Copyright (C) Marcin Krzysztof Porwit    2005,
8  *  Copyright (C) Gerald (Jerry) Carter      2005.
9  *  
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *  
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *  
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24
25 typedef struct perf_counter_definition
26 {
27         /* sizeof(PERF_COUNTER_DEFINITION) */
28         uint32 ByteLength;
29         uint32 CounterNameTitleIndex;
30         uint32 CounterNameTitlePointer;
31         uint32 CounterHelpTitleIndex;
32         uint32 CounterHelpTitlePointer;
33         uint32 DefaultScale;
34         uint32 DetailLevel;
35         uint32 CounterType;
36         uint32 CounterSize;
37         uint32 CounterOffset;
38 }
39 PERF_COUNTER_DEFINITION;
40
41 typedef struct perf_counter_block
42 {
43         /* Total size of the data block, including all data plus this header */
44         uint32 ByteLength;
45         uint8 *data;
46 }
47 PERF_COUNTER_BLOCK;
48
49 typedef struct perf_instance_definition
50 {
51         /* Total size of the instance definition, including the length of the terminated Name string */
52         uint32 ByteLength;
53         uint32 ParentObjectTitleIndex;
54         uint32 ParentObjectTitlePointer;
55         uint32 UniqueID;
56         /* From the start of the PERF_INSTANCE_DEFINITION, the byte offset to the start of the Name string */
57         uint32 NameOffset;
58         uint32 NameLength;
59         /* Unicode string containing the name for the instance */
60         uint8 *data;
61         PERF_COUNTER_BLOCK counter_data;
62 }
63 PERF_INSTANCE_DEFINITION;
64
65 typedef struct perf_object_type
66 {
67         /* Total size of the object block, including all PERF_INSTANCE_DEFINITIONs,
68            PERF_COUNTER_DEFINITIONs and PERF_COUNTER_BLOCKs in bytes */
69         uint32 TotalByteLength;
70         /* Size of this PERF_OBJECT_TYPE plus all PERF_COUNTER_DEFINITIONs in bytes */
71         uint32 DefinitionLength;
72         /* Size of this PERF_OBJECT_TYPE */
73         uint32 HeaderLength;
74         uint32 ObjectNameTitleIndex;
75         uint32 ObjectNameTitlePointer;
76         uint32 ObjectHelpTitleIndex;
77         uint32 ObjectHelpTitlePointer;
78         uint32 DetailLevel;
79         uint32 NumCounters;
80         uint32 DefaultCounter;
81         uint32 NumInstances;
82         uint32 CodePage;
83         uint64 PerfTime;
84         uint64 PerfFreq;
85         PERF_COUNTER_DEFINITION *counters;
86         PERF_INSTANCE_DEFINITION *instances;
87         PERF_COUNTER_BLOCK counter_data;
88 }
89 PERF_OBJECT_TYPE;
90
91 /* PerfCounter Inner Buffer structs */
92 typedef struct perf_data_block
93 {
94         /* hardcoded to read "P.E.R.F" */
95         uint16 Signature[4];
96         uint32 LittleEndian;
97         /* both currently hardcoded to 1 */
98         uint32 Version;
99         uint32 Revision;
100         /* bytes of PERF_OBJECT_TYPE data, does NOT include the PERF_DATA_BLOCK */
101         uint32 TotalByteLength;
102         /* size of PERF_DATA_BLOCK including the uint8 *data */
103         uint32 HeaderLength;
104         /* number of PERF_OBJECT_TYPE structures encoded */
105         uint32 NumObjectTypes;
106         uint32 DefaultObject;
107         SYSTEMTIME SystemTime;
108         /* This will guarantee that we're on a 64-bit boundary before we encode
109            PerfTime, and having it there will make my offset math much easier. */
110         uint32 Padding;
111         /* Now when I'm marshalling this, I'll need to call prs_align_uint64() 
112            before I start encodint the uint64 structs */
113         /* clock rate * seconds uptime */
114         uint64 PerfTime;
115         /* The clock rate of the CPU */
116         uint64 PerfFreq; 
117         /* used for high-res timers -- for now PerfTime * 10e7 */
118         uint64 PerfTime100nSec;
119         uint32 SystemNameLength;
120         uint32 SystemNameOffset;
121         /* The SystemName, in unicode, terminated */
122         uint8* data;
123         PERF_OBJECT_TYPE *objects;
124
125 PERF_DATA_BLOCK;
126
127 #endif /* _RPC_PERFCOUNT_H */