rm Debug::print

This commit is contained in:
James Cherry 2020-12-29 10:33:22 -08:00
parent 72aaf962c6
commit 9b1dc880f5
17 changed files with 99 additions and 103 deletions

View File

@ -486,16 +486,16 @@ ArnoldiReduce::makeRcmodelFromTs()
for (k=0;k<ts_ordN;k++) {
p = ts_pordV[k];
debugPrint3(debug_, "arnoldi", 1, "T%d,P%ld c=%s",
p->ts,p-p0,
p->ts,
p-p0,
units_->capacitanceUnit()->asString(p->c));
if (p->is_term)
debug_->print(" term%d", p->tindex);
debugPrint1(debug_, "arnoldi", 1, " term %d", p->tindex);
if (p->in_edge)
debug_->print(" from T%d,P%ld r=%s",
p->in_edge->from->ts,
p->in_edge->from-p0,
units_->resistanceUnit()->asString(p->r));
debug_->print("\n");
debugPrint3(debug_, "arnoldi", 1, " from T%d,P%ld r=%s",
p->in_edge->from->ts,
p->in_edge->from-p0,
units_->resistanceUnit()->asString(p->r));
}
for (i=0;i<nterms;i++)
debugPrint2(debug_, "arnoldi", 1, "outV[%d] = T%d", i, outV[i]);
@ -587,23 +587,25 @@ ArnoldiReduce::makeRcmodelFromTs()
}
if (debug_->check("arnoldi", 1)) {
debugPrint1(debug_, "arnoldi", 1,
"tridiagonal reduced matrix, drvr pin %s",
network_->pathName(drvr_pin_));
debugPrint2(debug_, "arnoldi", 1, "order %d n %d",order,n);
report_->reportLine("tridiagonal reduced matrix, drvr pin %s",
network_->pathName(drvr_pin_));
report_->reportLine("order %d n %d",order,n);
for (h=0;h<order;h++) {
debug_->print("d[%d] %s",
h,
units_->timeUnit()->asString(d[h]));
if (h<order-1)
debug_->print(" e[%d] %s",
h,
units_->timeUnit()->asString(e[h]));
debug_->print("\n");
debug_->print("U[%d]",h);
report_->reportLine(" d[%d] %s e[%d] %s",
h,
units_->timeUnit()->asString(d[h]),
h,
units_->timeUnit()->asString(e[h]));
else
report_->reportLine(" d[%d] %s",
h,
units_->timeUnit()->asString(d[h]));
string line = stdstrPrint("U[%d]",h);
for (i=0;i<nterms;i++)
debug_->print(" %6.2e",U[h][i]);
debug_->print("\n");
line += stdstrPrint(" %6.2e",U[h][i]);
report_->reportLine(line);
}
}
}

View File

