diff --git a/src/sysc/scc/configurable_tracer.cpp b/src/sysc/scc/configurable_tracer.cpp index da56b966..4be06ef8 100644 --- a/src/sysc/scc/configurable_tracer.cpp +++ b/src/sysc/scc/configurable_tracer.cpp @@ -16,7 +16,8 @@ #include "configurable_tracer.h" #include "traceable.h" - +#include +#include using namespace sc_core; using namespace scc; @@ -54,6 +55,7 @@ void configurable_tracer::descend(const sc_core::sc_object* obj, bool trace) { descend(o, trace); return; } else if(kind == "sc_module") { + auto module_name = obj->name(); auto trace_enable = get_trace_enabled(obj, default_trace_enable_handle.get_cci_value().get()); if(trace_enable) obj->trace(trf); diff --git a/src/sysc/scc/configurer.cpp b/src/sysc/scc/configurer.cpp index 5cbc0f51..7d1aa87e 100644 --- a/src/sysc/scc/configurer.cpp +++ b/src/sysc/scc/configurer.cpp @@ -643,13 +643,18 @@ void mirror_sc_attributes(configurer::broker_t& broker, configurer::cci_param_cl } bool cci_name_ignore(std::pair const& preset_value) { - std::string ending(SCC_LOG_LEVEL_PARAM_NAME); auto& name = preset_value.first; - if(name.length() >= ending.length()) { - return (0 == name.compare(name.length() - ending.length(), ending.length(), ending)); - } else { + if(name.length() < SCC_LOG_LEVEL_PARAM_NAME_LEN) // name is to short to hold the log level return false; - } + size_t dot = name.find_last_of("."); + if(dot == std::string::npos) + return name == SCC_LOG_LEVEL_PARAM_NAME; + if(name.substr(dot, name.size() - dot).compare(SCC_LOG_LEVEL_PARAM_NAME) != 0) + // the parameter name is not SCC_LOG_LEVEL_PARAM_NAME + return false; + std::string module_name = name.substr(0, dot); + // ignore the SCC_LOG_LEVEL_PARAM_NAME preset if module exists + return sc_core::sc_find_object(name.c_str()) != nullptr; } } // namespace #ifdef HAS_YAMPCPP diff --git a/src/sysc/scc/report.cpp b/src/sysc/scc/report.cpp index 7ed8ba77..4a859e4a 100644 --- a/src/sysc/scc/report.cpp +++ b/src/sysc/scc/report.cpp @@ -75,7 +75,7 @@ struct char_hash { }; static class { std::unordered_map table; - std::vector cache; + std::deque cache; std::mutex mtx; public: @@ -89,7 +89,7 @@ static class { } void insert(char const* key, sc_core::sc_verbosity verb) { std::lock_guard lock(mtx); - cache.push_back(key); + cache.emplace_back(key); table.insert({cache.back().c_str(), verb}); } void clear() { diff --git a/src/sysc/scc/report.h b/src/sysc/scc/report.h index 61af3846..1a0367a0 100644 --- a/src/sysc/scc/report.h +++ b/src/sysc/scc/report.h @@ -76,6 +76,8 @@ writing. By default spdlog logs asyncronously to keep the performance impact low */ //! the name of the CCI property to attach to modules to control logging of this module #define SCC_LOG_LEVEL_PARAM_NAME "log_level" +#define SCC_LOG_LEVEL_PARAM_NAME_LEN 9 + /** \ingroup scc-sysc * @{ */