From 89770117378a05d28b439d4956f27b0709156b1b Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Fri, 20 Jul 2018 05:46:36 -0700 Subject: [PATCH] [taskbar] display on-demand nesting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- infer/src/backend/ondemand.ml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml index 032311e6c..f8347dd0c 100644 --- a/infer/src/backend/ondemand.ml +++ b/infer/src/backend/ondemand.ml @@ -26,7 +26,10 @@ let set_callbacks (callbacks: callbacks) = callbacks_ref := Some callbacks 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 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 source_file = (Procdesc.get_attributes callee_pdesc).ProcAttributes.translation_unit 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) ; !ProcessPoolState.update_status t0 status ; callbacks.analyze_ondemand summary pdesc