[starvation] fix typo in reporting

Summary: Typo and simplifications.

Reviewed By: jberdine

Differential Revision: D10216766

fbshipit-source-id: b203eaa85
master
Nikos Gorogiannis 6 years ago committed by Facebook Github Bot
parent 309ce2d362
commit 41e43b5c1e

@ -228,7 +228,8 @@ end = struct
| StrictModeViolation _ -> | StrictModeViolation _ ->
IssueType.strict_mode_violation IssueType.strict_mode_violation
in in
Reporting.log_issue_external pname Exceptions.Error ~loc ~ltr issue_type message if Reporting.is_suppressed tenv pdesc issue_type then ()
else Reporting.log_issue_external pname Exceptions.Error ~loc ~ltr issue_type message
in in
let mk_deduped_report reports ({message} as report) = let mk_deduped_report reports ({message} as report) =
{ report with { report with
@ -239,40 +240,28 @@ end = struct
let log_reports compare loc = function let log_reports compare loc = function
| [] -> | [] ->
() ()
| [(_, report, _)] -> | [(_, report)] ->
log_report loc report log_report loc report
| reports -> | reports ->
List.max_elt ~compare reports List.max_elt ~compare reports
|> Option.iter ~f:(fun (_, rep, _) -> mk_deduped_report reports rep |> log_report loc) |> Option.iter ~f:(fun (_, rep) -> mk_deduped_report reports rep |> log_report loc)
in in
let filter_map_deadlock report = let filter_map_deadlock = function {problem= Deadlock l} as r -> Some (l, r) | _ -> None in
if Reporting.is_suppressed tenv pdesc IssueType.deadlock then None let filter_map_starvation = function
else | {problem= Starvation s} as r ->
match report with Some (s, r)
| {problem= Deadlock len} -> | _ ->
Some (len, report, IssueType.deadlock) None
| _ ->
None
in in
let filter_map_starvation report = let filter_map_strict_mode_violation = function
if Reporting.is_suppressed tenv pdesc IssueType.starvation then None | {problem= StrictModeViolation l} as r ->
else Some (l, r)
match report with | _ ->
| {problem= Starvation sev} -> None
Some (sev, report, IssueType.starvation)
| _ ->
None
in in
let filter_map_strict_mode_violation report = let compare_reports weight_compare (w, r) (w', r') =
if Reporting.is_suppressed tenv pdesc IssueType.deadlock then None match weight_compare w w' with 0 -> String.compare r.message r'.message | result -> result
else
match report with
| {problem= StrictModeViolation len} ->
Some (len, report, IssueType.strict_mode_violation)
| _ ->
None
in in
let compare_reports weight_compare (w, _, _) (w', _, _) = weight_compare w w' in
let log_location loc problems = let log_location loc problems =
let deadlocks = List.filter_map problems ~f:filter_map_deadlock in let deadlocks = List.filter_map problems ~f:filter_map_deadlock in
log_reports (compare_reports Int.compare) loc deadlocks ; log_reports (compare_reports Int.compare) loc deadlocks ;

Loading…
Cancel
Save