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
/*!
Read data from `/proc/meminfo` into the struct [`ProcMemInfo`].

The processor of `/proc/meminfo` takes the values for the memory areas specified, and puts them in the
struct [`ProcMemInfo`]. The values are in kilobytes (kB), just like the values in the original `/proc/meminfo`
file.

Here is an example obtaining the data from `/proc/meminfo`:
```no_run
use proc_sys_parser::{meminfo, meminfo::ProcMemInfo};

let proc_meminfo = meminfo::read();

println!("{:#?}", proc_meminfo);
```
Example output:
```text
ProcMemInfo {
    memtotal: 3997876,
    memfree: 2415136,
    memavailable: 3654096,
    buffers: 37492,
    cached: 1305568,
    swapcached: 0,
    active: 880772,
    inactive: 549432,
    active_anon: 86968,
    inactive_anon: 5196,
    active_file: 793804,
    inactive_file: 544236,
    unevictable: 4000,
    mlocked: 0,
    swaptotal: 0,
    swapfree: 0,
    zswap: 0,
    zswapped: 0,
    dirty: 0,
    writeback: 0,
    anonpages: 91144,
    mapped: 140948,
    shmem: 5020,
    kreclaimable: 56680,
    slab: 93916,
    sreclaimable: 56680,
    sunreclaim: 37236,
    kernelstack: 3256,
    shadowcallstack: 828,
    pagetables: 2884,
    secpagetables: 0,
    nfs_unstable: 0,
    bounce: 0,
    writebacktmp: 0,
    commitlimit: 1998936,
    committed_as: 944240,
    vmalloctotal: 133141626880,
    vmallocused: 14124,
    vmallocchunk: 0,
    percpu: 2280,
    hardwarecorrupted: 0,
    anonhugepages: 4096,
    shmemhugepages: 0,
    shmempmdmapped: 0,
    filehugepages: 0,
    filepmdmapped: 0,
    cmatotal: 32768,
    cmafree: 31232,
    hugepages_total: 0,
    hugepages_free: 0,
    hugepages_rsvd: 0,
    hugepages_surp: 0,
    hugepagesize: 2048,
    hugetlb: 0
}
```
(edited for readability)

If you want to change th path and/or file that is read for [`ProcMemInfo`], which is `/proc/meminfo`
by default, use:
```no_run
use proc_sys_parser::{meminfo, meminfo::{ProcMemInfo, Builder}};

let proc_meminfo = Builder::new().file_name("/myproc/meminfo").read();
```

*/
use std::fs::read_to_string;

/// Struct for holding `/proc/meminfo` statistics
#[derive(Debug, PartialEq)]
pub struct ProcMemInfo {
    pub memtotal: u64,
    pub memfree: u64,
    pub memavailable: u64,
    pub buffers: u64,
    pub cached: u64,
    pub swapcached: u64,
    pub active: u64,
    pub inactive: u64,
    pub active_anon: u64,
    pub inactive_anon: u64,
    pub active_file: u64,
    pub inactive_file: u64,
    pub unevictable: u64,
    pub mlocked: u64,
    pub swaptotal: u64,
    pub swapfree: u64,
    pub zswap: u64,
    pub zswapped: u64,
    pub dirty: u64,
    pub writeback: u64,
    pub anonpages: u64,
    pub mapped: u64,
    pub shmem: u64,
    pub kreclaimable: u64,
    pub slab: u64,
    pub sreclaimable: u64,
    pub sunreclaim: u64,
    pub kernelstack: u64,
    pub shadowcallstack: u64,
    pub pagetables: u64,
    pub secpagetables: u64,
    pub nfs_unstable: u64,
    pub bounce: u64,
    pub writebacktmp: u64,
    pub commitlimit: u64,
    pub committed_as: u64,
    pub vmalloctotal: u64,
    pub vmallocused: u64,
    pub vmallocchunk: u64,
    pub percpu: u64,
    pub hardwarecorrupted: u64,
    pub anonhugepages: u64,
    pub shmemhugepages: u64,
    pub shmempmdmapped: u64,
    pub filehugepages: u64,
    pub filepmdmapped: u64,
    pub cmatotal: u64,
    pub cmafree: u64,
    pub hugepages_total: u64,
    pub hugepages_free: u64,
    pub hugepages_rsvd: u64,
    pub hugepages_surp: u64,
    pub hugepagesize: u64,
    pub hugetlb: u64,
}

/// Builder pattern for [`ProcMemInfo`]
pub struct Builder
{
    pub proc_meminfo_file: String
}

