Clang-tidy performance error fixes (#411)
Fixes perf errors + ambiguity issues raised by clang-tidy
[ROCm/rocprofiler-sdk commit: 75264b5587]
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
GitHub
γονέας
07d551b5cb
υποβολή
24c8d296ba
@@ -162,10 +162,10 @@ struct dereferenceable : B
|
||||
P operator->() const { return ::std::addressof(*static_cast<const T&>(*this)); }
|
||||
};
|
||||
|
||||
template <typename T, typename I, typename R, typename B = empty_base<T>>
|
||||
template <typename T, typename N, typename R, typename B = empty_base<T>>
|
||||
struct indexable : B
|
||||
{
|
||||
R operator[](I n) const { return *(static_cast<const T&>(*this) + n); }
|
||||
R operator[](N n) const { return *(static_cast<const T&>(*this) + n); }
|
||||
};
|
||||
|
||||
template <typename T, typename B = empty_base<T>>
|
||||
|
||||
@@ -770,7 +770,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
void swap(small_vector_impl& RHS);
|
||||
void swap(small_vector_impl& RHS) noexcept;
|
||||
|
||||
/// add the specified range to the end of the small_vector.
|
||||
template <typename ITp, typename = enable_if_convertible_to_input_iterator<ITp>>
|
||||
@@ -1073,7 +1073,7 @@ public:
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
small_vector_impl<T>::swap(small_vector_impl<T>& RHS)
|
||||
small_vector_impl<T>::swap(small_vector_impl<T>& RHS) noexcept
|
||||
{
|
||||
if(this == &RHS) return;
|
||||
|
||||
@@ -1486,7 +1486,7 @@ namespace std
|
||||
template <typename T>
|
||||
inline void
|
||||
swap(rocprofiler::common::container::small_vector_impl<T>& LHS,
|
||||
rocprofiler::common::container::small_vector_impl<T>& RHS)
|
||||
rocprofiler::common::container::small_vector_impl<T>& RHS) noexcept
|
||||
{
|
||||
LHS.swap(RHS);
|
||||
}
|
||||
@@ -1495,7 +1495,7 @@ swap(rocprofiler::common::container::small_vector_impl<T>& LHS,
|
||||
template <typename T, unsigned N>
|
||||
inline void
|
||||
swap(rocprofiler::common::container::small_vector<T, N>& LHS,
|
||||
rocprofiler::common::container::small_vector<T, N>& RHS)
|
||||
rocprofiler::common::container::small_vector<T, N>& RHS) noexcept
|
||||
{
|
||||
LHS.swap(RHS);
|
||||
}
|
||||
|
||||
@@ -206,9 +206,9 @@ public:
|
||||
}
|
||||
bool operator!=(const this_type& c) const { return !operator==(c); }
|
||||
|
||||
void swap(this_type& v) { std::swap(m_chunks, v.m_chunks); }
|
||||
void swap(this_type& v) noexcept { std::swap(m_chunks, v.m_chunks); }
|
||||
|
||||
friend void swap(this_type& l, this_type& r) { l.swap(r); }
|
||||
friend void swap(this_type& l, this_type& r) noexcept { l.swap(r); }
|
||||
|
||||
reference front() { return m_chunks.front()->front(); }
|
||||
const_reference front() const { return front(); }
|
||||
|
||||
@@ -100,9 +100,9 @@ struct static_vector
|
||||
auto* data() { return m_data.data(); }
|
||||
const auto* data() const { return m_data.data(); }
|
||||
|
||||
void swap(this_type& _v);
|
||||
void swap(this_type& _v) noexcept;
|
||||
|
||||
friend void swap(this_type& _lhs, this_type& _rhs) { _lhs.swap(_rhs); }
|
||||
friend void swap(this_type& _lhs, this_type& _rhs) noexcept { _lhs.swap(_rhs); }
|
||||
|
||||
private:
|
||||
void update_size(size_t);
|
||||
@@ -172,7 +172,7 @@ static_vector<Tp, N, AtomicSizeV>::clear()
|
||||
|
||||
template <typename Tp, size_t N, bool AtomicSizeV>
|
||||
void
|
||||
static_vector<Tp, N, AtomicSizeV>::swap(this_type& _v)
|
||||
static_vector<Tp, N, AtomicSizeV>::swap(this_type& _v) noexcept
|
||||
{
|
||||
if constexpr(AtomicSizeV)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "lib/common/environment.hpp"
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
@@ -212,8 +214,7 @@ get_memory_unit(std::string _unit)
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "Warning!! No memory unit matching \"" << _unit << "\". Using default..."
|
||||
<< std::endl;
|
||||
LOG(WARNING) << "Warning!! No memory unit matching \"" << _unit << "\". Using default...\n";
|
||||
|
||||
return return_type{"MB", units::megabyte};
|
||||
}
|
||||
@@ -249,8 +250,7 @@ get_timing_unit(std::string _unit)
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "Warning!! No timing unit matching \"" << _unit << "\". Using default..."
|
||||
<< std::endl;
|
||||
LOG(WARNING) << "Warning!! No timing unit matching \"" << _unit << "\". Using default...\n";
|
||||
|
||||
return return_type{"sec", units::sec};
|
||||
}
|
||||
@@ -280,8 +280,7 @@ get_frequncy_unit(std::string _unit)
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "Warning!! No frequency unit matching \"" << _unit << "\". Using default..."
|
||||
<< std::endl;
|
||||
LOG(WARNING) << "Warning!! No frequency unit matching \"" << _unit << "\". Using default...\n";
|
||||
|
||||
return return_type{"MHz", units::megahertz};
|
||||
}
|
||||
@@ -316,8 +315,7 @@ get_power_unit(const std::string& _unit)
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "Warning!! No power unit matching \"" << _unit << "\". Using default..."
|
||||
<< std::endl;
|
||||
LOG(WARNING) << "Warning!! No power unit matching \"" << _unit << "\". Using default...\n";
|
||||
|
||||
return return_type{"watts", units::watt};
|
||||
}
|
||||
|
||||
+4
-2
@@ -28,6 +28,8 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/parser/translation.hpp"
|
||||
|
||||
template <>
|
||||
@@ -258,8 +260,8 @@ _parse_buffer(generic_sample_t* buffer,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
std::cerr << "Index " << index << " - Invalid sample type: " << buffer[index].type
|
||||
<< std::endl;
|
||||
LOG(WARNING) << "Index " << index
|
||||
<< " - Invalid sample type: " << buffer[index].type << "\n";
|
||||
return PCSAMPLE_STATUS_INVALID_SAMPLE;
|
||||
}
|
||||
}
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user