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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
#![recursion_limit="100"]
#[macro_use]
extern crate nom;
use std::error;
use std::fmt;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::str::FromStr;
use self::nom::{le_u8, is_digit, space, newline};
#[cfg(test)]
mod tests {
use nom;
#[test]
fn it_parses_a_u32() {
let input = b"12345";
let result = super::take_u32(input);
match result {
nom::IResult::Done(_, f) => assert_eq!(f, 12345u32),
_ => unreachable!(),
}
}
#[test]
fn it_parses_a_u32_with_whitespace() {
let input = b"12345 ";
let result = super::take_u32(input);
match result {
nom::IResult::Done(_, f) => assert_eq!(f, 12345u32),
_ => unreachable!(),
}
}
#[test]
fn it_parses_extent_allocation() {
let example_output = b"extent_alloc 4260849 125170297 4618726 131131897";
match super::extent_alloc(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.allocated_extents, 4260849);
assert_eq!(result.freed_blocks, 131131897);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_allocation_btree() {
let example_output = b"abt 29491162 337391304 11257328 11133039";
match super::abt(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.inserts, 11257328);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_block_mapping() {
let example_output = b"blk_map 381213360 115456141 10903633 69612322 7448401 507596777 0";
match super::blk_map(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.list_delete, 7448401);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_block_map_btree() {
let example_output = b"bmbt 771328 6236258 602114 86646";
match super::bmbt(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.deletes, 86646);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_directory_operations() {
let example_output = b"dir 21253907 6921870 6969079 779205554";
match super::dir(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.lookups, 21253907);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_transactions() {
let example_output = b"trans 126946406 38184616 6342392";
match super::trans(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.waited, 126946406);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_inode_operations() {
let example_output = b"ig 17754368 2019571 102 15734797 0 15672217 3962470";
match super::ig(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.cache_lookups, 17754368);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_log_operations() {
let example_output = b"log 129491915 3992515264 458018 153771989 127040250";
match super::log(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.log_writes, 129491915);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_tail_pushing_stats() {
let example_output = b"push_ail 171473415 0 6896837 3324292 8069877 65884 1289485 0 22535 7337";
match super::push_ail(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.logspace, 171473415);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_io_map_write_convert() {
let example_output = b"xstrat 4140059 0";
match super::xstrat(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.quick, 4140059);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_read_write_stats() {
let example_output = b"rw 1595677950 1046884251";
match super::rw(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.write, 1595677950);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_attribute_operations() {
let example_output = b"attr 194724197 0 7 0";
match super::attr(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.get, 194724197);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_inode_clustering() {
let example_output = b"icluster 20772185 2488203 13909520";
match super::icluster(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.count, 20772185);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_vnode_statistics() {
let example_output = b"vnodes 62578 15959666 0 0 15897088 15897088 15897088 0";
match super::vnodes(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.active, 62578);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_buf_statistics() {
let example_output = b"buf 2090581631 1972536890 118044776 225145 9486625 0 0 2000152616 809762";
match super::buf(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.get, 2090581631);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_extended_precision_counters() {
let example_output = b"xpc 6908312903680 67735504884757 19760115252482";
match super::xpc(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result.xstrat_bytes, 6908312903680);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_debug() {
let example_output = b"debug 0";
match super::debug(example_output) {
nom::IResult::Done(_, result) => {
assert_eq!(result, false);
}
_ => unreachable!(),
}
}
#[test]
fn it_parses_example() {
let example_output = b"extent_alloc 4260849 125170297 4618726 131131897
abt 29491162 337391304 11257328 11133039
blk_map 381213360 115456141 10903633 69612322 7448401 507596777 0
bmbt 771328 6236258 602114 86646
dir 21253907 6921870 6969079 779205554
trans 126946406 38184616 6342392
ig 17754368 2019571 102 15734797 0 15672217 3962470
log 129491915 3992515264 458018 153771989 127040250
push_ail 171473415 0 6896837 3324292 8069877 65884 1289485 0 22535 7337
xstrat 4140059 0
rw 1595677950 1046884251
attr 194724197 0 7 0
icluster 20772185 2488203 13909520
vnodes 62578 15959666 0 0 15897088 15897088 15897088 0
buf 2090581631 1972536890 118044776 225145 9486625 0 0 2000152616 809762
xpc 6908312903680 67735504884757 19760115252482
debug 0";
let result = super::parse(example_output).unwrap();
assert_eq!(result.extent_allocation.freed_extents, 4618726);
assert_eq!(result.allocation_btree.lookups, 29491162);
assert_eq!(result.block_mapping.unmap, 10903633);
assert_eq!(result.block_map_btree.inserts, 602114);
assert_eq!(result.directory_operations.get_dents, 779205554);
assert_eq!(result.transactions.empty, 6342392);
assert_eq!(result.inode_operations.inode_attr_changes, 3962470);
assert_eq!(result.log_operations.force_sleep, 127040250);
assert_eq!(result.tail_pushing_stats.push_ail_flush, 7337);
assert_eq!(result.io_map_write_convert.split, 0);
assert_eq!(result.read_write_stats.read, 1046884251);
assert_eq!(result.attribute_operations.list, 0);
assert_eq!(result.inode_clustering.flushinode, 13909520);
assert_eq!(result.vnode_statistics.free, 0);
assert_eq!(result.buf_statistics.get_read, 809762);
assert_eq!(result.extended_precision_counters.read_bytes, 19760115252482);
assert_eq!(result.debug, false);
}
#[test]
fn it_parses_newer_version_with_extra_fields() {
let example_output = b"extent_alloc 0 0 0 0
abt 0 0 0 0
blk_map 0 0 0 0 0 0 0
bmbt 0 0 0 0
dir 0 0 0 0
trans 0 0 0
ig 0 0 0 0 0 0 0
log 0 0 0 0 0
push_ail 0 0 0 0 0 0 0 0 0 0
xstrat 0 0
rw 0 0
attr 0 0 0 0
icluster 0 0 0
vnodes 0 0 0 0 0 0 0 0
buf 0 0 0 0 0 0 0 0 0
abtb2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
abtc2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
bmbt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ibt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
fibt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
qm 0 0 0 0 0 0 0 0
xpc 0 0 0
debug 0
";
let result = super::parse(example_output).unwrap();
assert_eq!(result.extent_allocation.freed_extents, 0);
assert_eq!(result.allocation_btree.lookups, 0);
assert_eq!(result.block_mapping.unmap, 0);
assert_eq!(result.block_map_btree.inserts, 0);
assert_eq!(result.directory_operations.get_dents, 0);
assert_eq!(result.transactions.empty, 0);
assert_eq!(result.inode_operations.inode_attr_changes, 0);
assert_eq!(result.log_operations.force_sleep, 0);
assert_eq!(result.tail_pushing_stats.push_ail_flush, 0);
assert_eq!(result.io_map_write_convert.split, 0);
assert_eq!(result.read_write_stats.read, 0);
assert_eq!(result.attribute_operations.list, 0);
assert_eq!(result.inode_clustering.flushinode, 0);
assert_eq!(result.vnode_statistics.free, 0);
assert_eq!(result.buf_statistics.get_read, 0);
assert_eq!(result.extended_precision_counters.read_bytes, 0);
assert_eq!(result.debug, false);
}
}
pub struct XfsStat {
pub extent_allocation: ExtentAllocation,
pub allocation_btree: AllocationBTree,
pub block_mapping: BlockMapping,
pub block_map_btree: BlockMapBTree,
pub directory_operations: DirectoryOperations,
pub transactions: Transactions,
pub inode_operations: InodeOperations,
pub log_operations: LogOperations,
pub tail_pushing_stats: TailPushingStats,
pub io_map_write_convert: IoMapWriteConvert,
pub read_write_stats: ReadWriteStats,
pub attribute_operations: AttributeOperations,
pub inode_clustering: InodeClustering,
pub vnode_statistics: VnodeStatistics,
pub buf_statistics: BufStatistics,
pub extended_precision_counters: ExtendedPrecisionCounters,
pub debug: bool,
}
pub struct ExtentAllocation {
pub allocated_extents: u32,
pub allocated_blocks: u32,
pub freed_extents: u32,
pub freed_blocks: u32,
}
pub struct AllocationBTree {
pub lookups: u32,
pub compares: u32,
pub inserts: u32,
pub deletes: u32,
}
pub struct BlockMapping {
pub map_read: u32,
pub map_write: u32,
pub unmap: u32,
pub list_insert: u32,
pub list_delete: u32,
pub list_lookup: u32,
pub list_compare: u32,
}
pub struct BlockMapBTree {
pub lookups: u32,
pub compares: u32,
pub inserts: u32,
pub deletes: u32,
}
pub struct DirectoryOperations {
pub lookups: u32,
pub creates: u32,
pub removes: u32,
pub get_dents: u32,
}
pub struct Transactions {
pub waited: u32,
pub async: u32,
pub empty: u32,
}
pub struct InodeOperations {
pub cache_lookups: u32,
pub cache_hits: u32,
pub cache_recycle: u32,
pub cache_missed: u32,
pub cache_dup: u32,
pub cache_reclaime: u32,
pub inode_attr_changes: u32,
}
pub struct LogOperations {
pub log_writes: u32,
pub log_blocks: u32,
pub noiclogs: u32,
pub log_forced: u32,
pub force_sleep: u32,
}
pub struct TailPushingStats {
pub logspace: u32,
pub sleep_logspace: u32,
pub push_ails: u32,
pub push_ail_success: u32,
pub push_ail_pushbuf: u32,
pub push_ail_pinned: u32,
pub push_ail_locked: u32,
pub push_ail_flushing: u32,
pub push_ail_restarts: u32,
pub push_ail_flush: u32,
}
pub struct IoMapWriteConvert {
pub quick: u32,
pub split: u32,
}
pub struct ReadWriteStats {
pub write: u32,
pub read: u32,
}
pub struct AttributeOperations {
pub get: u32,
pub set: u32,
pub remove: u32,
pub list: u32,
}
pub struct InodeClustering {
pub count: u32,
pub flushcnt: u32,
pub flushinode: u32,
}
pub struct VnodeStatistics {
pub active: u32,
pub alloc: u32,
pub get: u32,
pub hold: u32,
pub rele: u32,
pub reclaim: u32,
pub remove: u32,
pub free: u32,
}
pub struct BufStatistics {
pub get: u32,
pub create: u32,
pub get_locked: u32,
pub get_locked_waited: u32,
pub busy_locked: u32,
pub miss_locked: u32,
pub page_retries: u32,
pub page_found: u32,
pub get_read: u32,
}
pub struct ExtendedPrecisionCounters {
pub xstrat_bytes: u64,
pub write_bytes: u64,
pub read_bytes: u64,
}
#[derive(Debug)]
pub enum XfsError {
Io(io::Error),
Incomplete,
Parse,
}
impl fmt::Display for XfsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
XfsError::Io(ref err) => write!(f, "IO error: {}", err),
XfsError::Incomplete => write!(f, "Not enough data for XFS parse"),
XfsError::Parse => write!(f, "Parse error"),
}
}
}
impl error::Error for XfsError {
fn description(&self) -> &str {
match *self {
XfsError::Io(ref err) => err.description(),
XfsError::Incomplete => "There is not enough data for parsing",
XfsError::Parse => "There was an error parsing",
}
}
fn cause(&self) -> Option<&error::Error> {
match *self {
XfsError::Io(ref err) => Some(err),
XfsError::Incomplete => None,
XfsError::Parse => None,
}
}
}
impl From<io::Error> for XfsError {
fn from(err: io::Error) -> XfsError {
XfsError::Io(err)
}
}
pub fn parse(input: &[u8]) -> Result<XfsStat, XfsError> {
match xfs_stat(input) {
nom::IResult::Done(_, stat) => Ok(stat),
nom::IResult::Error(_) => {
Err(XfsError::Parse)
},
nom::IResult::Incomplete(_) => {
Err(XfsError::Incomplete)
},
}
}
pub fn read() -> Result<String, XfsError> {
let mut f = try!(File::open("/proc/fs/xfs/stat"));
let mut s = String::new();
try!(f.read_to_string(&mut s));
Ok(s)
}
pub fn get() -> Result<XfsStat, XfsError> {
let contents = try!(read());
parse((&contents[..]).as_bytes())
}
named!(xfs_stat <XfsStat>,
chain!(
extent_alloc: extent_alloc ~
newline ~
abt: abt ~
newline ~
blk_map: blk_map ~
newline ~
block_map_btree: bmbt ~
newline ~
directory_operations: dir ~
newline ~
transactions: trans ~
newline ~
inode_operations: ig ~
newline ~
log_operations: log ~
newline ~
tail_pushing_stats: push_ail ~
newline ~
io_map_write_convert: xstrat ~
newline ~
read_write_stats: rw ~
newline ~
attribute_operations: attr ~
newline ~
inode_clustering: icluster ~
newline ~
vnode_statistics: vnodes ~
newline ~
buf_statistics: buf ~
newline ~
extended_precision_counters: xpc ~
newline ~
dbg: debug,
|| {
XfsStat {
extent_allocation: extent_alloc,
allocation_btree: abt,
block_mapping: blk_map,
block_map_btree: block_map_btree,
directory_operations: directory_operations,
transactions: transactions,
inode_operations: inode_operations,
log_operations:log_operations,
tail_pushing_stats: tail_pushing_stats,
io_map_write_convert: io_map_write_convert,
read_write_stats: read_write_stats,
attribute_operations: attribute_operations,
inode_clustering: inode_clustering,
vnode_statistics: vnode_statistics,
buf_statistics: buf_statistics,
extended_precision_counters: extended_precision_counters,
debug: dbg,
}
}
)
);
named!(debug <bool>,
chain!(
tag!("debug") ~
space ~
dbg: le_u8,
|| {
if dbg == 1 {
true
} else {
false
}
}
)
);
named!(take_u32 <u32>,
chain!(
uint_slice: take_while!(is_digit) ~
opt!(space),
|| {
let int_str = String::from_utf8_lossy(uint_slice);
u32::from_str(&int_str[..]).unwrap()
}
)
);
named!(take_u64 <u64>,
chain!(
uint_slice: take_while!(is_digit) ~
opt!(space),
|| {
let int_str = String::from_utf8_lossy(uint_slice);
u64::from_str(&int_str[..]).unwrap()
}
)
);
named!(extent_alloc <ExtentAllocation>,
chain!(
tag!("extent_alloc") ~
space ~
allocx: take_u32 ~
allocb: take_u32 ~
freex: take_u32 ~
freeb: take_u32,
|| {
ExtentAllocation {
allocated_extents: allocx,
allocated_blocks: allocb,
freed_extents: freex,
freed_blocks: freeb,
}
}
)
);
named!(abt <AllocationBTree>,
chain!(
tag!("abt") ~
space ~
lookups: take_u32 ~
compares: take_u32 ~
inserts: take_u32 ~
deletes: take_u32,
|| {
AllocationBTree {
lookups: lookups,
compares: compares,
inserts: inserts,
deletes: deletes,
}
}
)
);
named!(blk_map <BlockMapping>,
chain!(
tag!("blk_map") ~
space ~
map_read: take_u32 ~
map_write: take_u32 ~
unmap: take_u32 ~
list_insert: take_u32 ~
list_delete: take_u32 ~
list_lookup: take_u32 ~
list_compare: take_u32,
||{
BlockMapping {
map_read: map_read,
map_write: map_write,
unmap: unmap,
list_insert: list_insert,
list_delete: list_delete,
list_lookup: list_lookup,
list_compare: list_compare,
}
}
)
);
named!(bmbt <BlockMapBTree>,
chain!(
tag!("bmbt") ~
space ~
lookup: take_u32 ~
compare: take_u32 ~
insrec: take_u32 ~
delrec: take_u32,
|| {
BlockMapBTree {
lookups: lookup,
compares: compare,
inserts: insrec,
deletes: delrec,
}
}
)
);
named!(dir <DirectoryOperations>,
chain!(
tag!("dir") ~
space ~
lookups: take_u32 ~
creates: take_u32 ~
removes: take_u32 ~
get_dents: take_u32,
|| {
DirectoryOperations {
lookups: lookups,
creates: creates,
removes: removes,
get_dents: get_dents,
}
}
)
);
named!(trans <Transactions>,
chain!(
tag!("trans") ~
space ~
waited: take_u32 ~
async: take_u32 ~
empty: take_u32,
||{
Transactions {
waited: waited,
async: async,
empty: empty,
}
}
)
);
named!(ig <InodeOperations>,
chain!(
tag!("ig") ~
space ~
cache_lookups: take_u32 ~
cache_hits: take_u32 ~
cache_recycle: take_u32 ~
cache_missed: take_u32 ~
cache_dup: take_u32 ~
cache_reclaime: take_u32 ~
inode_attr_changes: take_u32,
|| {
InodeOperations {
cache_lookups: cache_lookups,
cache_hits: cache_hits,
cache_recycle: cache_recycle,
cache_missed: cache_missed,
cache_dup: cache_dup,
cache_reclaime: cache_reclaime,
inode_attr_changes: inode_attr_changes,
}
}
)
);
named!(log <LogOperations>,
chain!(
tag!("log") ~
space ~
log_writes: take_u32 ~
log_blocks: take_u32 ~
noiclogs: take_u32 ~
log_forced: take_u32 ~
force_sleep: take_u32,
|| {
LogOperations {
log_writes: log_writes,
log_blocks: log_blocks,
noiclogs: noiclogs,
log_forced: log_forced,
force_sleep: force_sleep,
}
}
)
);
named!(push_ail <TailPushingStats>,
chain!(
tag!("push_ail") ~
space ~
logspace: take_u32 ~
sleep_logspace: take_u32 ~
push_ails: take_u32 ~
push_ail_success: take_u32 ~
push_ail_pushbuf: take_u32 ~
push_ail_pinned: take_u32 ~
push_ail_locked: take_u32 ~
push_ail_flushing: take_u32 ~
push_ail_restarts: take_u32 ~
push_ail_flush: take_u32,
|| {
TailPushingStats {
logspace: logspace,
sleep_logspace: sleep_logspace,
push_ails: push_ails,
push_ail_success: push_ail_success,
push_ail_pushbuf: push_ail_pushbuf,
push_ail_pinned: push_ail_pinned,
push_ail_locked: push_ail_locked,
push_ail_flushing: push_ail_flushing,
push_ail_restarts: push_ail_restarts,
push_ail_flush: push_ail_flush,
}
}
)
);
named!(xstrat <IoMapWriteConvert>,
chain!(
tag!("xstrat") ~
space ~
quick: take_u32 ~
split: take_u32,
|| {
IoMapWriteConvert {
quick: quick,
split: split,
}
}
)
);
named!(rw <ReadWriteStats>,
chain!(
tag!("rw") ~
space ~
write: take_u32 ~
read: take_u32,
|| {
ReadWriteStats {
write: write,
read: read,
}
}
)
);
named!(attr <AttributeOperations>,
chain!(
tag!("attr") ~
space ~
get: take_u32 ~
set: take_u32 ~
remove: take_u32 ~
list: take_u32,
|| {
AttributeOperations {
get: get,
set: set,
remove: remove,
list: list,
}
}
)
);
named!(icluster <InodeClustering>,
chain!(
tag!("icluster") ~
space ~
count: take_u32 ~
flushcnt: take_u32 ~
flushinode: take_u32,
|| {
InodeClustering {
count: count,
flushcnt: flushcnt,
flushinode: flushinode,
}
}
)
);
named!(vnodes <VnodeStatistics>,
chain!(
tag!("vnodes") ~
space ~
active: take_u32 ~
alloc: take_u32 ~
get: take_u32 ~
hold: take_u32 ~
rele: take_u32 ~
reclaim: take_u32 ~
remove: take_u32 ~
free: take_u32,
|| {
VnodeStatistics {
active: active,
alloc: alloc,
get: get,
hold: hold,
rele: rele,
reclaim: reclaim,
remove: remove,
free: free,
}
}
)
);
named!(buf <BufStatistics>,
chain!(
tag!("buf") ~
space ~
get: take_u32 ~
create: take_u32 ~
get_locked: take_u32 ~
get_locked_waited: take_u32 ~
busy_locked: take_u32 ~
miss_locked: take_u32 ~
page_retries: take_u32 ~
page_found: take_u32 ~
get_read: take_u32,
|| {
BufStatistics {
get: get,
create: create,
get_locked: get_locked,
get_locked_waited: get_locked_waited,
busy_locked: busy_locked,
miss_locked: miss_locked,
page_retries: page_retries,
page_found: page_found,
get_read: get_read,
}
}
)
);
named!(xpc <ExtendedPrecisionCounters>,
chain!(
take_until!("xpc") ~
tag!("xpc") ~
space ~
xstrat_bytes: take_u64 ~
write_bytes: take_u64 ~
read_bytes: take_u64,
||{
ExtendedPrecisionCounters {
xstrat_bytes: xstrat_bytes,
write_bytes: write_bytes,
read_bytes: read_bytes,
}
}
)
);