55 m_tmpTimes.insert(std::make_pair(key,clock()));
56 m_seconds .insert(std::make_pair(key,0.e0));
57 m_dsplStrs.insert(std::make_pair(key,displayString));
76 clock_t now = clock();
85 os <<
"# Time spent " << std::left << std::setw(
m_maxLen+2) <<
m_dsplStrs.at(key) +
": "
86 << std::setw(10) <<
m_seconds.at(key) <<
" seconds" << std::right << std::endl;
114 for (
auto label : labels)
144 std::ifstream fichier (
"/proc/self/status");
146 for (
CepsString line; getline (fichier, line);)
148 std::regex
const pattern {
".*VmSize:\\s+(\\d+)\\s*kB.*"};
150 if (std::regex_match (line, match, pattern))
151 size = std::stoi (match[1]);
164 return static_cast<size_t>(globalMemorySize);
Timer class, measure execution time.
std::basic_string< CepsChar > CepsString
C++ format string.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
void stop(CepsString lbl)
Stops the measure of a labeled chronometer.
CepsMap< CepsString, clock_t > m_tmpTimes
Temp evals for times.
size_t localMemoryUsage()
Returns an estimation of the memory taken by the current process (in kB)
CepsMap< CepsString, CepsReal > m_seconds
Times.
void start(CepsString lbl, CepsString dspl="")
Creates or continue a labeled chronometer.
CepsUInt m_maxLen
For nice output.
CepsMap< CepsString, CepsString > m_dsplStrs
Text to display at the end of computation, typically.
void logMemoryUsage(const CepsString &xtic)
Writes a line with memory usage in profiling log, xtic is used to describe what the program is curren...
void display() const
Prints time spent by all chronometers.
size_t globalMemoryUsage()
Returns an estimation of the memory taken by all the MPI process (in kB)
void restart(CepsString lbl)
Resets a labeled chronometer.
void logMemoryUsageIf(CepsBool ifexpr, const CepsString &xtic)
Writes a line with memory usage in profiling log if 'ifexpr' is true, xtic is used to describe what t...
void applyPermutation(CepsVector< _Type, _Alloc > &vec, const CepsVector< CepsUInt > &p)
Apply a permutation to a vector.
MPI_Comm getCommunicator()
Get the communicator.
CepsVector< CepsUInt > getSortPermutation(const CepsVector< _Type, _Alloc > &vec, _Compare compare)
Get the permutation that would be applied to sort the whole vector with specific comparator.
const _Type & max(const CepsVector< _Type, _Alloc > &vec)
Returns the maximum of the vector, const version.
void barrier()
Explicit barrier: wait for all processors before continuing.
CepsVector< _Tp > valuesOf(const CepsMap< _Key, _Tp, _Comp, _Alloc > &m)
Get the values of a map as a vector.
CepsBool isMaster()
Is calling process the master ?
std::ofstream & profilingLog()
Get the ProfilingLog used in Ceps.
CepsVector< _Key > keysOf(const CepsMap< _Key, _Tp, _Comp, _Alloc > &m)
Get the keys of a map as a vector.