aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-03-18 15:02:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-03-18 15:02:39 +0200
commit6b9bdad3b68b12ff8e2075d54c1f7f005bb2f768 (patch)
tree8ccd47c832ea6fd8dea6d12e3b9f36c8c0e72033 /build2
parent562af3a7f3742bf57b007e904e0bb661a5da1dab (diff)
Add noop mode to file cache, add --file-cache option to select
Diffstat (limited to 'build2')
-rw-r--r--build2/b-options.cxx20
-rw-r--r--build2/b-options.hxx8
-rw-r--r--build2/b-options.ixx12
-rw-r--r--build2/b.cli10
-rw-r--r--build2/b.cxx13
5 files changed, 62 insertions, 1 deletions
diff --git a/build2/b-options.cxx b/build2/b-options.cxx
index c061fef..17b791e 100644
--- a/build2/b-options.cxx
+++ b/build2/b-options.cxx
@@ -709,6 +709,8 @@ namespace build2
max_jobs_specified_ (false),
queue_depth_ (4),
queue_depth_specified_ (false),
+ file_cache_ (),
+ file_cache_specified_ (false),
max_stack_ (),
max_stack_specified_ (false),
serial_stop_ (),
@@ -892,6 +894,13 @@ namespace build2
this->queue_depth_specified_ = true;
}
+ if (a.file_cache_specified_)
+ {
+ ::build2::cl::parser< string>::merge (
+ this->file_cache_, a.file_cache_);
+ this->file_cache_specified_ = true;
+ }
+
if (a.max_stack_specified_)
{
::build2::cl::parser< size_t>::merge (
@@ -1105,6 +1114,14 @@ namespace build2
<< " the build system scheduler implementation for details." << ::std::endl;
os << std::endl
+ << "\033[1m--file-cache\033[0m \033[4mimpl\033[0m File cache implementation to use for intermediate build" << ::std::endl
+ << " results. Valid values are \033[1mnoop\033[0m (no caching or" << ::std::endl
+ << " compression) and \033[1msync-lz4\033[0m (no caching with synchronous" << ::std::endl
+ << " LZ4 on-disk compression). If this option is not" << ::std::endl
+ << " specified, then a suitable default implementation is used" << ::std::endl
+ << " (currently \033[1msync-lz4\033[0m)." << ::std::endl;
+
+ os << std::endl
<< "\033[1m--max-stack\033[0m \033[4mnum\033[0m The maximum stack size in KBytes to allow for newly" << ::std::endl
<< " created threads. For \033[4mpthreads\033[0m-based systems the driver" << ::std::endl
<< " queries the stack size of the main thread and uses the" << ::std::endl
@@ -1311,6 +1328,9 @@ namespace build2
_cli_options_map_["-Q"] =
&::build2::cl::thunk< options, size_t, &options::queue_depth_,
&options::queue_depth_specified_ >;
+ _cli_options_map_["--file-cache"] =
+ &::build2::cl::thunk< options, string, &options::file_cache_,
+ &options::file_cache_specified_ >;
_cli_options_map_["--max-stack"] =
&::build2::cl::thunk< options, size_t, &options::max_stack_,
&options::max_stack_specified_ >;
diff --git a/build2/b-options.hxx b/build2/b-options.hxx
index fd93aba..4e1b7bd 100644
--- a/build2/b-options.hxx
+++ b/build2/b-options.hxx
@@ -510,6 +510,12 @@ namespace build2
bool
queue_depth_specified () const;
+ const string&
+ file_cache () const;
+
+ bool
+ file_cache_specified () const;
+
const size_t&
max_stack () const;
@@ -632,6 +638,8 @@ namespace build2
bool max_jobs_specified_;
size_t queue_depth_;
bool queue_depth_specified_;
+ string file_cache_;
+ bool file_cache_specified_;
size_t max_stack_;
bool max_stack_specified_;
bool serial_stop_;
diff --git a/build2/b-options.ixx b/build2/b-options.ixx
index 3d5781c..0e90ba1 100644
--- a/build2/b-options.ixx
+++ b/build2/b-options.ixx
@@ -374,6 +374,18 @@ namespace build2
return this->queue_depth_specified_;
}
+ inline const string& options::
+ file_cache () const
+ {
+ return this->file_cache_;
+ }
+
+ inline bool options::
+ file_cache_specified () const
+ {
+ return this->file_cache_specified_;
+ }
+
inline const size_t& options::
max_stack () const
{
diff --git a/build2/b.cli b/build2/b.cli
index b54e9a5..a24837c 100644
--- a/build2/b.cli
+++ b/build2/b.cli
@@ -494,6 +494,16 @@ namespace build2
details."
}
+ string --file-cache
+ {
+ "<impl>",
+ "File cache implementation to use for intermediate build results. Valid
+ values are \cb{noop} (no caching or compression) and \cb{sync-lz4} (no
+ caching with synchronous LZ4 on-disk compression). If this option is
+ not specified, then a suitable default implementation is used
+ (currently \cb{sync-lz4})."
+ }
+
size_t --max-stack
{
"<num>",
diff --git a/build2/b.cxx b/build2/b.cxx
index 81520bb..1ba15e2 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -762,7 +762,18 @@ main (int argc, char* argv[])
: nullopt));
global_mutexes mutexes (sched.shard_size ());
- file_cache fcache (sched);
+
+ bool fcache_comp (true);
+ if (ops.file_cache_specified ())
+ {
+ const string& v (ops.file_cache ());
+ if (v == "noop" || v == "none")
+ fcache_comp = false;
+ else if (v != "sync-lz4")
+ fail << "invalid --file-cache value '" << v << "'";
+ }
+
+ file_cache fcache (fcache_comp);
// Trace some overall environment information.
//