impl Default for Builder
{
    fn default() -> Self
    {
        Self::new()
    }
}

impl Builder
{
    pub fn new() -> Builder
    {
        Builder { proc_meminfo_file: "/proc/meminfo".to_string() }
    }

    pub fn file_name(mut self, proc_meminfo_file: &str) -> Builder
    {
        self.proc_meminfo_file = proc_meminfo_file.to_string();
        self
    }
    pub fn read(self) -> ProcMemInfo
    {
        ProcMemInfo::read_proc_meminfo(&self.proc_meminfo_file)
    }
}

/// The main function for building a [`ProcMemInfo`] struct with current data.
/// This uses the Builder pattern, which allows settings such as the filename to specified.
pub fn read() -> ProcMemInfo
{
   Builder::new().read()
}

impl Default for ProcMemInfo {
    fn default() -> Self {
        Self::new()
    }
}
impl ProcMemInfo {
    pub fn new() -> ProcMemInfo {
        ProcMemInfo {
            memtotal: 0,
            memfree: 0,
            memavailable: 0,
            buffers: 0,
            cached: 0,
            swapcached: 0,
            active: 0,
            inactive: 0,
            active_anon: 0,
            inactive_anon: 0,
            active_file: 0,
            inactive_file: 0,
            unevictable: 0,
            mlocked: 0,
            swaptotal: 0,
            swapfree: 0,
            zswap: 0,
            zswapped: 0,
            dirty: 0,
            writeback: 0,
            anonpages: 0,
            mapped: 0,
            shmem: 0,
            kreclaimable: 0,
            slab: 0,
            sreclaimable: 0,
            sunreclaim: 0,
            kernelstack: 0,
            shadowcallstack: 0,
            pagetables: 0,
            secpagetables: 0,
            nfs_unstable: 0,
            bounce: 0,
            writebacktmp: 0,
            commitlimit: 0,
            committed_as: 0,
            vmalloctotal: 0,
            vmallocused: 0,
            vmallocchunk: 0,
            percpu: 0,
            hardwarecorrupted: 0,
            anonhugepages: 0,
            shmemhugepages: 0,
            shmempmdmapped: 0,
            filehugepages: 0,
            filepmdmapped: 0,
            cmatotal: 0,
            cmafree: 0,
            hugepages_total: 0,
            hugepages_free: 0,
            hugepages_rsvd: 0,
            hugepages_surp: 0,
            hugepagesize: 0,
            hugetlb: 0,
        }
    }
    pub fn parse_proc_meminfo_output(
        proc_meminfo: &str,
    ) -> ProcMemInfo
    {
        let mut procmeminfo = ProcMemInfo::new();
        for line in proc_meminfo.lines()
        {
            match line
            {
                line if line.starts_with("MemTotal:") => procmeminfo.memtotal = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("MemFree:") => procmeminfo.memfree = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("MemAvailable:") => procmeminfo.memavailable = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Buffers:") => procmeminfo.buffers = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Cached:") => procmeminfo.cached = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("SwapCached:") => procmeminfo.swapcached = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Active:") => procmeminfo.active = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Inactive:") => procmeminfo.inactive = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Active(anon):") => procmeminfo.active_anon = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Inactive(anon):") => procmeminfo.inactive_anon = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Active(file):") => procmeminfo.active_file = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Inactive(file):") => procmeminfo.inactive_file = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Unevictable:") => procmeminfo.unevictable = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Mlocked:") => procmeminfo.mlocked = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("SwapTotal:") => procmeminfo.swaptotal = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("SwapFree:") => procmeminfo.swapfree = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Zswap:") => procmeminfo.zswap = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Zswapped:") => procmeminfo.zswapped = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Dirty:") => procmeminfo.dirty = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Writeback:") => procmeminfo.writeback = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("AnonPages:") => procmeminfo.anonpages = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Mapped:") => procmeminfo.mapped = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Shmem:") => procmeminfo.shmem = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("KReclaimable:") => procmeminfo.kreclaimable = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Slab:") => procmeminfo.slab = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("SReclaimable:") => procmeminfo.sreclaimable = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("SUnreclaim:") => procmeminfo.sunreclaim = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("KernelStack:") => procmeminfo.kernelstack = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("ShadowCallStack:") => procmeminfo.shadowcallstack = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("PageTables:") => procmeminfo.pagetables = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("SecPageTables:") => procmeminfo.secpagetables = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("NFS_Unstable:") => procmeminfo.nfs_unstable = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Bounce:") => procmeminfo.bounce = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("WritebackTmp:") => procmeminfo.writebacktmp = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("CommitLimit:") => procmeminfo.commitlimit = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Committed_AS:") => procmeminfo.committed_as = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("VmallocTotal:") => procmeminfo.vmalloctotal = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("VmallocUsed:") => procmeminfo.vmallocused = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("VmallocChunk:") => procmeminfo.vmallocchunk = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Percpu:") => procmeminfo.percpu = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("HardwareCorrupted:") => procmeminfo.hardwarecorrupted = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("AnonHugePages:") => procmeminfo.anonhugepages = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("ShmemHugePages:") => procmeminfo.shmemhugepages = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("ShmemPmdMapped:") => procmeminfo.shmempmdmapped = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("FileHugePages:") => procmeminfo.filehugepages = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("FilePmdMapped:") => procmeminfo.filepmdmapped = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("CmaTotal:") => procmeminfo.cmatotal = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("CmaFree:") => procmeminfo.cmafree = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("HugePages_Total:") => procmeminfo.hugepages_total = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("HugePages_Free:") => procmeminfo.hugepages_free = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("HugePages_Rsvd:") => procmeminfo.hugepages_rsvd = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("HugePages_Surp:") => procmeminfo.hugepages_surp = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Hugepagesize:") => procmeminfo.hugepagesize = ProcMemInfo::parse_proc_meminfo_line(line),
                line if line.starts_with("Hugetlb:") => procmeminfo.hugetlb = ProcMemInfo::parse_proc_meminfo_line(line),
                _  => panic!("Unknown line found in stat: {}", line),
            }
        }
        procmeminfo
    }
    fn parse_proc_meminfo_line(proc_meminfo_line: &str) -> u64
    {
        proc_meminfo_line.split_whitespace()
            .skip(1)
            .map(|number| number.parse::<u64>().unwrap())
            .nth(0)
            .unwrap_or(0)
    }
    pub fn read_proc_meminfo(proc_meminfo_file: &str) -> ProcMemInfo
    {
        //let proc_stat_file = proc_stat_file.unwrap_or("/proc/stat");
        let proc_meminfo_output = read_to_string(proc_meminfo_file).unwrap_or_else(|error|panic!("Error {} reading file: {}", error, proc_meminfo_file));
        ProcMemInfo::parse_proc_meminfo_output(&proc_meminfo_output)
    }
}

