From bbb0ead7e82edd3081ebd9243655b851b0ab4779 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 30 Apr 2018 13:46:57 +0200 Subject: Don't print scheduler statistics at verbosity level 2, add --stat instead --- build2/b-options.cxx | 6 ++++++ build2/b-options.hxx | 4 ++++ build2/b-options.ixx | 6 ++++++ build2/b.cli | 5 +++++ build2/b.cxx | 5 +++-- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/build2/b-options.cxx b/build2/b-options.cxx index 3cfb708..df39b2b 100644 --- a/build2/b-options.cxx +++ b/build2/b-options.cxx @@ -597,6 +597,7 @@ namespace build2 quiet_ (), verbose_ (1), verbose_specified_ (false), + stat_ (), jobs_ (), jobs_specified_ (false), max_jobs_ (), @@ -733,6 +734,9 @@ namespace build2 << " 6. Even more detailed information, including state dumps." << ::std::endl; os << std::endl + << "\033[1m--stat\033[0m Display build statistics." << ::std::endl; + + os << std::endl << "\033[1m--jobs\033[0m|\033[1m-j\033[0m \033[4mnum\033[0m Number of active jobs to perform in parallel. This" << ::std::endl << " includes both the number of active threads inside the" << ::std::endl << " build system as well as the number of external commands" << ::std::endl @@ -881,6 +885,8 @@ namespace build2 _cli_options_map_["--verbose"] = &::build2::cl::thunk< options, uint16_t, &options::verbose_, &options::verbose_specified_ >; + _cli_options_map_["--stat"] = + &::build2::cl::thunk< options, bool, &options::stat_ >; _cli_options_map_["--jobs"] = &::build2::cl::thunk< options, size_t, &options::jobs_, &options::jobs_specified_ >; diff --git a/build2/b-options.hxx b/build2/b-options.hxx index cab4951..c9eed77 100644 --- a/build2/b-options.hxx +++ b/build2/b-options.hxx @@ -429,6 +429,9 @@ namespace build2 bool verbose_specified () const; + const bool& + stat () const; + const size_t& jobs () const; @@ -530,6 +533,7 @@ namespace build2 bool quiet_; uint16_t verbose_; bool verbose_specified_; + bool stat_; size_t jobs_; bool jobs_specified_; size_t max_jobs_; diff --git a/build2/b-options.ixx b/build2/b-options.ixx index 33cb18a..0691f12 100644 --- a/build2/b-options.ixx +++ b/build2/b-options.ixx @@ -264,6 +264,12 @@ namespace build2 return this->verbose_specified_; } + inline const bool& options:: + stat () const + { + return this->stat_; + } + inline const size_t& options:: jobs () const { diff --git a/build2/b.cli b/build2/b.cli index d054d05..6f5d26d 100644 --- a/build2/b.cli +++ b/build2/b.cli @@ -441,6 +441,11 @@ namespace build2 \li|Even more detailed information, including state dumps.||" } + bool --stat + { + "Display build statistics." + } + size_t --jobs|-j { "", diff --git a/build2/b.cxx b/build2/b.cxx index b73a0d6..ba84b1c 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -1393,9 +1393,10 @@ main (int argc, char* argv[]) // assert (st.task_queue_remain == 0); - if (verb >= (st.thread_max_active > 1 ? 3 : 4)) + if (ops.stat ()) { - info << "scheduler statistics:" << "\n\n" + text << '\n' + << "build statistics:" << "\n\n" << " thread_max_active " << st.thread_max_active << '\n' << " thread_max_total " << st.thread_max_total << '\n' << " thread_helpers " << st.thread_helpers << '\n' -- cgit v1.1