fix uninit error

v1
Brett 2023-11-09 15:28:17 -05:00
parent e81cddf6ba
commit e28f30bcec
3 changed files with 17 additions and 3 deletions

View File

@ -51,6 +51,11 @@ namespace blt
std::uint64_t count = 0; std::uint64_t count = 0;
std::string interval_name; std::string interval_name;
interval_t() = default;
interval_t(pf_time_t wallStart, pf_time_t wallEnd, pf_time_t wallTotal, pf_time_t threadStart, pf_time_t threadEnd, pf_time_t threadTotal,
pf_cycle_t cyclesStart, pf_cycle_t cyclesEnd, pf_cycle_t cyclesTotal, uint64_t count, std::string intervalName);
}; };
struct cycle_interval_t struct cycle_interval_t
@ -82,7 +87,8 @@ namespace blt
void startInterval(interval_t* interval); void startInterval(interval_t* interval);
inline interval_t* startInterval(profile_t& profiler, std::string interval_name){ inline interval_t* startInterval(profile_t& profiler, std::string interval_name)
{
auto* p = createInterval(profiler, std::move(interval_name)); auto* p = createInterval(profiler, std::move(interval_name));
startInterval(p); startInterval(p);
return p; return p;

View File

@ -198,7 +198,7 @@ namespace blt
if constexpr (std::is_trivially_copyable_v<T>) if constexpr (std::is_trivially_copyable_v<T>)
{ {
std::memcpy(_buffer, copy._buffer, copy.size()); std::memcpy(_buffer, copy._buffer, copy.size() * sizeof(T));
} else } else
{ {
if constexpr (std::is_copy_constructible_v<T> && !std::is_copy_assignable_v<T>) if constexpr (std::is_copy_constructible_v<T> && !std::is_copy_assignable_v<T>)
@ -228,7 +228,7 @@ namespace blt
if constexpr (std::is_trivially_copyable_v<T>) if constexpr (std::is_trivially_copyable_v<T>)
{ {
std::memcpy(_buffer, copy._buffer, copy.size()); std::memcpy(_buffer, copy._buffer, copy.size() * sizeof(T));
} else } else
{ {
if constexpr (std::is_copy_constructible_v<T> && !std::is_copy_assignable_v<T>) if constexpr (std::is_copy_constructible_v<T> && !std::is_copy_assignable_v<T>)

View File

@ -248,4 +248,12 @@ namespace blt
blt::printProfile(profile, flags, sort, log_level); blt::printProfile(profile, flags, sort, log_level);
profiles.erase(profile_name); profiles.erase(profile_name);
} }
interval_t::interval_t(pf_time_t wallStart, pf_time_t wallEnd, pf_time_t wallTotal, pf_time_t threadStart, pf_time_t threadEnd,
pf_time_t threadTotal, pf_cycle_t cyclesStart, pf_cycle_t cyclesEnd, pf_cycle_t cyclesTotal, uint64_t count,
std::string intervalName):
wall_start(wallStart), wall_end(wallEnd), wall_total(wallTotal), thread_start(threadStart), thread_end(threadEnd),
thread_total(threadTotal), cycles_start(cyclesStart), cycles_end(cyclesEnd), cycles_total(cyclesTotal), count(count),
interval_name(std::move(intervalName))
{}
} }