#[cfg(test)]
mod tests {
    use std::fs::{write, remove_dir_all, create_dir_all};
    use rand::{thread_rng, Rng};
    use rand::distributions::Alphanumeric;
    use super::*;

    #[test]
    fn parse_meminfo_line() {
        let meminfo_line = "MemTotal:        3997876 kB";
        let result = ProcMemInfo::parse_proc_meminfo_line(&meminfo_line);
        assert_eq!(result, 3997876_u64);
    }

    #[test]
    fn parse_full_proc_meminfo_file() {
        let proc_meminfo = "MemTotal:        3997876 kB
MemFree:         2415136 kB
MemAvailable:    3654096 kB
Buffers:           37492 kB
Cached:          1305568 kB
SwapCached:            0 kB
Active:           880772 kB
Inactive:         549432 kB
Active(anon):      86968 kB
Inactive(anon):     5196 kB
Active(file):     793804 kB
Inactive(file):   544236 kB
Unevictable:        4000 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Zswap:                 0 kB
Zswapped:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         91144 kB
Mapped:           140948 kB
Shmem:              5020 kB
KReclaimable:      56680 kB
Slab:              93916 kB
SReclaimable:      56680 kB
SUnreclaim:        37236 kB
KernelStack:        3256 kB
ShadowCallStack:     828 kB
PageTables:         2884 kB
SecPageTables:         0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1998936 kB
Committed_AS:     944240 kB
VmallocTotal:   133141626880 kB
VmallocUsed:       14124 kB
VmallocChunk:          0 kB
Percpu:             2280 kB
HardwareCorrupted:     0 kB
AnonHugePages:      4096 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:          32768 kB
CmaFree:           31232 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB";
        let result = ProcMemInfo::parse_proc_meminfo_output(proc_meminfo);
        assert_eq!(result, ProcMemInfo {
            memtotal: 3997876,
            memfree: 2415136,
            memavailable: 3654096,
            buffers: 37492,
            cached: 1305568,
            swapcached: 0,
            active: 880772,
            inactive: 549432,
            active_anon: 86968,
            inactive_anon: 5196,
            active_file: 793804,
            inactive_file: 544236,
            unevictable: 4000,
            mlocked: 0,
            swaptotal: 0,
            swapfree: 0,
            zswap: 0,
            zswapped: 0,
            dirty: 0,
            writeback: 0,
            anonpages: 91144,
            mapped: 140948,
            shmem: 5020,
            kreclaimable: 56680,
            slab: 93916,
            sreclaimable: 56680,
            sunreclaim: 37236,
            kernelstack: 3256,
            shadowcallstack: 828,
            pagetables: 2884,
            secpagetables: 0,
            nfs_unstable: 0,
            bounce: 0,
            writebacktmp: 0,
            commitlimit: 1998936,
            committed_as: 944240,
            vmalloctotal: 133141626880,
            vmallocused: 14124,
            vmallocchunk: 0,
            percpu: 2280,
            hardwarecorrupted: 0,
            anonhugepages: 4096,
            shmemhugepages: 0,
            shmempmdmapped: 0,
            filehugepages: 0,
            filepmdmapped: 0,
            cmatotal: 32768,
            cmafree: 31232,
            hugepages_total: 0,
            hugepages_free: 0,
            hugepages_rsvd: 0,
            hugepages_surp: 0,
            hugepagesize: 2048,
            hugetlb: 0
        });
    }

    #[test]
    fn create_proc_meminfo_file_and_read() {
        let proc_meminfo = "MemTotal:        3997876 kB
MemFree:         2415136 kB
MemAvailable:    3654096 kB
Buffers:           37492 kB
Cached:          1305568 kB
SwapCached:            0 kB
Active:           880772 kB
Inactive:         549432 kB
Active(anon):      86968 kB
Inactive(anon):     5196 kB
Active(file):     793804 kB
Inactive(file):   544236 kB
Unevictable:        4000 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Zswap:                 0 kB
Zswapped:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         91144 kB
Mapped:           140948 kB
Shmem:              5020 kB
KReclaimable:      56680 kB
Slab:              93916 kB
SReclaimable:      56680 kB
SUnreclaim:        37236 kB
KernelStack:        3256 kB
ShadowCallStack:     828 kB
PageTables:         2884 kB
SecPageTables:         0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1998936 kB
Committed_AS:     944240 kB
VmallocTotal:   133141626880 kB
VmallocUsed:       14124 kB
VmallocChunk:          0 kB
Percpu:             2280 kB
HardwareCorrupted:     0 kB
AnonHugePages:      4096 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:          32768 kB
CmaFree:           31232 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB";
        let directory_suffix: String = thread_rng().sample_iter(&Alphanumeric).take(8).map(char::from).collect();
        let test_path = format!("/tmp/test.{}", directory_suffix);
        create_dir_all(format!("{}", test_path)).expect("Error creating mock directory.");

        write(format!("{}/meminfo", test_path), proc_meminfo).expect(format!("Error writing to {}/meminfo", test_path).as_str());
        let result = Builder::new().file_name(format!("{}/meminfo", test_path).as_str()).read();

        remove_dir_all(test_path).unwrap();

        assert_eq!(result, ProcMemInfo {
            memtotal: 3997876,
            memfree: 2415136,
            memavailable: 3654096,
            buffers: 37492,
            cached: 1305568,
            swapcached: 0,
            active: 880772,
            inactive: 549432,
            active_anon: 86968,
            inactive_anon: 5196,
            active_file: 793804,
            inactive_file: 544236,
            unevictable: 4000,
            mlocked: 0,
            swaptotal: 0,
            swapfree: 0,
            zswap: 0,
            zswapped: 0,
            dirty: 0,
            writeback: 0,
            anonpages: 91144,
            mapped: 140948,
            shmem: 5020,
            kreclaimable: 56680,
            slab: 93916,
            sreclaimable: 56680,
            sunreclaim: 37236,
            kernelstack: 3256,
            shadowcallstack: 828,
            pagetables: 2884,
            secpagetables: 0,
            nfs_unstable: 0,
            bounce: 0,
            writebacktmp: 0,
            commitlimit: 1998936,
            committed_as: 944240,
            vmalloctotal: 133141626880,
            vmallocused: 14124,
            vmallocchunk: 0,
            percpu: 2280,
            hardwarecorrupted: 0,
            anonhugepages: 4096,
            shmemhugepages: 0,
            shmempmdmapped: 0,
            filehugepages: 0,
            filepmdmapped: 0,
            cmatotal: 32768,
            cmafree: 31232,
            hugepages_total: 0,
            hugepages_free: 0,
            hugepages_rsvd: 0,
            hugepages_surp: 0,
            hugepagesize: 2048,
            hugetlb: 0
        });
    }
}