summaryrefslogtreecommitdiff
path: root/source/include/rpc_perfcount.h
blob: eecc24148ddbfcc0ed7690178d643f534f3f3e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef _RPC_PERFCOUNT_H
#define _RPC_PERFCOUNT_H
/* 
 *  Unix SMB/CIFS implementation.
 *  Virtual Windows Registry Layer
 *
 *  Copyright (C) Marcin Krzysztof Porwit    2005,
 *  Copyright (C) Gerald (Jerry) Carter      2005.
 *  
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

typedef struct perf_counter_definition
{
	/* sizeof(PERF_COUNTER_DEFINITION) */
	uint32 ByteLength;
	uint32 CounterNameTitleIndex;
	uint32 CounterNameTitlePointer;
	uint32 CounterHelpTitleIndex;
	uint32 CounterHelpTitlePointer;
	uint32 DefaultScale;
	uint32 DetailLevel;
	uint32 CounterType;
	uint32 CounterSize;
	uint32 CounterOffset;
}
PERF_COUNTER_DEFINITION;

typedef struct perf_counter_block
{
	/* Total size of the data block, including all data plus this header */
	uint32 ByteLength;
	uint8 *data;
}
PERF_COUNTER_BLOCK;

typedef struct perf_instance_definition
{
	/* Total size of the instance definition, including the length of the terminated Name string */
	uint32 ByteLength;
	uint32 ParentObjectTitleIndex;
	uint32 ParentObjectTitlePointer;
	uint32 UniqueID;
	/* From the start of the PERF_INSTANCE_DEFINITION, the byte offset to the start of the Name string */
	uint32 NameOffset;
	uint32 NameLength;
	/* Unicode string containing the name for the instance */
	uint8 *data;
	PERF_COUNTER_BLOCK counter_data;
}
PERF_INSTANCE_DEFINITION;

typedef struct perf_object_type
{
	/* Total size of the object block, including all PERF_INSTANCE_DEFINITIONs,
	   PERF_COUNTER_DEFINITIONs and PERF_COUNTER_BLOCKs in bytes */
	uint32 TotalByteLength;
	/* Size of this PERF_OBJECT_TYPE plus all PERF_COUNTER_DEFINITIONs in bytes */
	uint32 DefinitionLength;
	/* Size of this PERF_OBJECT_TYPE */
	uint32 HeaderLength;
	uint32 ObjectNameTitleIndex;
	uint32 ObjectNameTitlePointer;
	uint32 ObjectHelpTitleIndex;
	uint32 ObjectHelpTitlePointer;
	uint32 DetailLevel;
	uint32 NumCounters;
	uint32 DefaultCounter;
	uint32 NumInstances;
	uint32 CodePage;
	uint64 PerfTime;
	uint64 PerfFreq;
	PERF_COUNTER_DEFINITION *counters;
	PERF_INSTANCE_DEFINITION *instances;
	PERF_COUNTER_BLOCK counter_data;
}
PERF_OBJECT_TYPE;

/* PerfCounter Inner Buffer structs */
typedef struct perf_data_block
{
	/* hardcoded to read "P.E.R.F" */
	uint16 Signature[4];
	uint32 LittleEndian;
	/* both currently hardcoded to 1 */
	uint32 Version;
	uint32 Revision;
	/* bytes of PERF_OBJECT_TYPE data, does NOT include the PERF_DATA_BLOCK */
	uint32 TotalByteLength;
	/* size of PERF_DATA_BLOCK including the uint8 *data */
	uint32 HeaderLength;
	/* number of PERF_OBJECT_TYPE structures encoded */
	uint32 NumObjectTypes;
	uint32 DefaultObject;
	SYSTEMTIME SystemTime;
	/* This will guarantee that we're on a 64-bit boundary before we encode
	   PerfTime, and having it there will make my offset math much easier. */
	uint32 Padding;
	/* Now when I'm marshalling this, I'll need to call prs_align_uint64() 
	   before I start encodint the uint64 structs */
	/* clock rate * seconds uptime */
	uint64 PerfTime;
	/* The clock rate of the CPU */
	uint64 PerfFreq; 
	/* used for high-res timers -- for now PerfTime * 10e7 */
	uint64 PerfTime100nSec;
	uint32 SystemNameLength;
	uint32 SystemNameOffset;
	/* The SystemName, in unicode, terminated */
	uint8* data;
	PERF_OBJECT_TYPE *objects;
} 
PERF_DATA_BLOCK;

#endif /* _RPC_PERFCOUNT_H */