GNUnet  0.11.x
Functions | Variables
gnunet-service-testbed_meminfo.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void meminfo (void)
 

Variables

unsigned long kb_main_shared
 
unsigned long kb_main_buffers
 
unsigned long kb_main_cached
 
unsigned long kb_main_free
 
unsigned long kb_main_total
 
unsigned long kb_swap_free
 
unsigned long kb_swap_total
 
unsigned long kb_high_free
 
unsigned long kb_high_total
 
unsigned long kb_low_free
 
unsigned long kb_low_total
 
unsigned long kb_active
 
unsigned long kb_inact_laundry
 
unsigned long kb_inact_dirty
 
unsigned long kb_inact_clean
 
unsigned long kb_inact_target
 
unsigned long kb_swap_cached
 
unsigned long kb_swap_used
 
unsigned long kb_main_used
 
unsigned long kb_writeback
 
unsigned long kb_slab
 
unsigned long nr_reversemaps
 
unsigned long kb_committed_as
 
unsigned long kb_dirty
 
unsigned long kb_inactive
 
unsigned long kb_mapped
 
unsigned long kb_pagetables
 

Function Documentation

◆ meminfo()

void meminfo ( void  )

Definition at line 192 of file gnunet-service-testbed_meminfo.c.

References buf, compare_mem_table_structs(), FILE_TO_BUF, head, kb_active, kb_anon_pages, kb_bounce, kb_commit_limit, kb_committed_as, kb_dirty, kb_high_free, kb_high_total, kb_inact_clean, kb_inact_dirty, kb_inact_laundry, kb_inact_target, kb_inactive, kb_low_free, kb_low_total, kb_main_buffers, kb_main_cached, kb_main_free, kb_main_shared, kb_main_total, kb_main_used, kb_mapped, kb_nfs_unstable, kb_pagetables, kb_slab, kb_swap_cached, kb_swap_free, kb_swap_reclaimable, kb_swap_total, kb_swap_unreclaimable, kb_swap_used, kb_vmalloc_chunk, kb_vmalloc_total, kb_vmalloc_used, kb_writeback, meminfo_fd, MEMINFO_FILE, nr_reversemaps, mem_table_struct::slot, and tail.

Referenced by mem_get_usage().

