Skip to content

Commit

Permalink
rename SG_GCDEBUG to SG_TRACE
Browse files Browse the repository at this point in the history
change some of the debug messages to trace messages as
they are obviously trace level logs
  • Loading branch information
vigsterkr committed Oct 23, 2019
1 parent 7002c57 commit 40f40f0
Show file tree
Hide file tree
Showing 62 changed files with 320 additions and 327 deletions.
21 changes: 9 additions & 12 deletions src/shogun/base/SGObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ CSGObject::CSGObject() : self(), param_obs_list()
init();
m_refcount = new RefCount(0);

SG_GCDEBUG("SGObject created ({})", fmt::ptr(this))
SG_TRACE("SGObject created ({})", fmt::ptr(this));
}

CSGObject::CSGObject(const CSGObject& orig)
Expand All @@ -234,12 +234,12 @@ CSGObject::CSGObject(const CSGObject& orig)
init();
m_refcount = new RefCount(0);

SG_GCDEBUG("SGObject copied ({})", fmt::ptr(this))
SG_TRACE("SGObject copied ({})", fmt::ptr(this));
}

CSGObject::~CSGObject()
{
SG_GCDEBUG("SGObject destroyed ({})", fmt::ptr(this))
SG_TRACE("SGObject destroyed ({})", fmt::ptr(this));

delete m_parameters;
delete m_model_selection_parameters;
Expand All @@ -253,14 +253,14 @@ CSGObject::~CSGObject()
int32_t CSGObject::ref()
{
int32_t count = m_refcount->ref();
SG_GCDEBUG("ref() refcount {} obj {} ({}) increased", count, this->get_name(), fmt::ptr(this))
SG_TRACE("ref() refcount {} obj {} ({}) increased", count, this->get_name(), fmt::ptr(this));
return m_refcount->ref_count();
}

int32_t CSGObject::ref_count()
{
int32_t count = m_refcount->ref_count();
SG_GCDEBUG("ref_count(): refcount {}, obj {} ({})", count, this->get_name(), fmt::ptr(this))
SG_TRACE("ref_count(): refcount {}, obj {} ({})", count, this->get_name(), fmt::ptr(this));
return m_refcount->ref_count();
}

Expand All @@ -269,13 +269,13 @@ int32_t CSGObject::unref()
int32_t count = m_refcount->unref();
if (count<=0)
{
SG_GCDEBUG("unref() refcount {}, obj {} ({}) destroying", count, this->get_name(), fmt::ptr(this))
SG_TRACE("unref() refcount {}, obj {} ({}) destroying", count, this->get_name(), fmt::ptr(this));
delete this;
return 0;
}
else
{
SG_GCDEBUG("unref() refcount {} obj {} ({}) decreased", count, this->get_name(), fmt::ptr(this))
SG_TRACE("unref() refcount {} obj {} ({}) decreased", count, this->get_name(), fmt::ptr(this));
return m_refcount->ref_count();
}
}
Expand All @@ -294,18 +294,15 @@ CSGObject * CSGObject::deep_copy() const

void CSGObject::update_parameter_hash() const
{
SG_DEBUG("entering")
SG_TRACE("entering");

m_hash = hash();

SG_DEBUG("leaving")
SG_TRACE("leaving");
}

bool CSGObject::parameter_hash_changed() const
{
SG_DEBUG("entering")

SG_DEBUG("leaving")
return (m_hash!=hash());
}

