GNUnet  0.10.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 185 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().

185  {
186  char namebuf[16]; /* big enough to hold any row name */
187  mem_table_struct findme = { namebuf, NULL};
188  mem_table_struct *found;
189  char *head;
190  char *tail;
191  static const mem_table_struct mem_table[] = {
192  {"Active", &kb_active}, // important
193  {"AnonPages", &kb_anon_pages},
194  {"Bounce", &kb_bounce},
195  {"Buffers", &kb_main_buffers}, // important
196  {"Cached", &kb_main_cached}, // important
197  {"CommitLimit", &kb_commit_limit},
198  {"Committed_AS", &kb_committed_as},
199  {"Dirty", &kb_dirty}, // kB version of vmstat nr_dirty
200  {"HighFree", &kb_high_free},
201  {"HighTotal", &kb_high_total},
202  {"Inact_clean", &kb_inact_clean},
203  {"Inact_dirty", &kb_inact_dirty},
204  {"Inact_laundry",&kb_inact_laundry},
205  {"Inact_target", &kb_inact_target},
206  {"Inactive", &kb_inactive}, // important
207  {"LowFree", &kb_low_free},
208  {"LowTotal", &kb_low_total},
209  {"Mapped", &kb_mapped}, // kB version of vmstat nr_mapped
210  {"MemFree", &kb_main_free}, // important
211  {"MemShared", &kb_main_shared}, // important, but now gone!
212  {"MemTotal", &kb_main_total}, // important
213  {"NFS_Unstable", &kb_nfs_unstable},
214  {"PageTables", &kb_pagetables}, // kB version of vmstat nr_page_table_pages
215  {"ReverseMaps", &nr_reversemaps}, // same as vmstat nr_page_table_pages
216  {"SReclaimable", &kb_swap_reclaimable}, // "swap reclaimable" (dentry and inode structures)
217  {"SUnreclaim", &kb_swap_unreclaimable},
218  {"Slab", &kb_slab}, // kB version of vmstat nr_slab
219  {"SwapCached", &kb_swap_cached},
220  {"SwapFree", &kb_swap_free}, // important
221  {"SwapTotal", &kb_swap_total}, // important
222  {"VmallocChunk", &kb_vmalloc_chunk},
223  {"VmallocTotal", &kb_vmalloc_total},
224  {"VmallocUsed", &kb_vmalloc_used},
225  {"Writeback", &kb_writeback}, // kB version of vmstat nr_writeback
226  };
227  const int mem_table_count = sizeof(mem_table)/sizeof(mem_table_struct);
228 
230 
231  kb_inactive = ~0UL;
232 
233  head = buf;
234  for(;;){
235  tail = strchr(head, ':');
236  if(!tail) break;
237  *tail = '\0';
238  if(strlen(head) >= sizeof(namebuf)){
239  head = tail+1;
240  goto nextline;
241  }
242  strcpy(namebuf,head);
243  found = bsearch(&findme, mem_table, mem_table_count,
245  );
246  head = tail+1;
247  if(!found) goto nextline;
248  *(found->slot) = (unsigned long)strtoull(head,&tail,10);
249 nextline:
250  tail = strchr(head, '\n');
251  if(!tail) break;
252  head = tail+1;
253  }
254  if(!kb_low_total){ /* low==main except with large-memory support */
257  }
258  if(kb_inactive==~0UL){
260  }
263 }
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:231
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:236
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 141 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_main_buffers

unsigned long kb_main_buffers

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

Referenced by meminfo().

◆ kb_main_cached

unsigned long kb_main_cached

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

Referenced by meminfo().

◆ kb_main_free

unsigned long kb_main_free

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

Referenced by meminfo().

◆ kb_main_total

unsigned long kb_main_total

Definition at line 146 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 147 of file gnunet-service-testbed_meminfo.c.

Referenced by meminfo().

◆ kb_swap_total

unsigned long kb_swap_total

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

Referenced by meminfo().

◆ kb_high_free

unsigned long kb_high_free

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

Referenced by meminfo().

◆ kb_high_total

unsigned long kb_high_total

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

Referenced by meminfo().

◆ kb_low_free

unsigned long kb_low_free

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

Referenced by meminfo().

◆ kb_low_total

unsigned long kb_low_total

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

Referenced by meminfo().

◆ kb_active

unsigned long kb_active

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

Referenced by meminfo().

◆ kb_inact_laundry

unsigned long kb_inact_laundry

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

Referenced by meminfo().

◆ kb_inact_dirty

unsigned long kb_inact_dirty

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

Referenced by meminfo().

◆ kb_inact_clean

unsigned long kb_inact_clean

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

Referenced by meminfo().

◆ kb_inact_target

unsigned long kb_inact_target

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

Referenced by meminfo().

◆ kb_swap_cached

unsigned long kb_swap_cached

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

Referenced by meminfo().

◆ kb_swap_used

unsigned long kb_swap_used

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

Referenced by meminfo().

◆ kb_main_used

unsigned long kb_main_used

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

Referenced by mem_get_usage(), and meminfo().

◆ kb_writeback

unsigned long kb_writeback

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

Referenced by meminfo().

◆ kb_slab

unsigned long kb_slab

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

Referenced by meminfo().

◆ nr_reversemaps

unsigned long nr_reversemaps

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

Referenced by meminfo().

◆ kb_committed_as

unsigned long kb_committed_as

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

Referenced by meminfo().

◆ kb_dirty

unsigned long kb_dirty

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

Referenced by meminfo().

◆ kb_inactive

unsigned long kb_inactive

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

Referenced by meminfo().

◆ kb_mapped

unsigned long kb_mapped

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

Referenced by meminfo().

◆ kb_pagetables

unsigned long kb_pagetables

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

Referenced by meminfo().