Skip to content

Commit

Permalink
Make some functions const (#832)
Browse files Browse the repository at this point in the history
and ThreadManager ctor explicit.

Reported by CppCheck.
  • Loading branch information
orgads authored and dominichamon committed Jun 26, 2019
1 parent 090faec commit 04a9343
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/benchmark/benchmark.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/thread_manager.h
Expand Up @@ -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_) {
Expand Down
6 changes: 3 additions & 3 deletions src/thread_timer.h
Expand Up @@ -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_;
}
Expand Down

0 comments on commit 04a9343

Please sign in to comment.