[starvation] add more detail in reporting

Summary: Add more informative messaging in report string.

Reviewed By: da319

Differential Revision: D27674828

fbshipit-source-id: 52c4ada0b
master
Nikos Gorogiannis 4 years ago committed by Facebook GitHub Bot
parent f0ea201f25
commit bea3f3b439

@ -674,7 +674,8 @@ let report_on_parallel_composition ~should_report_starvation tenv pattrs pair lo
&& Acquisitions.lock_is_held_in_other_thread tenv lock acquisitions -> && Acquisitions.lock_is_held_in_other_thread tenv lock acquisitions ->
let error_message = let error_message =
Format.asprintf Format.asprintf
"Method %a runs on UI thread and%a, which may be held by another thread which %a." "Method %a runs on UI thread and%a, which may be held by another thread which %a. \
This may regress scroll performance or cause ANRs."
pname_pp pname Lock.pp_locks lock Event.describe event pname_pp pname Lock.pp_locks lock Event.describe event
in in
let ltr, loc = make_trace_and_loc () in let ltr, loc = make_trace_and_loc () in
@ -685,7 +686,8 @@ let report_on_parallel_composition ~should_report_starvation tenv pattrs pair lo
&& not (Lock.equal lock monitor_lock) -> && not (Lock.equal lock monitor_lock) ->
let error_message = let error_message =
Format.asprintf Format.asprintf
"Method %a runs on UI thread and%a, which may be held by another thread which %a." "Method %a runs on UI thread and%a, which may be held by another thread which %a. \
This may regress scroll performance or cause ANRs."
pname_pp pname Lock.pp_locks lock Event.describe other_pair.CriticalPair.elem.event pname_pp pname Lock.pp_locks lock Event.describe other_pair.CriticalPair.elem.event
in in
let ltr, loc = make_trace_and_loc () in let ltr, loc = make_trace_and_loc () in
@ -724,22 +726,28 @@ let report_on_pair ~analyze_ondemand tenv pattrs (pair : Domain.CriticalPair.t)
match event with match event with
| Ipc _ when is_not_private && should_report_starvation -> | Ipc _ when is_not_private && should_report_starvation ->
let error_message = let error_message =
Format.asprintf "Method %a runs on UI thread and may perform blocking IPC; %a." pname_pp Format.asprintf
pname Event.describe event "Method %a runs on UI thread and may perform blocking IPC, potentially regressing scroll \
performance or causing ANRs; %a."
pname_pp pname Event.describe event
in in
let ltr, loc = make_trace_and_loc () in let ltr, loc = make_trace_and_loc () in
ReportMap.add_ipc tenv pattrs loc ltr error_message report_map ReportMap.add_ipc tenv pattrs loc ltr error_message report_map
| MayBlock _ when is_not_private && should_report_starvation -> | MayBlock _ when is_not_private && should_report_starvation ->
let error_message = let error_message =
Format.asprintf "Method %a runs on UI thread and may block; %a." pname_pp pname Format.asprintf
Event.describe event "Method %a runs on UI thread and may block, potentially regressing scroll performance or \
causing ANRs; %a."
pname_pp pname Event.describe event
in in
let ltr, loc = make_trace_and_loc () in let ltr, loc = make_trace_and_loc () in
ReportMap.add_starvation tenv pattrs loc ltr error_message report_map ReportMap.add_starvation tenv pattrs loc ltr error_message report_map
| MonitorWait _ when is_not_private && should_report_starvation -> | MonitorWait _ when is_not_private && should_report_starvation ->
let error_message = let error_message =
Format.asprintf "Method %a runs on UI thread and may block; %a." pname_pp pname Format.asprintf
Event.describe event "Method %a runs on UI thread and may block, potentially regressing scroll performance or \
causing ANRs; %a."
pname_pp pname Event.describe event
in in
let ltr, loc = make_trace_and_loc () in let ltr, loc = make_trace_and_loc () in
ReportMap.add_starvation tenv pattrs loc ltr error_message report_map ReportMap.add_starvation tenv pattrs loc ltr error_message report_map

Loading…
Cancel
Save