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