]> git.saurik.com Git - apple/system_cmds.git/blame - system_cmds-597.1.1/sadc.tproj/sadc.h
system_cmds-597.90.1.tar.gz
[apple/system_cmds.git] / system_cmds-597.1.1 / sadc.tproj / sadc.h
CommitLineData
45bc9d15
A
1/*
2 * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
3 * Reserved.
4 *
5 * This file contains Original Code and/or Modifications of Original Code
6 * as defined in and that are subject to the Apple Public Source License
7 * Version 2.0 (the 'License'). You may not use this file except in
8 * compliance with the License. Please obtain a copy of the License at
9 * http://www.opensource.apple.com/apsl/ and read it before using this
10 * file.
11 *
12 * The Original Code and all software distributed under the License are
13 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 * Please see the License for the specific language governing rights and
18 * limitations under the License.
19*/
20
21#include <CoreFoundation/CoreFoundation.h>
22#include <IOKit/IOKitLib.h>
23#include <IOKit/storage/IOBlockStorageDriver.h>
24#include <IOKit/storage/IOMedia.h>
25#include <IOKit/IOBSD.h>
26
27/* record types in sadc raw data output */
28
29#define SAR_NOTSET 0
30#define SAR_RESTART 1
31#define SAR_TIMESTAMP 2
32#define SAR_NETSTATS 3
33#define SAR_DRIVEPATH 4
34#define SAR_DRIVESTATS 5
35#define SAR_VMSTAT 6
36#define SAR_CPU 7
37
38struct record_hdr
39{
40 int32_t rec_type;
41 int32_t rec_version;
42 int32_t rec_count;
43 int32_t rec_size;
44};
45
46#define rec_data rec_size
47#define rec_timestamp rec_size
48
49#define MAXDRIVENAME 31 /* largest drive name we allow */
50
51#define DPSTATE_UNINITIALIZED 0
52#define DPSTATE_NEW 1
53#define DPSTATE_CHANGED 2
54#define DPSTATE_ACTIVE 3
55
56struct drivepath
57{
58 int32_t drivepath_id; /* compressed table id */
59 int32_t state;
60 char BSDName[MAXDRIVENAME + 1];
61 io_string_t ioreg_path; /* unique id, hardware path */
62};
63
64
65struct drivestats
66{
67 io_registry_entry_t driver;
68
69 int32_t drivepath_id;
70 uint64_t blocksize;
71
72 uint64_t Reads;
73 uint64_t BytesRead;
74
75 uint64_t Writes;
76 uint64_t BytesWritten;
77
78 uint64_t LatentReadTime;
79 uint64_t LatentWriteTime;
80
81 uint64_t ReadErrors;
82 uint64_t WriteErrors;
83
84 uint64_t ReadRetries;
85 uint64_t WriteRetries;
86
87 uint64_t TotalReadTime;
88 uint64_t TotalWriteTime;
89};
90
91
92/*
93 * netstat mode drives the
94 * collection of ppp interface data
95 */
96
97#define NET_DEV_MODE 0x1 /* Turn on network interface counters */
98#define NET_EDEV_MODE 0x2 /* Turn on network interface error counters */
99#define NET_PPP_MODE 0x4 /* Include ppp interface counters - further
100 * modifies NET_DEV_MODE and NET_EDEV_MODE */
101
102#define MAX_TNAME_SIZE 15
103#define MAX_TNAME_UNIT_SIZE 23
104
105struct netstats
106{
107 char tname_unit[MAX_TNAME_UNIT_SIZE + 1];
108 uint32_t gen_counter; /* unit generation counter */
109
110 uint64_t net_ipackets;
111 uint64_t net_ierrors;
112 uint64_t net_opackets;
113 uint64_t net_oerrors;
114 uint64_t net_collisions;
115 uint64_t net_ibytes;
116 uint64_t net_obytes;
117 uint64_t net_imcasts;
118 uint64_t net_omcasts;
119 uint64_t net_drops;
120};