votca 2026-dev
Loading...
Searching...
No Matches
dfttimings.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2026 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20// Third party includes
21#include <boost/format.hpp>
22
23// Local VOTCA includes
25
26namespace votca {
27namespace xtp {
28
29void DFTTimings::Report(Logger& log, Log::Level level) const {
30 const double total = Elapsed();
31 double accounted = 0.0;
32 XTP_LOG(level, log) << " DFT timing summary (wall clock)" << std::flush;
33 XTP_LOG(level, log) << (boost::format(" %-38s %7s %11s %10s %6s") % "part" %
34 "calls" % "time [s]" % "per call" % "%")
35 .str()
36 << std::flush;
37 for (const Entry& e : entries_) {
38 accounted += e.seconds;
39 XTP_LOG(level, log) << (boost::format(" %-38s %7d %11.2f %10.3f %6.1f") %
40 e.name % e.calls % e.seconds %
41 (e.seconds / double(e.calls)) %
42 (total > 0 ? 100.0 * e.seconds / total : 0.0))
43 .str()
44 << std::flush;
45 }
46 XTP_LOG(level, log) << (boost::format(" %-38s %7s %11.2f %10s %6.1f") %
47 "not itemised" % "" % (total - accounted) % "" %
48 (total > 0 ? 100.0 * (total - accounted) / total
49 : 0.0))
50 .str()
51 << std::flush;
52 XTP_LOG(level, log)
53 << (boost::format(" %-38s %7s %11.2f") % "total" % "" % total).str()
54 << std::flush;
55}
56
58 std::ifstream status("/proc/self/status");
59 if (!status.is_open()) {
60 return -1.0;
61 }
62 const std::string key = peak ? "VmHWM:" : "VmRSS:";
63 std::string word;
64 while (status >> word) {
65 if (word == key) {
66 double kb = 0.0;
67 status >> kb;
68 return kb / (1024.0 * 1024.0);
69 }
70 }
71 return -1.0;
72}
73
74} // namespace xtp
75} // namespace votca
std::vector< Entry > entries_
Definition dfttimings.h:120
void Report(Logger &log, Log::Level level) const
Table of all entries with their share of the time since Reset().
Definition dfttimings.cc:29
double Elapsed() const
Definition dfttimings.h:91
static double ResidentMemoryGB(bool peak)
Definition dfttimings.cc:57
Logger is used for thread-safe output of messages.
Definition logger.h:164
#define XTP_LOG(level, log)
Definition logger.h:40
Charge transport classes.
Definition ERIs.h:28
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Level
be loud and noisy
Definition globals.h:28