@ -462,28 +462,29 @@ void
DmpAlg::showX()
{
for (int i = 0; i < nr_order_; i++)
debug_->print("%4s %12.3e\n", dmp_param_index_strings[i], x_[i]);
report_->reportLine("%4s %12.3e", dmp_param_index_strings[i], x_[i]);
}
void
DmpAlg::showFvec()
{
for (int i = 0; i < nr_order_; i++)
debug_->print("%4s %12.3e\n", dmp_func_index_strings[i], fvec_[i]);
report_->reportLine("%4s %12.3e", dmp_func_index_strings[i], fvec_[i]);
}
void
DmpAlg::showJacobian()
{
debug_->print(" ");
string line = " ";
for (int j = 0; j < nr_order_; j++)
debug_->print("%12s", dmp_param_index_strings[j]);
debug_->print("\n");
line += stdstrPrint("%12s", dmp_param_index_strings[j]);
report_->reportLine(line);
line.clear();
for (int i = 0; i < nr_order_; i++) {
debug_->print("%4s ", dmp_func_index_strings[i]);
line += stdstrPrint("%4s ", dmp_func_index_strings[i]);
for (int j = 0; j < nr_order_; j++)
debug_->print("%12.3e ", fjac_[i][j]);
debug_->print("\n");
line += stdstrPrint("%12.3e ", fjac_[i][j]);
report_->reportLine(line);
}
}
@ -545,12 +546,10 @@ DmpAlg::dVoDt(double t)
void
DmpAlg::showVo()
{
debug_->print(" t vo(t)\n");
report_->reportLine(" t vo(t)");
double ub = voCrossingUpperBound();
for (double t = t0_; t < t0_ + ub; t += dt_ / 10.0)
debug_->print(" %g %g\n", t, vo(t));
// debug_->print(" %.3g %.3g", t-t0_, vo(t)*3);
// debug_->print("\n");
report_->reportLine(" %g %g", t, vo(t));
}
void
@ -658,10 +657,10 @@ DmpAlg::dVlDt(double t)
void
DmpAlg::showVl()
{
debug_->print(" t vl(t)\n");
report_->reportLine(" t vl(t)");
double ub = vlCrossingUpperBound();
for (double t = t0_; t < t0_ + ub * 2.0; t += ub / 10.0)
debug_->print(" %g %g\n", t, vl(t));
report_->reportLine(" %g %g", t, vl(t));
}
void
@ -669,12 +668,12 @@ DmpAlg::fail(const char *reason)
{
// Allow only failures to be reported with a unique debug flag.
if (debug_->check("dmp_ceff", 1) || debug_->check("dmp_ceff_fail", 1))
debug_->print("delay_calc: DMP failed - %s c2=%s rpi=%s c1=%s rd=%s\n",
reason,
units_->capacitanceUnit()->asString(c2_),
units_->resistanceUnit()->asString(rpi_),
units_->capacitanceUnit()->asString(c1_),
units_->resistanceUnit()->asString(rd_));
report_->reportLine("delay_calc: DMP failed - %s c2=%s rpi=%s c1=%s rd=%s",
reason,
units_->capacitanceUnit()->asString(c2_),
units_->resistanceUnit()->asString(rpi_),
units_->capacitanceUnit()->asString(c1_),
units_->resistanceUnit()->asString(rd_));
}
////////////////////////////////////////////////////////////////
@ -1001,7 +1000,7 @@ DmpPi::evalDmpEqns()
showX();
showFvec();
showJacobian();
debug_->print(".................\n");
report_->reportLine(".................");
}
}
@ -1112,7 +1111,7 @@ DmpOnePole::evalDmpEqns()
if (debug_->check("dmp_ceff", 4)) {
showJacobian();
debug_->print(".................\n");
report_->reportLine(".................");
}
}

View File

