[perf] Use load average limit only during buck analysis

Reviewed By: jberdine

Differential Revision: D4146841

fbshipit-source-id: 026d25c
master
Cristiano Calcagno 8 years ago committed by Facebook Github Bot
parent ba7cef4657
commit 7e4710004e

@ -142,7 +142,7 @@ let capture build_cmd build_mode =
(if not Config.flavors || not in_buck_mode || is_analyze_cmd build_cmd then [] else
["--use-flavors"]) @
"-j" :: (string_of_int Config.jobs) ::
"-l" :: (string_of_float Config.load_average) ::
(Option.map_default (fun l -> ["-l"; string_of_float l]) [] Config.load_average) @
(if not Config.pmd_xml then [] else
["--pmd-xml"]) @
["--project-root"; Config.project_root] @

@ -314,6 +314,11 @@ let mk_float ~default ?(deprecated=[]) ~long ?short ?exes ?(meta="") doc =
~decode_json:(string_json_decoder ~long)
~mk_spec:(fun set -> Arg.String set)
let mk_float_opt ?default ?(deprecated=[]) ~long ?short ?exes ?(meta="") doc =
let default_to_string = function Some f -> string_of_float f | None -> "" in
let f s = Some (float_of_string s) in
mk_option ~deprecated ~long ?short ~default ~default_to_string ~f ?exes ~meta doc
let mk_string ~default ?(f=fun s -> s) ?(deprecated=[]) ~long ?short ?exes ?(meta="") doc =
mk ~deprecated ~long ?short ~default ?exes ~meta doc
~default_to_string:(fun s -> s)

@ -64,6 +64,8 @@ val mk_int : default:int -> int ref t
val mk_float : default:float -> float ref t
val mk_float_opt : ?default:float -> float option ref t
val mk_string : default:string -> ?f:(string -> string) -> string ref t
val mk_string_opt : ?default:string -> ?f:(string -> string) -> string option ref t

@ -955,7 +955,7 @@ and linters_def_file =
~meta:"file" "Specify the file containing linters definition"
and load_average =
CLOpt.mk_float ~long:"load-average" ~short:"l" ~default:(float_of_int ncpu)
CLOpt.mk_float_opt ~long:"load-average" ~short:"l"
~exes:CLOpt.[Toplevel] ~meta:"float"
"Do not start new parallel jobs if the load average is greater than that specified (Buck and \
make only)"
@ -1444,7 +1444,11 @@ and jobs = !jobs
and join_cond = !join_cond
and latex = !latex
and linters_def_file = !linters_def_file
and load_average = !load_average
and load_average = match !load_average with
| None when !buck ->
Some (float_of_int ncpu)
| _ ->
!load_average
and load_analysis_results = !load_results
and makefile_cmdline = !makefile
and merge = !merge

@ -81,7 +81,7 @@ val ivar_attributes : string
val lib_dir : string
val lint_dotty_dir_name : string
val lint_issues_dir_name : string
val load_average : float
val load_average : float option
val log_analysis_crash : string
val log_analysis_file : string
val log_analysis_procedure : string

Loading…
Cancel
Save