3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 09:05:32 +00:00

log, qbfsat: Include child process time in PerformanceTimer::query() and report the time for each call to the QBF-SAT solver.

This commit is contained in:
Alberto Gonzalez 2020-06-07 07:45:24 +00:00
parent 62a9e62a1b
commit a564cc806f
No known key found for this signature in database
GPG key ID: 8395A8BA109708B2
2 changed files with 14 additions and 7 deletions

View file

@ -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()?)."