From 611a98165dd883e08c10d958dfeccd80245f23e4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 23 Sep 2018 17:49:10 +0200 Subject: [PATCH] WIP: diagnostic output --- .../tools/netx/db_plugin/dbHierProcessor.cc | 35 +++++++++++++++++-- .../tools/netx/db_plugin/dbHierProcessor.h | 13 +++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc b/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc index 9f8948a1e..1e040b3b1 100644 --- a/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc +++ b/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc @@ -28,6 +28,8 @@ #include "dbEdgeProcessor.h" #include "dbPolygonGenerators.h" #include "tlLog.h" +#include "tlTimer.h" +#include "tlInternational.h" namespace db { @@ -76,6 +78,12 @@ BoolAndOrNotLocalOperation::on_empty_intruder_hint () const return m_is_and ? LocalOperation::Drop : LocalOperation::Copy; } +std::string +BoolAndOrNotLocalOperation::description () const +{ + return m_is_and ? tl::to_string (tr ("AND operation")) : tl::to_string (tr ("NOT operation")); +} + void BoolAndOrNotLocalOperation::compute_local (db::Layout *layout, const std::map > &interactions, std::set &result) const { @@ -192,8 +200,16 @@ LocalProcessorCellContexts::compute_results (db::Cell *cell, LocalProcessor *pro bool first = true; std::set common; + int index = 0; + int total = int (m_contexts.size ()); for (std::map::iterator c = m_contexts.begin (); c != m_contexts.end (); ++c) { + ++index; + + if (tl::verbosity () >= 30) { + tl::log << tr ("Computing local results for ") << cell->layout ()->cell_name (cell->cell_index ()) << " (context " << index << "/" << total << ")"; + } + if (first) { common = c->second.propagated (); @@ -453,7 +469,7 @@ private: LocalProcessor::LocalProcessor (db::Layout *layout, db::Cell *top, LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, unsigned int output_layer) : mp_layout (layout), mp_top (top), m_subject_layer (subject_layer), m_intruder_layer (intruder_layer), m_output_layer (output_layer), mp_op (op) { - // .. nothing yet .. + set_description (op->description ()); } void LocalProcessor::run () @@ -471,6 +487,8 @@ void LocalProcessor::push_results (db::Cell *cell, const std::set= 21, tl::to_string (tr ("Computing contexts for ")) + description ()); + m_contexts_per_cell.clear (); std::pair, std::set > intruders; @@ -479,6 +497,14 @@ void LocalProcessor::compute_contexts () void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_context, db::Cell *parent, db::Cell *cell, const db::ICplxTrans &cell_inst, const std::pair, std::set > &intruders) { + if (tl::verbosity () >= 30) { + if (! parent) { + tl::log << tr ("Computing context for top cell ") << mp_layout->cell_name (cell->cell_index ()); + } else { + tl::log << tr ("Computing context for ") << mp_layout->cell_name (parent->cell_index ()) << " -> " << mp_layout->cell_name (cell->cell_index ()) << " @" << cell_inst.to_string (); + } + } + db::LocalProcessorCellContexts &contexts = m_contexts_per_cell [cell]; db::LocalProcessorCellContext *context = contexts.find_context (intruders); @@ -585,6 +611,12 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con void LocalProcessor::compute_results () { + tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Computing results for ")) + description ()); + + // avoids updates while we work on the layout + mp_layout->update (); + db::LayoutLocker locker (mp_layout); + for (db::Layout::bottom_up_const_iterator bu = mp_layout->begin_bottom_up (); bu != mp_layout->end_bottom_up (); ++bu) { contexts_per_cell_type::iterator cpc = m_contexts_per_cell.find (&mp_layout->cell (*bu)); @@ -594,7 +626,6 @@ LocalProcessor::compute_results () } } - } void diff --git a/src/plugins/tools/netx/db_plugin/dbHierProcessor.h b/src/plugins/tools/netx/db_plugin/dbHierProcessor.h index c97a2d7c3..47d1e2478 100644 --- a/src/plugins/tools/netx/db_plugin/dbHierProcessor.h +++ b/src/plugins/tools/netx/db_plugin/dbHierProcessor.h @@ -50,6 +50,7 @@ public: virtual void compute_local (db::Layout *layout, const std::map > &interactions, std::set &result) const = 0; virtual on_empty_intruder_mode on_empty_intruder_hint () const = 0; + virtual std::string description () const = 0; }; class DB_PLUGIN_PUBLIC BoolAndOrNotLocalOperation @@ -60,6 +61,7 @@ public: virtual void compute_local (db::Layout *layout, const std::map > &interactions, std::set &result) const; virtual on_empty_intruder_mode on_empty_intruder_hint () const; + virtual std::string description () const; private: bool m_is_and; @@ -147,6 +149,16 @@ public: return m_contexts_per_cell; } + void set_description (const std::string &d) + { + m_description = d; + } + + const std::string &description () const + { + return m_description; + } + private: friend class LocalProcessorCellContexts; @@ -155,6 +167,7 @@ private: unsigned int m_subject_layer, m_intruder_layer, m_output_layer; contexts_per_cell_type m_contexts_per_cell; LocalOperation *mp_op; + std::string m_description; void compute_contexts (db::LocalProcessorCellContext *parent_context, db::Cell *parent, db::Cell *cell, const db::ICplxTrans &cell_inst, const std::pair, std::set > &intruders); void push_results (db::Cell *cell, const std::set &result);