Commit 04a9343f by Orgad Shaneh Committed by Dominic Hamon

Make some functions const (#832)

and ThreadManager ctor explicit. Reported by CppCheck.
parent 090faecb
...@@ -574,7 +574,7 @@ class State { ...@@ -574,7 +574,7 @@ class State {
void SetComplexityN(int64_t complexity_n) { complexity_n_ = complexity_n; } void SetComplexityN(int64_t complexity_n) { complexity_n_ = complexity_n; }
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
int64_t complexity_length_n() { return complexity_n_; } int64_t complexity_length_n() const { return complexity_n_; }
// If this routine is called with items > 0, then an items/s // If this routine is called with items > 0, then an items/s
// label is printed on the benchmark report line for the currently // label is printed on the benchmark report line for the currently
......
...@@ -11,7 +11,7 @@ namespace internal { ...@@ -11,7 +11,7 @@ namespace internal {
class ThreadManager { class ThreadManager {
public: public:
ThreadManager(int num_threads) explicit ThreadManager(int num_threads)
: alive_threads_(num_threads), start_stop_barrier_(num_threads) {} : alive_threads_(num_threads), start_stop_barrier_(num_threads) {}
Mutex& GetBenchmarkMutex() const RETURN_CAPABILITY(benchmark_mutex_) { Mutex& GetBenchmarkMutex() const RETURN_CAPABILITY(benchmark_mutex_) {
......
...@@ -43,19 +43,19 @@ class ThreadTimer { ...@@ -43,19 +43,19 @@ class ThreadTimer {
bool running() const { return running_; } bool running() const { return running_; }
// REQUIRES: timer is not running // REQUIRES: timer is not running
double real_time_used() { double real_time_used() const {
CHECK(!running_); CHECK(!running_);
return real_time_used_; return real_time_used_;
} }
// REQUIRES: timer is not running // REQUIRES: timer is not running
double cpu_time_used() { double cpu_time_used() const {
CHECK(!running_); CHECK(!running_);
return cpu_time_used_; return cpu_time_used_;
} }
// REQUIRES: timer is not running // REQUIRES: timer is not running
double manual_time_used() { double manual_time_used() const {
CHECK(!running_); CHECK(!running_);
return manual_time_used_; return manual_time_used_;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment