Line data Source code
1 : // Snap Websites Server -- read /proc/meminfo
2 : // Copyright (c) 2018-2019 Made to Order Software Corp. All Rights Reserved
3 : //
4 : // https://snapwebsites.org/
5 : // contact@m2osw.com
6 : //
7 : // This program is free software; you can redistribute it and/or modify
8 : // it under the terms of the GNU General Public License as published by
9 : // the Free Software Foundation; either version 2 of the License, or
10 : // (at your option) any later version.
11 : //
12 : // This program is distributed in the hope that it will be useful,
13 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : // GNU General Public License for more details.
16 : //
17 : // You should have received a copy of the GNU General Public License
18 : // along with this program; if not, write to the Free Software
19 : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 : #pragma once
21 :
22 : // C++ lib
23 : //
24 : #include <cstdint>
25 :
26 :
27 : namespace snap
28 : {
29 :
30 : // WARNING: we use uint64_t for all the members so that way we simplify
31 : // the internal parsing, some values are smaller and some may
32 : // even be boolean
33 : //
34 0 : struct meminfo_t
35 : {
36 : bool is_valid() const;
37 :
38 : uint64_t f_mem_total = 0;
39 : uint64_t f_mem_free = 0;
40 : uint64_t f_mem_available = 0;
41 : uint64_t f_buffers = 0;
42 : uint64_t f_cached = 0;
43 : uint64_t f_swap_cached = 0;
44 : uint64_t f_active = 0;
45 : uint64_t f_inactive = 0;
46 : uint64_t f_active_anon = 0;
47 : uint64_t f_inactive_anon = 0;
48 : uint64_t f_active_file = 0;
49 : uint64_t f_inactive_file = 0;
50 : uint64_t f_unevictable = 0;
51 : uint64_t f_mlocked = 0;
52 : uint64_t f_swap_total = 0;
53 : uint64_t f_swap_free = 0;
54 : uint64_t f_dirty = 0;
55 : uint64_t f_writeback = 0;
56 : uint64_t f_anon_pages = 0;
57 : uint64_t f_mapped = 0;
58 : uint64_t f_shmem = 0;
59 : uint64_t f_slab = 0;
60 : uint64_t f_sreclaimable = 0;
61 : uint64_t f_sunreclaim = 0;
62 : uint64_t f_kernel_stack = 0;
63 : uint64_t f_page_tables = 0;
64 : uint64_t f_nfs_unstable = 0;
65 : uint64_t f_bounce = 0;
66 : uint64_t f_writeback_tmp = 0;
67 : uint64_t f_commit_limit = 0;
68 : uint64_t f_committed_as = 0;
69 : uint64_t f_vmalloc_total = 0;
70 : uint64_t f_vmalloc_used = 0;
71 : uint64_t f_vmalloc_chunk = 0;
72 : uint64_t f_hardware_corrupted = 0;
73 : uint64_t f_anon_huge_pages = 0;
74 : uint64_t f_cma_total = 0;
75 : uint64_t f_cma_free = 0;
76 : uint64_t f_huge_pages_total = 0;
77 : uint64_t f_huge_pages_free = 0;
78 : uint64_t f_huge_pages_rsvd = 0;
79 : uint64_t f_huge_pages_surp = 0;
80 : uint64_t f_huge_page_size = 0;
81 : uint64_t f_direct_map4k = 0;
82 : uint64_t f_direct_map2m = 0;
83 : uint64_t f_direct_map1g = 0;
84 : };
85 :
86 : meminfo_t get_meminfo();
87 :
88 :
89 : } // snap namespace
90 : // vim: ts=4 sw=4 et
|