]>
Commit | Line | Data |
---|---|---|
c3a08f59 | 1 | /* |
83f6dbe8 A |
2 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights |
3 | * Reserved. | |
c3a08f59 | 4 | * |
83f6dbe8 A |
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. | |
c3a08f59 A |
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, | |
83f6dbe8 A |
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 | */ | |
c3a08f59 A |
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 | ||
38 | struct record_hdr | |
39 | { | |
40 | int rec_type; | |
41 | int rec_version; | |
42 | int rec_count; | |
43 | long 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 | ||
56 | struct drivepath | |
57 | { | |
58 | int drivepath_id; /* compressed table id */ | |
59 | int state; | |
60 | char BSDName[MAXDRIVENAME + 1]; | |
61 | io_string_t ioreg_path; /* unique id, hardware path */ | |
62 | }; | |
63 | ||
64 | ||
65 | struct drivestats | |
66 | { | |
67 | io_registry_entry_t driver; | |
68 | int drivepath_id; | |
69 | u_int64_t blocksize; | |
70 | ||
71 | u_int64_t Reads; | |
72 | u_int64_t BytesRead; | |
73 | ||
74 | u_int64_t Writes; | |
75 | u_int64_t BytesWritten; | |
76 | ||
77 | u_int64_t LatentReadTime; | |
78 | u_int64_t LatentWriteTime; | |
79 | ||
80 | u_int64_t ReadErrors; | |
81 | u_int64_t WriteErrors; | |
82 | ||
83 | u_int64_t ReadRetries; | |
84 | u_int64_t WriteRetries; | |
85 | ||
86 | u_int64_t TotalReadTime; | |
87 | u_int64_t TotalWriteTime; | |
88 | }; | |
89 | ||
90 | ||
91 | /* | |
92 | * netstat mode drives the | |
93 | * collection of ppp interface data | |
94 | */ | |
95 | ||
96 | #define NET_DEV_MODE 0x1 /* Turn on network interface counters */ | |
97 | #define NET_EDEV_MODE 0x2 /* Turn on network interface error counters */ | |
98 | #define NET_PPP_MODE 0x4 /* Include ppp interface counters - further | |
99 | * modifies NET_DEV_MODE and NET_EDEV_MODE */ | |
100 | ||
101 | #define MAX_TNAME_SIZE 15 | |
102 | #define MAX_TNAME_UNIT_SIZE 23 | |
103 | ||
104 | struct netstats | |
105 | { | |
106 | char tname_unit[MAX_TNAME_UNIT_SIZE + 1]; | |
107 | unsigned long gen_counter; /* unit generation counter */ | |
108 | ||
109 | unsigned long long net_ipackets; | |
110 | unsigned long long net_ierrors; | |
111 | unsigned long long net_opackets; | |
112 | unsigned long long net_oerrors; | |
113 | unsigned long long net_collisions; | |
114 | unsigned long long net_ibytes; | |
115 | unsigned long long net_obytes; | |
116 | unsigned long long net_imcasts; | |
117 | unsigned long long net_omcasts; | |
118 | unsigned long long net_drops; | |
119 | }; |