193 {
194  char namebuf[16]; /* big enough to hold any row name */
195  mem_table_struct findme = { namebuf, NULL };
196  mem_table_struct *found;
197  char *head;
198  char *tail;
199  static const mem_table_struct mem_table[] = {
200  { "Active", &kb_active }, // important
201  { "AnonPages", &kb_anon_pages },
202  { "Bounce", &kb_bounce },
203  { "Buffers", &kb_main_buffers }, // important
204  { "Cached", &kb_main_cached }, // important
205  { "CommitLimit", &kb_commit_limit },
206  { "Committed_AS", &kb_committed_as },
207  { "Dirty", &kb_dirty }, // kB version of vmstat nr_dirty
208  { "HighFree", &kb_high_free },
209  { "HighTotal", &kb_high_total },
210  { "Inact_clean", &kb_inact_clean },
211  { "Inact_dirty", &kb_inact_dirty },
212  { "Inact_laundry", &kb_inact_laundry },
213  { "Inact_target", &kb_inact_target },
214  { "Inactive", &kb_inactive }, // important
215  { "LowFree", &kb_low_free },
216  { "LowTotal", &kb_low_total },
217  { "Mapped", &kb_mapped }, // kB version of vmstat nr_mapped
218  { "MemFree", &kb_main_free }, // important
219  { "MemShared", &kb_main_shared }, // important, but now gone!
220  { "MemTotal", &kb_main_total }, // important
221  { "NFS_Unstable", &kb_nfs_unstable },
222  { "PageTables", &kb_pagetables }, // kB version of vmstat nr_page_table_pages
223  { "ReverseMaps", &nr_reversemaps }, // same as vmstat nr_page_table_pages
224  { "SReclaimable", &kb_swap_reclaimable }, // "swap reclaimable" (dentry and inode structures)
225  { "SUnreclaim", &kb_swap_unreclaimable },
226  { "Slab", &kb_slab }, // kB version of vmstat nr_slab
227  { "SwapCached", &kb_swap_cached },
228  { "SwapFree", &kb_swap_free }, // important
229  { "SwapTotal", &kb_swap_total }, // important
230  { "VmallocChunk", &kb_vmalloc_chunk },
231  { "VmallocTotal", &kb_vmalloc_total },
232  { "VmallocUsed", &kb_vmalloc_used },
233  { "Writeback", &kb_writeback }, // kB version of vmstat nr_writeback
234  };
235  const int mem_table_count = sizeof(mem_table) / sizeof(mem_table_struct);
236 
238 
239  kb_inactive = ~0UL;
240 
241  head = buf;
242  for (;;)
243  {
244  tail = strchr (head, ':');
245  if (! tail)
246  break;
247  *tail = '\0';
248  if (strlen (head) >= sizeof(namebuf))
249  {
250  head = tail + 1;
251  goto nextline;
252  }
253  strcpy (namebuf, head);
254  found = bsearch (&findme, mem_table, mem_table_count,
256  );
257  head = tail + 1;
258  if (! found)
259  goto nextline;
260  *(found->slot) = (unsigned long) strtoull (head, &tail, 10);
261 nextline:
262  tail = strchr (head, '\n');
263  if (! tail)
264  break;
265  head = tail + 1;
266  }
267  if (! kb_low_total) /* low==main except with large-memory support */
268  {
271  }
272  if (kb_inactive == ~0UL)
273  {
275  }
278 }
unsigned long kb_swap_used
#define FILE_TO_BUF(filename, fd)
static unsigned long kb_vmalloc_chunk
unsigned long kb_low_total
unsigned long kb_inact_laundry
unsigned long kb_main_used
unsigned long kb_swap_cached
static unsigned long kb_anon_pages
static unsigned long kb_vmalloc_used
unsigned long kb_main_cached
unsigned long kb_main_free
unsigned long kb_mapped
unsigned long kb_main_shared
static int meminfo_fd
static int compare_mem_table_structs(const void *a, const void *b)
static unsigned long kb_swap_reclaimable
unsigned long kb_main_total
static unsigned long kb_commit_limit
static unsigned long kb_swap_unreclaimable
static char buf[2048]
unsigned long kb_high_total
static unsigned long kb_vmalloc_total
#define MEMINFO_FILE
unsigned long kb_writeback
unsigned long kb_inact_target
static unsigned long kb_bounce
unsigned long kb_inactive
unsigned long kb_low_free
unsigned long nr_reversemaps
static unsigned long kb_nfs_unstable
unsigned long kb_pagetables
static struct PendingResolutions * head
Head of list of pending resolution requests.
Definition: gnunet-ats.c:230
unsigned long kb_inact_dirty
unsigned long kb_inact_clean
unsigned long kb_slab
static struct PendingResolutions * tail
Tail of list of pending resolution requests.
Definition: gnunet-ats.c:235
unsigned long kb_main_buffers
unsigned long kb_swap_free
unsigned long kb_active
unsigned long kb_dirty
unsigned long kb_committed_as
unsigned long kb_swap_total
unsigned long kb_high_free
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kb_main_shared

unsigned long kb_main_shared

Definition at line 147 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_main_buffers

unsigned long kb_main_buffers

Definition at line 149 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_main_cached

unsigned long kb_main_cached

Definition at line 150 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_main_free

unsigned long kb_main_free

Definition at line 151 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_main_total

unsigned long kb_main_total

Definition at line 152 of file gnunet-service-testbed_meminfo.c.

Referenced by mem_get_usage(), and meminfo().

◆ kb_swap_free

unsigned long kb_swap_free

Definition at line 153 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_swap_total

unsigned long kb_swap_total

Definition at line 154 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_high_free

unsigned long kb_high_free

Definition at line 156 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_high_total

unsigned long kb_high_total

Definition at line 157 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_low_free

unsigned long kb_low_free

Definition at line 158 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_low_total

unsigned long kb_low_total

Definition at line 159 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_active

unsigned long kb_active

Definition at line 161 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_inact_laundry

unsigned long kb_inact_laundry

Definition at line 162 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_inact_dirty

unsigned long kb_inact_dirty

Definition at line 163 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_inact_clean

unsigned long kb_inact_clean

Definition at line 164 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_inact_target

unsigned long kb_inact_target

Definition at line 165 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_swap_cached

unsigned long kb_swap_cached

Definition at line 166 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_swap_used

unsigned long kb_swap_used

Definition at line 168 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_main_used

unsigned long kb_main_used

Definition at line 169 of file gnunet-service-testbed_meminfo.c.

Referenced by mem_get_usage(), and meminfo().

◆ kb_writeback

unsigned long kb_writeback

Definition at line 171 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_slab

unsigned long kb_slab

Definition at line 172 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ nr_reversemaps

unsigned long nr_reversemaps

Definition at line 173 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_committed_as

unsigned long kb_committed_as

Definition at line 174 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_dirty

unsigned long kb_dirty

Definition at line 175 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_inactive

unsigned long kb_inactive

Definition at line 176 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_mapped

unsigned long kb_mapped

Definition at line 177 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_pagetables

unsigned long kb_pagetables

Definition at line 178 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().