summaryrefslogtreecommitdiff
path: root/kernel/driver.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/driver.cc')
-rw-r--r--kernel/driver.cc68
1 files changed, 37 insertions, 31 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc
index 273be7ce..6f976423 100644
--- a/kernel/driver.cc
+++ b/kernel/driver.cc
@@ -18,6 +18,7 @@
*/
#include "kernel/yosys.h"
+#include "libs/sha1/sha1.h"
#include <readline/readline.h>
#include <readline/history.h>
@@ -233,6 +234,9 @@ int main(int argc, char **argv)
log("\n");
}
+ if (print_stats)
+ log_hasher = new SHA1;
+
yosys_setup();
if (optind == argc && passes_commands.size() == 0 && scriptfile.empty()) {
@@ -262,43 +266,18 @@ int main(int argc, char **argv)
if (!backend_command.empty())
run_backend(output_filename, backend_command, yosys_design);
- delete yosys_design;
- yosys_design = NULL;
-
-#ifdef COVER_ACTIVE
- if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
- {
- char filename_buffer[4096];
- FILE *f;
-
- if (getenv("YOSYS_COVER_DIR")) {
- snprintf(filename_buffer, 4096, "%s/yosys_cover_%d_XXXXXX.txt", getenv("YOSYS_COVER_DIR"), getpid());
- f = fdopen(mkstemps(filename_buffer, 4), "w");
- } else {
- snprintf(filename_buffer, 4096, "%s", getenv("YOSYS_COVER_FILE"));
- f = fopen(filename_buffer, "a+");
- }
-
- if (f == NULL)
- log_error("Can't create coverage file `%s'.\n", filename_buffer);
-
- log("<writing coverage file \"%s\">\n", filename_buffer);
-
- for (auto &it : get_coverage_data())
- fprintf(f, "%-60s %10d %s\n", it.second.first.c_str(), it.second.second, it.first.c_str());
-
- fclose(f);
- }
-#endif
-
if (print_stats)
{
+ std::string hash = log_hasher->final().substr(0, 10);
+ delete log_hasher;
+ log_hasher = nullptr;
+
struct rusage ru_buffer;
getrusage(RUSAGE_SELF, &ru_buffer);
- log("\nEnd of script. Logfile hash: xxxxxxxxxx, CPU: user %.2fs system %.2fs\n",
+ log("\nEnd of script. Logfile hash: %s, CPU: user %.2fs system %.2fs\n", hash.c_str(),
ru_buffer.ru_utime.tv_sec + 1e-6 * ru_buffer.ru_utime.tv_usec,
ru_buffer.ru_stime.tv_sec + 1e-6 * ru_buffer.ru_stime.tv_usec);
- log("%s\nTime spent:", yosys_version_str);
+ log("%s\n", yosys_version_str);
int64_t total_ns = 0;
std::set<std::tuple<int64_t, int, std::string>> timedat;
@@ -310,6 +289,7 @@ int main(int argc, char **argv)
}
int out_count = 0;
+ log("Time spent:");
for (auto it = timedat.rbegin(); it != timedat.rend() && out_count < 4; it++, out_count++) {
if (out_count >= 2 && (std::get<0>(*it) < 1000000000 || int(100*std::get<0>(*it) / total_ns) < 20)) {
log(", ...");
@@ -321,6 +301,32 @@ int main(int argc, char **argv)
log("%s\n", out_count ? "" : " no commands executed");
}
+#ifdef COVER_ACTIVE
+ if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
+ {
+ char filename_buffer[4096];
+ FILE *f;
+
+ if (getenv("YOSYS_COVER_DIR")) {
+ snprintf(filename_buffer, 4096, "%s/yosys_cover_%d_XXXXXX.txt", getenv("YOSYS_COVER_DIR"), getpid());
+ f = fdopen(mkstemps(filename_buffer, 4), "w");
+ } else {
+ snprintf(filename_buffer, 4096, "%s", getenv("YOSYS_COVER_FILE"));
+ f = fopen(filename_buffer, "a+");
+ }
+
+ if (f == NULL)
+ log_error("Can't create coverage file `%s'.\n", filename_buffer);
+
+ log("<writing coverage file \"%s\">\n", filename_buffer);
+
+ for (auto &it : get_coverage_data())
+ fprintf(f, "%-60s %10d %s\n", it.second.first.c_str(), it.second.second, it.first.c_str());
+
+ fclose(f);
+ }
+#endif
+
if (call_abort)
abort();