Make some functions const (#832)

and ThreadManager ctor explicit.

Reported by CppCheck.
This commit is contained in:
Orgad Shaneh 2019-06-26 11:06:24 +03:00 committed by Dominic Hamon
parent 090faecb45
commit 04a9343fc9
3 changed files with 5 additions and 5 deletions

View File

@ -574,7 +574,7 @@ class State {
void SetComplexityN(int64_t complexity_n) { complexity_n_ = complexity_n; }
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
// label is printed on the benchmark report line for the currently

View File

@ -11,7 +11,7 @@ namespace internal {
class ThreadManager {
public:
ThreadManager(int num_threads)
explicit ThreadManager(int num_threads)
: alive_threads_(num_threads), start_stop_barrier_(num_threads) {}
Mutex& GetBenchmarkMutex() const RETURN_CAPABILITY(benchmark_mutex_) {

View File

@ -43,19 +43,19 @@ class ThreadTimer {
bool running() const { return running_; }
// REQUIRES: timer is not running
double real_time_used() {
double real_time_used() const {
CHECK(!running_);
return real_time_used_;
}
// REQUIRES: timer is not running
double cpu_time_used() {
double cpu_time_used() const {
CHECK(!running_);
return cpu_time_used_;
}
// REQUIRES: timer is not running
double manual_time_used() {
double manual_time_used() const {
CHECK(!running_);
return manual_time_used_;
}