@ -402,7 +402,7 @@ void
GraphDelayCalc1::findDelays(Level level)
{
if (arc_delay_calc_) {
Stats stats(debug_);
Stats stats(debug_, report_);
int dcalc_count = 0;
debugPrint1(debug_, "delay_calc", 1, "find delays to level %d", level);
if (!delays_seeded_) {

View File

@ -67,7 +67,7 @@ Graph::~Graph()
void
Graph::makeGraph()
{
Stats stats(debug_);
Stats stats(debug_, report_);
makeVerticesAndEdges();
makeWireEdges();
stats.report("Make graph");

View File

@ -45,9 +45,6 @@ public:
void setLevel(const char *what,
int level);
int statsLevel() const { return stats_level_; }
void print(const char *fmt,
...) const
__attribute__((format (printf, 2, 3)));
void reportLine(const char *what,
const char *fmt,
...) const

View File

@ -22,12 +22,14 @@
namespace sta {
class Debug;
class Report;
// Show run time and memory statistics if the "stats" debug flag is on.
class Stats
{
public:
explicit Stats(Debug *debug);
explicit Stats(Debug *debug,
Report *report);
void report(const char *step);
private:
@ -38,6 +40,7 @@ private:
double system_begin_;
size_t memory_begin_;
Debug *debug_;
Report *report_;
};
} // namespace

View File

@ -34,7 +34,7 @@ annotateGraphDisabledWireEdge(Pin *from_pin,
void
Sdc::annotateGraph()
{
Stats stats(debug_);
Stats stats(debug_, report_);
// All output pins are considered constrained because
// they may be downstream from a set_min/max_delay -from that
// does not have a set_output_delay.

View File

@ -194,7 +194,7 @@ void
Genclks::ensureInsertionDelays()
{
if (!found_insertion_delays_) {
Stats stats(debug_);
Stats stats(debug_, report_);
debugPrint0(debug_, "genclk", 1, "find generated clk insertion delays");
ClockSeq gclks;

View File

@ -114,7 +114,7 @@ Levelize::ensureLevelized()
void
Levelize::levelize()
{
Stats stats(debug_);
Stats stats(debug_, report_);
debugPrint0(debug_, "levelize", 1, "levelize");
max_level_ = 0;
clearLoopEdges();

View File

@ -176,10 +176,10 @@ PathEnum::findNext()
Vertex *vertex = path_end->vertex(this);
if (debug_->check("path_enum", 2)) {
Path *path = path_end->path();
debug_->print("path_enum: next path %s delay %s slack %s\n",
path->name(this),
delayAsString(path_end->dataArrivalTime(this), this),
delayAsString(path_end->slack(this), this));
report_->reportLine("path_enum: next path %s delay %s slack %s",
path->name(this),
delayAsString(path_end->dataArrivalTime(this), this),
delayAsString(path_end->slack(this), this));
reportDiversionPath(div);
}
@ -211,10 +211,10 @@ PathEnum::reportDiversionPath(Diversion *div)
path->prevPath(this, p);
Path *after_div = div->divPath();
while (!p.isNull()) {
debug_->print("path_enum: %s %s%s\n",
p.name(this),
delayAsString(p.arrival(this), this),
Path::equal(&p, after_div, this) ? " <-diversion" : "");
report_->reportLine("path_enum: %s %s%s",
p.name(this),
delayAsString(p.arrival(this), this),
Path::equal(&p, after_div, this) ? " <-diversion" : "");
if (network_->isLatchData(p.pin(this)))
break;
p.prevPath(this, p);
@ -387,6 +387,7 @@ PathEnumFaninVisitor::reportDiversion(TimingArc *div_arc,
{
Debug *debug = sta_->debug();
if (debug->check("path_enum", 3)) {
Report *report = sta_->report();
Path *path = path_end_->path();
const PathAnalysisPt *path_ap = path->pathAnalysisPt(sta_);
Arrival path_delay = path_enum_->cmp_slack_
@ -397,16 +398,16 @@ PathEnumFaninVisitor::reportDiversion(TimingArc *div_arc,
div_arc, path_ap);
PathRef div_prev;
before_div_.prevPath(sta_, div_prev);
debug->print("path_enum: diversion %s %s %s -> %s\n",
path->name(sta_),
path_enum_->cmp_slack_ ? "slack" : "delay",
delayAsString(path_delay, sta_),
delayAsString(div_delay, sta_));
debug->print("path_enum: from %s -> %s\n",
div_prev.name(sta_),
before_div_.name(sta_));
debug->print("path_enum: to %s ->\n",
after_div->name(sta_));
report->reportLine("path_enum: diversion %s %s %s -> %s",
path->name(sta_),
path_enum_->cmp_slack_ ? "slack" : "delay",
delayAsString(path_delay, sta_),
delayAsString(div_delay, sta_));
report->reportLine("path_enum: from %s -> %s",
div_prev.name(sta_),
before_div_.name(sta_));
report->reportLine("path_enum: to %s ->e",
after_div->name(sta_));
}
}

View File

@ -490,7 +490,7 @@ PathGroups::makePathEnds(ExceptionTo *to,
const MinMaxAll *min_max,
bool sort_by_slack)
{
Stats stats(this->debug());
Stats stats(debug_, report_);
makeGroupPathEnds(to, group_count_, endpoint_count_, unique_pins_,
corner, min_max);

View File

@ -783,7 +783,7 @@ Search::findClkArrivals()
{
if (!clk_arrivals_valid_) {
genclks_->ensureInsertionDelays();
Stats stats(debug_);
Stats stats(debug_, report_);
debugPrint0(debug_, "search", 1, "find clk arrivals");
arrival_iter_->clear();
seedClkVertexArrivals();
@ -960,7 +960,7 @@ Search::findArrivals(Level level,
{
debugPrint1(debug_, "search", 1, "find arrivals to level %d", level);
findArrivals1();
Stats stats(debug_);
Stats stats(debug_, report_);
int arrival_count = arrival_iter_->visitParallel(level, arrival_visitor);
stats.report("Find arrivals");
if (arrival_iter_->empty()
@ -3070,7 +3070,7 @@ Search::findRequireds()
void
Search::findRequireds(Level level)
{
Stats stats(debug_);
Stats stats(debug_, report_);
debugPrint1(debug_, "search", 1, "find requireds to level %d", level);
RequiredVisitor req_visitor(this);
if (!requireds_seeded_)
@ -3118,7 +3118,8 @@ Search::endpoints()
else {
if (debug_->check("endpoint", 2)
&& endpoints_->hasKey(vertex))
debug_->print("endpoint: remove %s\n", vertex->name(sdc_network_));
report_->reportLine("endpoint: remove %s",
vertex->name(sdc_network_));
endpoints_->erase(vertex);
}
}

View File

@ -539,7 +539,7 @@ void
Sim::ensureConstantsPropagated()
{
if (!valid_) {
Stats stats(debug_);
Stats stats(debug_, report_);
ensureConstantFuncPins();
instances_to_annotate_.clear();
if (incremental_) {

View File

@ -642,7 +642,7 @@ Sta::readLiberty(const char *filename,
const MinMaxAll *min_max,
bool infer_latches)
{
Stats stats(debug_);
Stats stats(debug_, report_);
LibertyLibrary *library = readLibertyFile(filename, corner, min_max,
infer_latches, network_);
if (library
@ -726,7 +726,7 @@ bool
Sta::linkDesign(const char *top_cell_name)
{
clear();
Stats stats(debug_);
Stats stats(debug_, report_);
bool status = network_->linkNetwork(top_cell_name,
link_make_black_boxes_,
report_);

View File

@ -102,16 +102,6 @@ Debug::setLevel(const char *what,
}
}
void
Debug::print(const char *fmt,
...) const
{
va_list args;
va_start(args, fmt);
report_->vprint(fmt, args);
va_end(args);
}
void
Debug::reportLine(const char *what,
const char *fmt,

View File

@ -18,12 +18,15 @@
#include "Machine.hh"
#include "StringUtil.hh"
#include "Report.hh"
#include "Debug.hh"
namespace sta {
Stats::Stats(Debug *debug) :
debug_(debug)
Stats::Stats(Debug *debug,
Report *report) :
debug_(debug),
report_(report)
{
if (debug->statsLevel() > 0) {
elapsed_begin_ = elapsedRunTime();
@ -42,11 +45,11 @@ Stats::report(const char *step)
double memory_begin = static_cast<double>(memory_begin_);
double memory_end = static_cast<double>(memoryUsage());
double memory_delta = memory_end - memory_begin;
debug_->print("stats: %5.1f/%5.1fe %5.1f/%5.1fu %5.1f/%5.1fMB %s\n",
elapsed_end - elapsed_begin_, elapsed_end,
user_end - user_begin_, user_end,
memory_delta * 1e-6, memory_end * 1e-6,
step);
report_->reportLine("stats: %5.1f/%5.1fe %5.1f/%5.1fu %5.1f/%5.1fMB %s",
elapsed_end - elapsed_begin_, elapsed_end,
user_end - user_begin_, user_end,
memory_delta * 1e-6, memory_end * 1e-6,
step);
}
}

View File

@ -183,7 +183,7 @@ VerilogReader::read(const char *filename)
// Use zlib to uncompress gzip'd files automagically.
stream_ = gzopen(filename, "rb");
if (stream_) {
Stats stats(debug_);
Stats stats(debug_, report_);
init(filename);
bool success = (::VerilogParse_parse() == 0);
gzclose(stream_);
@ -682,20 +682,20 @@ VerilogReader::incrLine()
}
#define printClassMemory(name, class_name, count) \
debug_->print(" %-20s %9d * %3d = %6.1fMb\n", \
name, \
count, \
static_cast<int>(sizeof(class_name)), \
(count * sizeof(class_name) * 1e-6))
report_->reportLine(" %-20s %9d * %3d = %6.1fMb\n", \
name, \
count, \
static_cast<int>(sizeof(class_name)), \
(count * sizeof(class_name) * 1e-6))
#define printStringMemory(name, count) \
debug_->print(" %-20s %6.1fMb\n", name, count * 1e-6)
report_->reportLine(" %-20s %6.1fMb", name, count * 1e-6)
void
VerilogReader::reportStmtCounts()
{
if (debugCheck(debug_, "verilog", 1)) {
debug_->print("Verilog stats\n");
report_->reportLine("Verilog stats");
printClassMemory("modules", VerilogModule, module_count_);
printClassMemory("module insts", VerilogModuleInst, inst_mod_count_);
printClassMemory("liberty insts", VerilogLibertyInst, inst_lib_count_);