Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
anonymous_namespace{app_var.cpp} Namespace Reference

Classes

class  Tracking
 : class storing info about tracked particles More...
 

Functions

const char * humanSize (uint64_t bytes)
 
void print_mem (uint64_t memory_alloc)
 

Function Documentation

const char* anonymous_namespace{app_var.cpp}::humanSize ( uint64_t  bytes)

Definition at line 18 of file app_var.cpp.

Referenced by print_mem().

18  {
19  char const *suffix[] = {"B", "KB", "MB", "GB", "TB"};
20  char length = sizeof(suffix) / sizeof(suffix[0]);
21 
22  size_t i = 0;
23  double dblBytes = bytes;
24 
25  if (bytes > 1024) {
26  for (i = 0; (bytes / 1024) > 0 && i<length-1; i++, bytes /= 1024)
27  dblBytes = bytes / 1024.0;
28  }
29 
30  static char output[200];
31  sprintf(output, "%.02lf %s", dblBytes, suffix[i]);
32  return output;
33 }
void anonymous_namespace{app_var.cpp}::print_mem ( uint64_t  memory_alloc)

Definition at line 35 of file app_var.cpp.

References humanSize().

Referenced by App_Var< T >::run_simulation().

36 {
37  BOOST_LOG_TRIVIAL(debug) << "Allocated " << humanSize(memory_alloc) << " of memory.";
38 }
const char * humanSize(uint64_t bytes)
Definition: app_var.cpp:18