Fix various uninitialized members

This commit is contained in:
Eric Fiselier 2016-09-28 18:21:36 -06:00
parent 6cadcf7f14
commit 2aca242bf6
4 changed files with 12 additions and 15 deletions

View file

@ -51,6 +51,7 @@ class BenchmarkReporter {
items_per_second(0), items_per_second(0),
max_heapbytes_used(0), max_heapbytes_used(0),
complexity(oNone), complexity(oNone),
complexity_lambda(),
complexity_n(0), complexity_n(0),
report_big_o(false), report_big_o(false),
report_rms(false) {} report_rms(false) {}
@ -162,7 +163,7 @@ public:
OO_Color OO_Color
}; };
explicit ConsoleReporter(OutputOptions color_output = OO_Color) explicit ConsoleReporter(OutputOptions color_output = OO_Color)
: color_output_(color_output == OO_Color) {} : name_field_width_(0), color_output_(color_output == OO_Color) {}
virtual bool ReportContext(const Context& context); virtual bool ReportContext(const Context& context);
virtual void ReportRuns(const std::vector<Run>& reports); virtual void ReportRuns(const std::vector<Run>& reports);

View file

@ -161,11 +161,7 @@ class ThreadManager {
// Timer management class // Timer management class
class ThreadTimer { class ThreadTimer {
public: public:
ThreadTimer() ThreadTimer() = default;
: running_(false),
real_time_used_(0),
cpu_time_used_(0),
manual_time_used_(0) {}
// Called by each thread // Called by each thread
void StartTimer() { void StartTimer() {
@ -206,15 +202,15 @@ class ThreadTimer {
} }
private: private:
bool running_; // Is the timer running bool running_ = false; // Is the timer running
double start_real_time_; // If running_ double start_real_time_ = 0; // If running_
double start_cpu_time_; // If running_ double start_cpu_time_ = 0; // If running_
// Accumulated time so far (does not contain current slice if running_) // Accumulated time so far (does not contain current slice if running_)
double real_time_used_; double real_time_used_ = 0;
double cpu_time_used_; double cpu_time_used_ = 0;
// Manually set iteration time. User sets this with SetIterationTime(seconds). // Manually set iteration time. User sets this with SetIterationTime(seconds).
double manual_time_used_; double manual_time_used_ = 0;
}; };

View file

@ -209,8 +209,8 @@ bool FindBenchmarksInternal(const std::string& re,
Benchmark::Benchmark(const char* name) Benchmark::Benchmark(const char* name)
: name_(name), report_mode_(RM_Unspecified), : name_(name), report_mode_(RM_Unspecified),
time_unit_(kNanosecond), range_multiplier_(kRangeMultiplier), time_unit_(kNanosecond), range_multiplier_(kRangeMultiplier),
min_time_(0), repetitions_(0), use_real_time_(false), use_manual_time_(false), min_time_(0), repetitions_(0), use_real_time_(false),
complexity_(oNone) use_manual_time_(false), complexity_(oNone), complexity_lambda_(nullptr)
{ {
} }

View file

@ -71,7 +71,7 @@ double MakeTime(FILETIME const& kernel_time, FILETIME const& user_time) {
1e-7; 1e-7;
} }
#else #else
double MakeTime(struct rusage ru) { double MakeTime(struct rusage const& ru) {
return (static_cast<double>(ru.ru_utime.tv_sec) + return (static_cast<double>(ru.ru_utime.tv_sec) +
static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 + static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 +
static_cast<double>(ru.ru_stime.tv_sec) + static_cast<double>(ru.ru_stime.tv_sec) +