Expand Down
6 changes: 5 additions & 1 deletion src/shogun/base/ShogunEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ void ShogunEnv::init_from_env()
env_log_val = getenv("SHOGUN_LOG_LEVEL");
if (env_log_val)
{
if (strncmp(env_log_val, "DEBUG", 5) == 0)
if (strncmp(env_log_val, "TRACE", 5) == 0)
sg_io->set_loglevel(io::MSG_TRACE);
else if (strncmp(env_log_val, "DEBUG", 5) == 0)
sg_io->set_loglevel(io::MSG_DEBUG);
else if (strncmp(env_log_val, "INFO", 4) == 0)
sg_io->set_loglevel(io::MSG_INFO);
else if (strncmp(env_log_val, "WARN", 4) == 0)
sg_io->set_loglevel(io::MSG_WARN);
else if (strncmp(env_log_val, "ERROR", 5) == 0)
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/distributions/Gaussian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void CGaussian::decompose_cov(SGMatrix<float64_t> cov)

SGVector<float64_t> CGaussian::sample()
{
SG_DEBUG("Entering");
SG_TRACE("Entering");
SGMatrix<float64_t> r_matrix(m_mean.vlen, m_mean.vlen);
r_matrix.zero();

Expand Down Expand Up @@ -435,7 +435,7 @@ SGVector<float64_t> CGaussian::sample()
for (int32_t i = 0; i < m_mean.vlen; i++)
samp.vector[i] += m_mean.vector[i];

SG_DEBUG("Leaving");
SG_TRACE("Leaving");
return samp;
}

Expand Down
10 changes: 5 additions & 5 deletions src/shogun/evaluation/CrossValidation.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Heiko Strathmann, Soeren Sonnenburg, Giovanni De Toni,
* Sergey Lisitsyn, Saurabh Mahindre, Jacob Walker, Viktor Gal,
* Authors: Heiko Strathmann, Soeren Sonnenburg, Giovanni De Toni,
* Sergey Lisitsyn, Saurabh Mahindre, Jacob Walker, Viktor Gal,
* Leon Kuchenbecker
*/

Expand Down Expand Up @@ -59,7 +59,7 @@ CEvaluationResult* CCrossValidation::evaluate_impl() const
SGVector<float64_t> results(m_num_runs);

/* perform all the x-val runs */
SG_DEBUG("starting {} runs of cross-validation", m_num_runs)
SG_DEBUG("starting {} runs of cross-validation", m_num_runs);
for (auto i : SG_PROGRESS(range(m_num_runs)))
{
results[i] = evaluate_one_run(i);
Expand Down Expand Up @@ -88,7 +88,7 @@ void CCrossValidation::set_num_runs(int32_t num_runs)

float64_t CCrossValidation::evaluate_one_run(int64_t index) const
{
SG_DEBUG("entering {}::evaluate_one_run()", get_name())
SG_TRACE("entering {}::evaluate_one_run()", get_name());
index_t num_subsets = m_splitting_strategy->get_num_subsets();

SG_DEBUG("building index sets for {}-fold cross-validation", num_subsets)
Expand Down Expand Up @@ -142,6 +142,6 @@ float64_t CCrossValidation::evaluate_one_run(int64_t index) const
/* build arithmetic mean of results */
float64_t mean = CStatistics::mean(results);

SG_DEBUG("leaving {}::evaluate_one_run()", get_name())
SG_TRACE("leaving {}::evaluate_one_run()", get_name());
return mean;
}
4 changes: 2 additions & 2 deletions src/shogun/evaluation/MachineEvaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void CMachineEvaluation::init()

CEvaluationResult* CMachineEvaluation::evaluate() const
{
SG_DEBUG("entering {}::evaluate()", get_name())
SG_TRACE("entering {}::evaluate()", get_name());

require(
m_machine, "{}::evaluate() is only possible if a machine is "
Expand All @@ -107,7 +107,7 @@ CEvaluationResult* CMachineEvaluation::evaluate() const

CEvaluationResult* result = evaluate_impl();

SG_DEBUG("leaving {}::evaluate()", get_name())
SG_TRACE("leaving {}::evaluate()", get_name());
return result;
};

Expand Down
16 changes: 8 additions & 8 deletions src/shogun/features/CombinedFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ CFeatures* CCombinedFeatures::create_merged_copy(CFeatures* other) const
{
/* TODO, if all features are the same, only one copy should be created
* in memory */
SG_DEBUG("entering {}::create_merged_copy()", get_name())
SG_TRACE("entering {}::create_merged_copy()", get_name());
if (get_feature_type()!=other->get_feature_type() ||
get_feature_class()!=other->get_feature_class() ||
strcmp(get_name(), other->get_name()))
Expand Down Expand Up @@ -209,13 +209,13 @@ CFeatures* CCombinedFeatures::create_merged_copy(CFeatures* other) const
SG_UNREF(current_other);
}

SG_DEBUG("leaving {}::create_merged_copy()", get_name())
SG_TRACE("leaving {}::create_merged_copy()", get_name());
return result;
}

void CCombinedFeatures::add_subset(SGVector<index_t> subset)
{
SG_DEBUG("entering {}::add_subset()", get_name())
SG_TRACE("entering {}::add_subset()", get_name());
CSet<CFeatures*>* processed=new CSet<CFeatures*>();

for (index_t f_idx=0; f_idx<get_num_feature_obj(); f_idx++)
Expand All @@ -238,12 +238,12 @@ void CCombinedFeatures::add_subset(SGVector<index_t> subset)

subset_changed_post();
SG_UNREF(processed);
SG_DEBUG("leaving {}::add_subset()", get_name())
SG_TRACE("leaving {}::add_subset()", get_name());
}

void CCombinedFeatures::remove_subset()
{
SG_DEBUG("entering {}::remove_subset()", get_name())
SG_TRACE("entering {}::remove_subset()", get_name());
CSet<CFeatures*>* processed=new CSet<CFeatures*>();

for (index_t f_idx=0; f_idx<get_num_feature_obj(); f_idx++)
Expand All @@ -265,12 +265,12 @@ void CCombinedFeatures::remove_subset()

subset_changed_post();
SG_UNREF(processed);
SG_DEBUG("leaving {}::remove_subset()", get_name())
SG_TRACE("leaving {}::remove_subset()", get_name());
}

void CCombinedFeatures::remove_all_subsets()
{
SG_DEBUG("entering {}::remove_all_subsets()", get_name())
SG_TRACE("entering {}::remove_all_subsets()", get_name());
CSet<CFeatures*>* processed=new CSet<CFeatures*>();

for (index_t f_idx=0; f_idx<get_num_feature_obj(); f_idx++)
Expand All @@ -292,7 +292,7 @@ void CCombinedFeatures::remove_all_subsets()

subset_changed_post();
SG_UNREF(processed);
SG_DEBUG("leaving {}::remove_all_subsets()", get_name())
SG_TRACE("leaving {}::remove_all_subsets()", get_name());
}

CFeatures* CCombinedFeatures::copy_subset(SGVector<index_t> indices) const
Expand Down
8 changes: 4 additions & 4 deletions src/shogun/features/DenseFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ template<class ST> CFeatures* CDenseFeatures<ST>::copy_subset(SGVector<index_t>
template<class ST>
CFeatures* CDenseFeatures<ST>::copy_dimension_subset(SGVector<index_t> dims) const
{
SG_DEBUG("Entering!");
SG_TRACE("Entering!");

// sanity checks
index_t max=CMath::max(dims.vector, dims.vlen);
Expand All @@ -564,7 +564,7 @@ CFeatures* CDenseFeatures<ST>::copy_dimension_subset(SGVector<index_t> dims) con
CFeatures* result=new CDenseFeatures(feature_matrix_copy);
SG_REF(result);

SG_DEBUG("Leaving!");
SG_TRACE("Leaving!");
return result;
}

Expand Down Expand Up @@ -676,7 +676,7 @@ template<class ST> bool CDenseFeatures<ST>::is_equal(CDenseFeatures* rhs)
template <class ST>
CFeatures* CDenseFeatures<ST>::create_merged_copy(CList* others) const
{
SG_DEBUG("Entering.");
SG_TRACE("Entering.");

require(others!=nullptr, "The list of other feature instances is not initialized!");

Expand Down Expand Up @@ -723,7 +723,7 @@ CFeatures* CDenseFeatures<ST>::create_merged_copy(CList* others) const

auto result=new CDenseFeatures<ST>(data);

SG_DEBUG("Leaving.");
SG_TRACE("Leaving.");
return result;
}

Expand Down
8 changes: 4 additions & 4 deletions src/shogun/features/RandomKitchenSinksDotFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ float64_t CRandomKitchenSinksDotFeatures::dot(int32_t vec_idx1, CDotFeatures* df
float64_t CRandomKitchenSinksDotFeatures::dot(
int32_t vec_idx1, const SGVector<float64_t>& vec2) const
{
SG_DEBUG("entering dense_dot()");
SG_TRACE("entering dense_dot()");
ASSERT(vec2.size() == get_dim_feature_space());

float64_t dot_product = 0;
Expand All @@ -116,14 +116,14 @@ float64_t CRandomKitchenSinksDotFeatures::dot(
tmp_dot = post_dot(tmp_dot, i);
dot_product += tmp_dot * vec2[i];
}
SG_DEBUG("Leaving dense_dot()");
SG_TRACE("Leaving dense_dot()");
return dot_product;
}

void CRandomKitchenSinksDotFeatures::add_to_dense_vec(float64_t alpha,
int32_t vec_idx1, float64_t* vec2, int32_t vec2_len, bool abs_val) const
{
SG_DEBUG("Entering add_to_dense()");
SG_TRACE("Entering add_to_dense()");
ASSERT(vec2_len == get_dim_feature_space());

for (index_t i=0; i<num_samples; i++)
Expand All @@ -135,7 +135,7 @@ void CRandomKitchenSinksDotFeatures::add_to_dense_vec(float64_t alpha,
else
vec2[i] += alpha * tmp_dot;
}
SG_DEBUG("Leaving add_to_dense()");
SG_TRACE("Leaving add_to_dense()");
}

int32_t CRandomKitchenSinksDotFeatures::get_nnz_features_for_vector(int32_t num) const
Expand Down
12 changes: 6 additions & 6 deletions src/shogun/features/streaming/StreamingDenseFeatures.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Heiko Strathmann, Soeren Sonnenburg, Soumyajit De, Viktor Gal,
* Authors: Heiko Strathmann, Soeren Sonnenburg, Soumyajit De, Viktor Gal,
* Vladislav Horbatiuk, Weijie Lin, Sergey Lisitsyn, Sanuj Sharma
*/

Expand Down Expand Up @@ -52,11 +52,11 @@ template<class T> CStreamingDenseFeatures<T>::CStreamingDenseFeatures(

template<class T> CStreamingDenseFeatures<T>::~CStreamingDenseFeatures()
{
SG_DEBUG("entering {}::~CStreamingDenseFeatures()", get_name())
SG_TRACE("entering {}::~CStreamingDenseFeatures()", get_name());
/* needed to prevent double free memory errors */
current_vector.vector=NULL;
current_vector.vlen=0;
SG_DEBUG("leaving {}::~CStreamingDenseFeatures()", get_name())
SG_TRACE("leaving {}::~CStreamingDenseFeatures()", get_name());
}

template<class T> void CStreamingDenseFeatures<T>::reset_stream()
Expand Down Expand Up @@ -216,12 +216,12 @@ void CStreamingDenseFeatures<T>::end_parser()
template<class T>
bool CStreamingDenseFeatures<T>::get_next_example()
{
SG_DEBUG("entering");
SG_TRACE("entering");
bool ret_value;
ret_value=(bool)parser.get_next_example(current_vector.vector,
current_vector.vlen, current_label);

SG_DEBUG("leaving");
SG_TRACE("leaving");
return ret_value;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ template<class T>
CFeatures* CStreamingDenseFeatures<T>::get_streamed_features(
index_t num_elements)
{
SG_DEBUG("entering");
SG_TRACE("entering");
SG_DEBUG("Streaming {} elements", num_elements)

require(num_elements>0, "Requested number of feature vectors ({}) must be "
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/features/streaming/StreamingFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ CStreamingFeatures::CStreamingFeatures() : CFeatures()

CStreamingFeatures::~CStreamingFeatures()
{
SG_DEBUG("entering CStreamingFeatures::~CStreamingFeatures()")
SG_TRACE("entering CStreamingFeatures::~CStreamingFeatures()");
SG_UNREF(working_file);
SG_DEBUG("leaving CStreamingFeatures::~CStreamingFeatures()")
SG_TRACE("leaving CStreamingFeatures::~CStreamingFeatures()");
}

void CStreamingFeatures::set_read_functions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void CGaussianBlobsDataGenerator::init()

bool CGaussianBlobsDataGenerator::get_next_example()
{
SG_DEBUG("entering CGaussianBlobsDataGenerator::get_next_example()");
SG_TRACE("entering CGaussianBlobsDataGenerator::get_next_example()");

/* allocate space */
SGVector<float64_t> result=SGVector<float64_t>(2);
Expand All @@ -99,7 +99,7 @@ bool CGaussianBlobsDataGenerator::get_next_example()
/* save example back to superclass */
CGaussianBlobsDataGenerator::current_vector=result;

SG_DEBUG("leaving CGaussianBlobsDataGenerator::get_next_example()");
SG_TRACE("leaving CGaussianBlobsDataGenerator::get_next_example()");
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void CMeanShiftDataGenerator::init()

bool CMeanShiftDataGenerator::get_next_example()
{
SG_DEBUG("entering");
SG_TRACE("entering");

/* allocate space */
SGVector<float64_t> result=SGVector<float64_t>(m_dimension);
Expand All @@ -70,7 +70,7 @@ bool CMeanShiftDataGenerator::get_next_example()
/* save example back to superclass */
CMeanShiftDataGenerator::current_vector=result;

SG_DEBUG("leaving");
SG_TRACE("leaving");
return true;
}

Expand Down

0 comments on commit 40f40f0

Please sign in to comment.