Use clang-format-18 for source formatting (#256)
* Updating clang-format to v18
- Updates the pre-commit-config
- Formats source files according to the utility
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
* Update format source workflow
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
* Update CONTRIBUTING
* Update comment in .clang-format
* Update CONTRIBUTING.md
* Update helper script
---------
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
[ROCm/rocprofiler-systems commit: 1e13b590e7]
This commit is contained in:
@@ -54,8 +54,7 @@ address_range::as_string(int _depth) const
|
||||
_ss << std::hex;
|
||||
_ss << std::setw(2 * _depth) << "";
|
||||
_ss.fill('0');
|
||||
_ss << "0x" << std::setw(16) << low << "-"
|
||||
<< "0x" << std::setw(16) << high;
|
||||
_ss << "0x" << std::setw(16) << low << "-" << "0x" << std::setw(16) << high;
|
||||
return _ss.str();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,9 @@ template <typename Tp>
|
||||
struct can_stringify
|
||||
{
|
||||
private:
|
||||
static constexpr auto sfinae(int)
|
||||
-> decltype(std::declval<std::ostream&>() << std::declval<Tp>(), bool())
|
||||
static constexpr auto sfinae(int) -> decltype(std::declval<std::ostream&>()
|
||||
<< std::declval<Tp>(),
|
||||
bool())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1292,7 +1292,8 @@ get_use_sampling_cputime()
|
||||
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
|
||||
}
|
||||
|
||||
std::set<int> get_sampling_signals(int64_t)
|
||||
std::set<int>
|
||||
get_sampling_signals(int64_t)
|
||||
{
|
||||
auto _v = std::set<int>{};
|
||||
if(get_use_causal())
|
||||
@@ -1561,7 +1562,7 @@ print_settings(
|
||||
{
|
||||
size_t _wextra = (_md && i < 2) ? 2 : 0;
|
||||
_widths.at(i) = std::max<size_t>(_widths.at(i),
|
||||
_data.back().at(i).length() + _wextra);
|
||||
_data.back().at(i).length() + _wextra);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1593,8 +1594,7 @@ print_settings(
|
||||
_spacer_extra -= 1;
|
||||
std::stringstream _spacer{};
|
||||
_spacer.fill('-');
|
||||
_spacer << "#" << std::setw(tot_width + _spacer_extra) << ""
|
||||
<< "#";
|
||||
_spacer << "#" << std::setw(tot_width + _spacer_extra) << "" << "#";
|
||||
_os << _spacer.str() << "\n";
|
||||
for(const auto& itr : _data)
|
||||
{
|
||||
|
||||
@@ -262,7 +262,8 @@ spec::operator()(const stages& _stages) const
|
||||
auto _del = (_dur * units::sec);
|
||||
auto _end = _now + _del;
|
||||
while(get_clock_now(_spec.clock_id.value) < _end && (_ret = _func(_spec)))
|
||||
{}
|
||||
{
|
||||
}
|
||||
return _ret;
|
||||
};
|
||||
|
||||
@@ -275,7 +276,8 @@ spec::operator()(const stages& _stages) const
|
||||
if(_stages.init(_spec) && _wait(_stages.wait, _spec.delay) &&
|
||||
_stages.start(_spec) && _wait(_stages.collect, _spec.duration) &&
|
||||
_stages.stop(_spec))
|
||||
{}
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -69,10 +69,10 @@ struct aligned_static_vector
|
||||
using size_type = size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
aligned_static_vector() = default;
|
||||
aligned_static_vector(const aligned_static_vector&) = default;
|
||||
aligned_static_vector(aligned_static_vector&&) noexcept = default;
|
||||
aligned_static_vector& operator=(const aligned_static_vector&) = default;
|
||||
aligned_static_vector() = default;
|
||||
aligned_static_vector(const aligned_static_vector&) = default;
|
||||
aligned_static_vector(aligned_static_vector&&) noexcept = default;
|
||||
aligned_static_vector& operator=(const aligned_static_vector&) = default;
|
||||
aligned_static_vector& operator=(aligned_static_vector&&) noexcept = default;
|
||||
|
||||
aligned_static_vector(size_t _n, Tp _v = {});
|
||||
|
||||
@@ -44,9 +44,9 @@ struct c_array
|
||||
, m_size{ _size }
|
||||
{}
|
||||
|
||||
~c_array() = default;
|
||||
c_array(const c_array&) = default;
|
||||
c_array& operator=(const c_array&) = default;
|
||||
~c_array() = default;
|
||||
c_array(const c_array&) = default;
|
||||
c_array& operator=(const c_array&) = default;
|
||||
c_array& operator=(c_array&&) noexcept = default;
|
||||
|
||||
// Get the size of the wrapped array
|
||||
|
||||
@@ -51,10 +51,10 @@ struct static_vector
|
||||
using size_type = size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
static_vector() = default;
|
||||
static_vector(const static_vector&) = default;
|
||||
static_vector(static_vector&&) noexcept = default;
|
||||
static_vector& operator=(const static_vector&) = default;
|
||||
static_vector() = default;
|
||||
static_vector(const static_vector&) = default;
|
||||
static_vector(static_vector&&) noexcept = default;
|
||||
static_vector& operator=(const static_vector&) = default;
|
||||
static_vector& operator=(static_vector&&) noexcept = default;
|
||||
|
||||
static_vector(size_t _n, Tp _v = {});
|
||||
|
||||
@@ -56,7 +56,7 @@ std::atomic<FILE*>&
|
||||
get_file_pointer()
|
||||
{
|
||||
static auto _v = std::atomic<FILE*>{ []() {
|
||||
const auto&_fname= get_file_name();
|
||||
const auto& _fname = get_file_name();
|
||||
if(!_fname.empty()) tim::log::monochrome() = true;
|
||||
return (_fname.empty())
|
||||
? stderr
|
||||
|
||||
@@ -28,17 +28,17 @@
|
||||
|
||||
#if !defined(ROCPROFSYS_DEFAULT_OBJECT)
|
||||
# define ROCPROFSYS_DEFAULT_OBJECT(NAME) \
|
||||
NAME() = default; \
|
||||
NAME(const NAME&) = default; \
|
||||
NAME(NAME&&) noexcept = default; \
|
||||
NAME& operator=(const NAME&) = default; \
|
||||
NAME() = default; \
|
||||
NAME(const NAME&) = default; \
|
||||
NAME(NAME&&) noexcept = default; \
|
||||
NAME& operator=(const NAME&) = default; \
|
||||
NAME& operator=(NAME&&) noexcept = default;
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_DEFAULT_COPY_MOVE)
|
||||
# define ROCPROFSYS_DEFAULT_COPY_MOVE(NAME) \
|
||||
NAME(const NAME&) = default; \
|
||||
NAME(NAME&&) noexcept = default; \
|
||||
NAME& operator=(const NAME&) = default; \
|
||||
NAME(const NAME&) = default; \
|
||||
NAME(NAME&&) noexcept = default; \
|
||||
NAME& operator=(const NAME&) = default; \
|
||||
NAME& operator=(NAME&&) noexcept = default;
|
||||
#endif
|
||||
|
||||
@@ -38,10 +38,10 @@ find_library_path(const std::string& _name, const std::vector<std::string>& _env
|
||||
|
||||
struct dynamic_library
|
||||
{
|
||||
dynamic_library() = delete;
|
||||
dynamic_library(const dynamic_library&) = delete;
|
||||
dynamic_library(dynamic_library&&) noexcept = default;
|
||||
dynamic_library& operator=(const dynamic_library&) = delete;
|
||||
dynamic_library() = delete;
|
||||
dynamic_library(const dynamic_library&) = delete;
|
||||
dynamic_library(dynamic_library&&) noexcept = default;
|
||||
dynamic_library& operator=(const dynamic_library&) = delete;
|
||||
dynamic_library& operator=(dynamic_library&&) noexcept = default;
|
||||
|
||||
dynamic_library(std::string _env, std::string _fname,
|
||||
|
||||
@@ -92,7 +92,7 @@ exception<Tp>::operator=(const exception& _rhs)
|
||||
if(this != &_rhs)
|
||||
{
|
||||
Tp::operator=(_rhs);
|
||||
m_what = strdup(_rhs.m_what);
|
||||
m_what = strdup(_rhs.m_what);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
~exception() override;
|
||||
|
||||
exception(exception&&) noexcept = default;
|
||||
exception(exception&&) noexcept = default;
|
||||
exception& operator=(exception&&) noexcept = default;
|
||||
|
||||
exception(const exception&);
|
||||
|
||||
@@ -92,12 +92,12 @@ struct dummy_data_type
|
||||
# if defined(MPICH) && (MPICH > 0)
|
||||
static constexpr bool is_mpich = true;
|
||||
# else
|
||||
static constexpr bool is_mpich = false;
|
||||
static constexpr bool is_mpich = false;
|
||||
# endif
|
||||
# if defined(OPEN_MPI) && (OPEN_MPI > 0)
|
||||
static constexpr bool is_openmpi = true;
|
||||
# else
|
||||
static constexpr bool is_openmpi = false;
|
||||
static constexpr bool is_openmpi = false;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -116,9 +116,9 @@ static const comm_t comm_world_v = nullptr;
|
||||
static const comm_t comm_self_v = nullptr;
|
||||
static const info_t info_null_v = nullptr;
|
||||
# else
|
||||
static const comm_t comm_world_v = MPI_COMM_WORLD;
|
||||
static const comm_t comm_self_v = MPI_COMM_SELF;
|
||||
static const info_t info_null_v = MPI_INFO_NULL;
|
||||
static const comm_t comm_world_v = MPI_COMM_WORLD;
|
||||
static const comm_t comm_self_v = MPI_COMM_SELF;
|
||||
static const info_t info_null_v = MPI_INFO_NULL;
|
||||
# endif
|
||||
static const int success_v = MPI_SUCCESS;
|
||||
static const int comm_type_shared_v = MPI_COMM_TYPE_SHARED;
|
||||
@@ -236,7 +236,7 @@ quiet()
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#if !defined(ROCPROFSYS_MPI_ERROR_FUNCTION)
|
||||
# define ROCPROFSYS_MPI_ERROR_FUNCTION(FUNC, ...) # FUNC
|
||||
# define ROCPROFSYS_MPI_ERROR_FUNCTION(FUNC, ...) #FUNC
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_MPI_ERROR_CHECK)
|
||||
@@ -454,8 +454,12 @@ size(comm_t comm)
|
||||
return std::max(_size, (int32_t) 1);
|
||||
}
|
||||
|
||||
void set_rank(int32_t, comm_t) {}
|
||||
void set_size(int32_t, comm_t) {}
|
||||
void
|
||||
set_rank(int32_t, comm_t)
|
||||
{}
|
||||
void
|
||||
set_size(int32_t, comm_t)
|
||||
{}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ enum class sample : uint64_t
|
||||
#if defined(PERF_SAMPLE_READ)
|
||||
read = PERF_SAMPLE_READ,
|
||||
#else
|
||||
read = 0,
|
||||
read = 0,
|
||||
#endif
|
||||
|
||||
callchain = PERF_SAMPLE_CALLCHAIN,
|
||||
@@ -70,61 +70,61 @@ enum class sample : uint64_t
|
||||
#if defined(PERF_SAMPLE_BRANCH_STACK)
|
||||
branch_stack = PERF_SAMPLE_BRANCH_STACK,
|
||||
#else
|
||||
branch_stack = 0,
|
||||
branch_stack = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_REGS_USER)
|
||||
regs = PERF_SAMPLE_REGS_USER,
|
||||
#else
|
||||
regs = 0,
|
||||
regs = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_STACK_USER)
|
||||
stack = PERF_SAMPLE_STACK_USER,
|
||||
#else
|
||||
stack = 0,
|
||||
stack = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_WEIGHT)
|
||||
weight = PERF_SAMPLE_WEIGHT,
|
||||
#else
|
||||
weight = 0,
|
||||
weight = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_DATA_SRC)
|
||||
data_src = PERF_SAMPLE_DATA_SRC,
|
||||
#else
|
||||
data_src = 0,
|
||||
data_src = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_IDENTIFIER)
|
||||
identifier = PERF_SAMPLE_IDENTIFIER,
|
||||
#else
|
||||
identifier = 0,
|
||||
identifier = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_TRANSACTION)
|
||||
transaction = PERF_SAMPLE_TRANSACTION,
|
||||
#else
|
||||
transaction = 0,
|
||||
transaction = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_REGS_INTR)
|
||||
regs_intr = PERF_SAMPLE_REGS_INTR,
|
||||
#else
|
||||
regs_intr = 0,
|
||||
regs_intr = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_PHYS_ADDR)
|
||||
phys_addr = PERF_SAMPLE_PHYS_ADDR,
|
||||
#else
|
||||
phys_addr = 0,
|
||||
phys_addr = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_SAMPLE_CGROUP)
|
||||
cgroup = PERF_SAMPLE_CGROUP,
|
||||
#else
|
||||
cgroup = 0,
|
||||
cgroup = 0,
|
||||
#endif
|
||||
|
||||
last = PERF_SAMPLE_MAX
|
||||
@@ -213,31 +213,31 @@ enum class record_type
|
||||
#if defined(PERF_RECORD_MMAP2)
|
||||
mmap2 = PERF_RECORD_MMAP2,
|
||||
#else
|
||||
mmap2 = 0,
|
||||
mmap2 = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_AUX)
|
||||
aux = PERF_RECORD_AUX,
|
||||
#else
|
||||
aux = 0,
|
||||
aux = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_ITRACE_START)
|
||||
itrace_start = PERF_RECORD_ITRACE_START,
|
||||
#else
|
||||
itrace_start = 0,
|
||||
itrace_start = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_LOST_SAMPLES)
|
||||
lost_samples = PERF_RECORD_LOST_SAMPLES,
|
||||
#else
|
||||
lost_samples = 0,
|
||||
lost_samples = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_SWITCH)
|
||||
switch_record = PERF_RECORD_SWITCH,
|
||||
#else
|
||||
switch_record = 0,
|
||||
switch_record = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_SWITCH_CPU_WIDE)
|
||||
@@ -249,31 +249,31 @@ enum class record_type
|
||||
#if defined(PERF_RECORD_NAMESPACES)
|
||||
namespaces = PERF_RECORD_NAMESPACES,
|
||||
#else
|
||||
namespaces = 0,
|
||||
namespaces = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_KSYMBOL)
|
||||
ksymbol = PERF_RECORD_KSYMBOL,
|
||||
#else
|
||||
ksymbol = 0,
|
||||
ksymbol = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_BPF_EVENT)
|
||||
bpf_event = PERF_RECORD_BPF_EVENT,
|
||||
#else
|
||||
bpf_event = 0,
|
||||
bpf_event = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_CGROUP)
|
||||
cgroup = PERF_RECORD_CGROUP,
|
||||
#else
|
||||
cgroup = 0,
|
||||
cgroup = 0,
|
||||
#endif
|
||||
|
||||
#if defined(PERF_RECORD_TEXT_POKE)
|
||||
text_poke = PERF_RECORD_TEXT_POKE,
|
||||
#else
|
||||
text_poke = 0,
|
||||
text_poke = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -476,14 +476,13 @@ std::unordered_set<rocprofiler_buffer_tracing_kind_t>
|
||||
get_buffered_domains()
|
||||
{
|
||||
const auto buffer_tracing_info = rocprofiler::sdk::get_buffer_tracing_names();
|
||||
const auto supported = std::unordered_set<rocprofiler_buffer_tracing_kind_t>
|
||||
{
|
||||
const auto supported = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{
|
||||
ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH,
|
||||
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
|
||||
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
|
||||
# if(ROCPROFILER_VERSION < 10000)
|
||||
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION,
|
||||
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION,
|
||||
# endif
|
||||
ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY,
|
||||
ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY,
|
||||
};
|
||||
|
||||
auto _data = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{};
|
||||
|
||||
@@ -31,16 +31,16 @@ namespace
|
||||
{
|
||||
template <typename ContainerT, typename Arg>
|
||||
auto
|
||||
emplace_impl(ContainerT& _targ, Arg&& _v, int)
|
||||
-> decltype(_targ.emplace(std::forward<Arg>(_v)))
|
||||
emplace_impl(ContainerT& _targ, Arg&& _v,
|
||||
int) -> decltype(_targ.emplace(std::forward<Arg>(_v)))
|
||||
{
|
||||
return _targ.emplace(std::forward<Arg>(_v));
|
||||
}
|
||||
|
||||
template <typename ContainerT, typename Arg>
|
||||
auto
|
||||
emplace_impl(ContainerT& _targ, Arg&& _v, long)
|
||||
-> decltype(_targ.emplace_back(std::forward<Arg>(_v)))
|
||||
emplace_impl(ContainerT& _targ, Arg&& _v,
|
||||
long) -> decltype(_targ.emplace_back(std::forward<Arg>(_v)))
|
||||
{
|
||||
return _targ.emplace_back(std::forward<Arg>(_v));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user