aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlberto Gonzalez <boqwxp@airmail.cc>2020-06-07 07:45:24 +0000
committerAlberto Gonzalez <boqwxp@airmail.cc>2020-06-21 02:16:52 +0000
commita564cc806f2e710b9cbb8365fd63587351bf3040 (patch)
tree8104a60e1882530305cec6f898f04af5a53ecc7a /kernel
parent62a9e62a1bc016122c2224bb157e86d8dbad5613 (diff)
downloadyosys-a564cc806f2e710b9cbb8365fd63587351bf3040.tar.gz
yosys-a564cc806f2e710b9cbb8365fd63587351bf3040.tar.bz2
yosys-a564cc806f2e710b9cbb8365fd63587351bf3040.zip
log, qbfsat: Include child process time in `PerformanceTimer::query()` and report the time for each call to the QBF-SAT solver.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/log.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/log.h b/kernel/log.h
index 501d20c09..d8e748ff8 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -314,13 +314,15 @@ struct PerformanceTimer
return int64_t(ts.tv_sec)*1000000000 + ts.tv_nsec;
# elif defined(RUSAGE_SELF)
struct rusage rusage;
- int64_t t;
- if (getrusage(RUSAGE_SELF, &rusage) == -1) {
- log_cmd_error("getrusage failed!\n");
- log_abort();
+ int64_t t = 0;
+ for (int who : {RUSAGE_SELF, RUSAGE_CHILDREN}) {
+ if (getrusage(who, &rusage) == -1) {
+ log_cmd_error("getrusage failed!\n");
+ log_abort();
+ }
+ t += 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL;
+ t += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL;
}
- t = 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL;
- t += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL;
return t;
# else
# error "Don't know how to measure per-process CPU time. Need alternative method (times()/clocks()/gettimeofday()?)."