summaryrefslogtreecommitdiffstats
path: root/src/build.h
diff options
context:
space:
mode:
authorNicolas Despres <nicolas.despres@gmail.com>2012-04-05 13:44:36 (GMT)
committerNicolas Despres <nicolas.despres@gmail.com>2012-04-19 13:29:26 (GMT)
commitb50f7d1f30991998564f62aa717862efb7555044 (patch)
tree95161e6f0fd8c201ac5bc30c0fb5bd4796ba90ce /src/build.h
parent5da8529d9c0e5fa2ad586c0608b5a936286cf9a2 (diff)
downloadNinja-b50f7d1f30991998564f62aa717862efb7555044.zip
Ninja-b50f7d1f30991998564f62aa717862efb7555044.tar.gz
Ninja-b50f7d1f30991998564f62aa717862efb7555044.tar.bz2
Add -l N option to limit the load average.
This is similar to GNU make -l/--load-average option. It limits the number of job started if the load average exceed the given value. It can be very useful when running ninja on a continuous integration server where we want to use parallelism as much as possible without overloading the server.
Diffstat (limited to 'src/build.h')
-rw-r--r--src/build.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/build.h b/src/build.h
index 179fca6..9397e5f 100644
--- a/src/build.h
+++ b/src/build.h
@@ -98,7 +98,7 @@ struct CommandRunner {
/// Options (e.g. verbosity, parallelism) passed to a build.
struct BuildConfig {
BuildConfig() : verbosity(NORMAL), dry_run(false), parallelism(1),
- failures_allowed(1) {}
+ failures_allowed(1), max_load_average(-0.0f) {}
enum Verbosity {
NORMAL,
@@ -109,6 +109,9 @@ struct BuildConfig {
bool dry_run;
int parallelism;
int failures_allowed;
+ /// The maximum load average we must not exceed. A negative value
+ /// means that we do not have any limit.
+ double max_load_average;
};
/// Builder wraps the build process: starting commands, updating status.