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),
max_heapbytes_used(0),
complexity(oNone),
complexity_lambda(),
complexity_n(0),
report_big_o(false),
report_rms(false) {}
@ -162,7 +163,7 @@ public:
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 void ReportRuns(const std::vector<Run>& reports);

View File

@ -161,11 +161,7 @@ class ThreadManager {
// Timer management class
class ThreadTimer {
public:
ThreadTimer()
: running_(false),
real_time_used_(0),
cpu_time_used_(0),
manual_time_used_(0) {}
ThreadTimer() = default;
// Called by each thread
void StartTimer() {
@ -206,15 +202,15 @@ class ThreadTimer {
}
private:
bool running_; // Is the timer running
double start_real_time_; // If running_
double start_cpu_time_; // If running_
bool running_ = false; // Is the timer running
double start_real_time_ = 0; // If running_
double start_cpu_time_ = 0; // If running_
// Accumulated time so far (does not contain current slice if running_)
double real_time_used_;
double cpu_time_used_;
double real_time_used_ = 0;
double cpu_time_used_ = 0;
// 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)
: name_(name), report_mode_(RM_Unspecified),
time_unit_(kNanosecond), range_multiplier_(kRangeMultiplier),
min_time_(0), repetitions_(0), use_real_time_(false), use_manual_time_(false),
complexity_(oNone)
min_time_(0), repetitions_(0), use_real_time_(false),
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;
}
#else
double MakeTime(struct rusage ru) {
double MakeTime(struct rusage const& ru) {
return (static_cast<double>(ru.ru_utime.tv_sec) +
static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 +
static_cast<double>(ru.ru_stime.tv_sec) +