mirror of
https://github.com/google/benchmark.git
synced 2025-02-06 17:20:15 +08:00
Make some functions const (#832)
and ThreadManager ctor explicit. Reported by CppCheck.
This commit is contained in:
parent
090faecb45
commit
04a9343fc9
@ -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
|
||||
|
@ -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_) {
|
||||
|
@ -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_;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user