[taskbar] display on-demand nesting

Summary:
Print one `>` for each nested call to ondemand analysis. This is fun to watch:

```
Found 632 source files to analyze in /home/jul/code/openssl-1.1.0d/infer-out-libs
  1/632 [............................................................................] 0% 2.021s
⊢ [ 0.8s] ssl/t1_lib.c: tls1_set_ec_id
⊢ [ 0.0s] >>>>>>crypto/threads_pthread.c: CRYPTO_THREAD_write_lock
⊢ [ 1.2s] >>>>crypto/mem.c: CRYPTO_zalloc
⊢ [ 0.0s] >>>crypto/threads_pthread.c: CRYPTO_THREAD_set_local
```

```
  1/632 [............................................................................] 0% 26.094s
⊢ [ 0.5s] 12>crypto/stack/stack.c: OPENSSL_sk_insert
⊢ [ 1.1s] 11>crypto/stack/stack.c: OPENSSL_sk_insert
⊢ [ 2.0s] 11>crypto/mem.c: CRYPTO_realloc
⊢ [ 3.7s] >>>>>>>crypto/engine/tb_asnmth.c: engine_pkey_asn1_meths_free

```

Reviewed By: ezgicicek, ngorogiannis

Differential Revision: D8931305

fbshipit-source-id: bd9d8e0c6
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 84cfd0a450
commit 8977011737

@ -26,7 +26,10 @@ let set_callbacks (callbacks: callbacks) = callbacks_ref := Some callbacks
let unset_callbacks () = callbacks_ref := None let unset_callbacks () = callbacks_ref := None
let nesting = ref 0 (* always incremented before use *)
let nesting = ref (-1)
let max_nesting_to_print = 8
(* Remember what the last status sent was so that we can update the status correctly when entering (* Remember what the last status sent was so that we can update the status correctly when entering
and exiting nested ondemand analyses. In particular we need to remember the original time.*) and exiting nested ondemand analyses. In particular we need to remember the original time.*)
@ -191,7 +194,13 @@ let analyze_proc ?caller_pdesc callee_pdesc =
let proc_name = Procdesc.get_proc_name callee_pdesc in let proc_name = Procdesc.get_proc_name callee_pdesc in
let source_file = (Procdesc.get_attributes callee_pdesc).ProcAttributes.translation_unit in let source_file = (Procdesc.get_attributes callee_pdesc).ProcAttributes.translation_unit in
let t0 = Mtime_clock.now () in let t0 = Mtime_clock.now () in
let status = F.asprintf "%a: %a" SourceFile.pp source_file Typ.Procname.pp proc_name in let status =
let nesting =
if !nesting <= max_nesting_to_print then String.make !nesting '>'
else Printf.sprintf "%d>" !nesting
in
F.asprintf "%s%a: %a" nesting SourceFile.pp source_file Typ.Procname.pp proc_name
in
current_taskbar_status := Some (t0, status) ; current_taskbar_status := Some (t0, status) ;
!ProcessPoolState.update_status t0 status ; !ProcessPoolState.update_status t0 status ;
callbacks.analyze_ondemand summary pdesc callbacks.analyze_ondemand summary pdesc

Loading…
Cancel
Save