66 "Minimum peak virtual memory size");
69 "VmPeak-Max",
"double",
unit_m[VirtualMemory::VMPEAK],
70 "Maximum peak virtual memory size");
74 "Average peak virtual memory size");
113 if (
mode_m == std::ios::app)
return;
117 std::string dateStr(simtimer.
date());
118 std::string timeStr(simtimer.
time());
120 std::stringstream ss;
133 static pid_t pid = getpid();
134 std::string fname =
"/proc/" + std::to_string(pid) +
"/status";
136 if (!std::filesystem::exists(fname)) {
137 throw OpalException(
"MemoryProfiler::update()",
"File '" + fname +
"' doesn't exist.");
140 std::ifstream ifs(fname.c_str());
142 if (!ifs.is_open()) {
143 throw OpalException(
"MemoryProfiler::update()",
"Failed to open '" + fname +
"'.");
147 while (ifs >> token) {
160 if (ippl::Comm->size() == 1) {
161 for (
unsigned int i = 0; i <
vmem_m.size(); ++i) {
162 vmMin[i] = vmMax[i] = vmAvg[i] =
vmem_m[i];
168 reduce(
vmem_m.data(), vmAvg.data(),
vmem_m.size(), std::plus<double>());
170 double inodes = 1.0 / double(ippl::Comm->size());
171 for (
auto& vm : vmAvg) {
177 reduce(
vmem_m.data(), vmMin.data(),
vmem_m.size(), std::less<double>());
178 reduce(
vmem_m.data(), vmMax.data(),
vmem_m.size(), std::greater<double>());
188 this->
compute(vmMin, vmMax, vmAvg);
190 if (ippl::Comm->rank() != 0) {
194 double pathLength = beam.getParticleContainers()[0]->get_sPos();
Template PIC bunch: IPPL PicManager, shared field mesh/solver, and multiple particle containers.
void compute(vm_t &vmMin, vm_t &vmMax, vm_t &vmAvg)
std::vector< long double > vm_t
void write(const PartBunch_t &beam) override
MemoryProfiler(const std::string &fname, bool restart)
std::map< std::string, int > procinfo_m
std::string time() const
Return time.
std::string date() const
Return date.
std::string getInputFn()
get opals input filename
static OpalData * getInstance()
double getT() const
Get the current simulation time.
void addColumn(const std::string &name, const std::string &type, const std::string &unit, const std::string &desc, std::ios_base::fmtflags flags=std::ios_base::scientific, unsigned short precision=15)
void addColumnValue(const std::string &name, const T &val)
std::string toString(const T &val)
void addDefaultParameters()
void addDescription(const std::string &text, const std::string &content)
void writeHeader()
Write SDDS header.
std::ios_base::openmode mode_m
First write to the statistics output file.
void addInfo(const std::string &mode, const size_t &no_row_counts)