mirror of https://github.com/YosysHQ/yosys.git
dump runtime information for passes to json
This commit is contained in:
parent
8e640663d6
commit
7e92e80741
|
@ -210,6 +210,7 @@ int main(int argc, char **argv)
|
||||||
std::string scriptfile = "";
|
std::string scriptfile = "";
|
||||||
std::string depsfile = "";
|
std::string depsfile = "";
|
||||||
std::string topmodule = "";
|
std::string topmodule = "";
|
||||||
|
std::string perffile = "";
|
||||||
bool scriptfile_tcl = false;
|
bool scriptfile_tcl = false;
|
||||||
bool print_banner = true;
|
bool print_banner = true;
|
||||||
bool print_stats = true;
|
bool print_stats = true;
|
||||||
|
@ -353,7 +354,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "MXAQTVSgm:f:Hh:b:o:p:l:L:qv:tds:c:W:w:e:r:D:P:E:x:")) != -1)
|
while ((opt = getopt(argc, argv, "MXAQTVSgm:f:Hh:b:o:p:l:L:qv:tds:c:W:w:e:r:D:P:E:x:B:")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
@ -488,6 +489,9 @@ int main(int argc, char **argv)
|
||||||
case 'x':
|
case 'x':
|
||||||
log_experimentals_ignored.insert(optarg);
|
log_experimentals_ignored.insert(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'B':
|
||||||
|
perffile = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Run '%s -h' for help.\n", argv[0]);
|
fprintf(stderr, "Run '%s -h' for help.\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -674,6 +678,29 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
log("%s\n", out_count ? "" : " no commands executed");
|
log("%s\n", out_count ? "" : " no commands executed");
|
||||||
}
|
}
|
||||||
|
if(!perffile.empty())
|
||||||
|
{
|
||||||
|
FILE *f = fopen(perffile.c_str(), "wt");
|
||||||
|
if (f == nullptr)
|
||||||
|
log_error("Can't open performance log file for writing: %s\n", strerror(errno));
|
||||||
|
|
||||||
|
fprintf(f, "{\n");
|
||||||
|
fprintf(f, " \"generator\": \"%s\",\n", yosys_version_str);
|
||||||
|
fprintf(f, " \"total_ns\": %lu,\n", total_ns);
|
||||||
|
fprintf(f, " \"passes\": {");
|
||||||
|
|
||||||
|
bool first = true;
|
||||||
|
for (auto it = timedat.rbegin(); it != timedat.rend(); it++) {
|
||||||
|
if (!first)
|
||||||
|
fprintf(f, ",");
|
||||||
|
fprintf(f, "\n \"%s\": {\n", std::get<2>(*it).c_str());
|
||||||
|
fprintf(f, " \"runtime_ns\": %lu,\n", std::get<0>(*it));
|
||||||
|
fprintf(f, " \"num_calls\": %u\n", std::get<1>(*it));
|
||||||
|
fprintf(f, " }");
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
fprintf(f, "\n }\n}\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(YOSYS_ENABLE_COVER) && (defined(__linux__) || defined(__FreeBSD__))
|
#if defined(YOSYS_ENABLE_COVER) && (defined(__linux__) || defined(__FreeBSD__))
|
||||||
|
|
Loading…
Reference in New Issue