1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
14 */
15
16 /*
17 * See special.c for details on the theory of operation
18 */
19
20 #ifndef _SYS_SPECIAL_IMPL_H
21 #define _SYS_SPECIAL_IMPL_H
22
23 #include <sys/special.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef enum {
30 SPA_SPECIAL_SELECTION_MIN,
31 SPA_SPECIAL_SELECTION_LATENCY,
32 SPA_SPECIAL_SELECTION_UTILIZATION,
33 SPA_SPECIAL_SELECTION_QUEUE,
34 SPA_SPECIAL_SELECTION_MAX
35 } spa_special_selection_t;
36
37 #define SPA_SPECIAL_SELECTION_VALID(sel) \
38 (((sel) > SPA_SPECIAL_SELECTION_MIN) && \
39 ((sel) < SPA_SPECIAL_SELECTION_MAX))
40
41 /*
42 * class cumulative statistics:
43 *
44 * utilization: utilization, measured as the percentage of time
45 * for which the device was busy servicing I/O requests
46 * during the sample interval
47 * throughput: throughput for read and write in kilobytes per second
48 * iops: input/output operations per second
49 * run_len: number of commands being processed in the active
50 * queue that the class is working on simultaneously
51 * wait_len: number of commands waiting in the queues that
52 * have not been sent to the class yet
53 * queue_len: total number of commands in the queues
54 * run_time: time in microseconds for an operation to complete
55 * after it has been dequeued from the wait queue
56 * wait_time: time in microseconds for which operations are
57 * queued before they are run
58 * service_time: time in microseconds to queue and complete an I/O operation
59 * count: number of vdev's per class
60 */
61 typedef struct cos_acc_stat {
62 uint64_t utilization;
63 uint64_t throughput;
64 uint64_t iops;
65 uint64_t run_len;
66 uint64_t wait_len;
67 uint64_t queue_len;
68 uint64_t run_time;
69 uint64_t wait_time;
70 uint64_t service_time;
71 uint64_t count;
72 } cos_acc_stat_t;
73
74 /*
75 * spa cumulative statistics:
76 *
77 * utilization, %
78 * latency, microseconds
79 * throughput, KB/s
80 * count: number of accumulated statistics
81 */
82 typedef struct spa_acc_stat {
83 uint64_t spa_utilization;
84 uint64_t special_utilization;
85 uint64_t normal_utilization;
86 uint64_t special_latency;
87 uint64_t normal_latency;
88 uint64_t special_throughput;
89 uint64_t normal_throughput;
90 uint64_t count;
91 } spa_acc_stat_t;
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* _SYS_SPECIAL_IMPL_H */