From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23440 invoked by alias); 28 Nov 2019 16:31:15 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 23425 invoked by uid 89); 28 Nov 2019 16:31:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=estimation X-Spam-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Print estimate usage and estimation error with --devel-trace Message-ID: <20191128163108.GA8579@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q4/txt/msg00098.txt.bz2 Hi, Be verbose in --devel-trace about using estimates, and print actual DIE count together with estimation error. Changes for low-mem mode: ... $ dwz cc1 -o 1 --devel-trace Compressing cc1 +Using die count estimate 10138840 to decide whether to count DIEs: yes Counting DIEs Hit low-mem die-limit Compressing cc1 in low-mem mode htab: off_htab allocation size: 131071 +Die count: 10188941, 100.49% of estimate htab: off_htab post-parsing size: 16777213 elements (incl. deleted): 6536209, occupancy: 0.389588 elements (excl. deleted): 1760770, occupancy: 0.104950 searches: 47219770, collisions: 0.134397 htab: off_htab final size: 16777213 elements (incl. deleted): 6536209, occupancy: 0.389588 elements (excl. deleted): 1760770, occupancy: 0.104950 searches: 75171859, collisions: 0.310610 ... Changes for regular mode: ... $ dwz cc1 -o 1 --devel-trace -lnone Compressing cc1 +Using die count estimate 10138840 to decide whether to count DIEs: no +Using die count estimate 10138840 for off_htab allocation htab: off_htab allocation size: 16777213 +Die count: 10188941, 100.49% of estimate htab: off_htab post-parsing size: 16777213 elements: 10188941, occupancy: 0.607308 searches: 27075041, collisions: 0.207744 htab: off_htab final size: 16777213 elements: 10188941, occupancy: 0.607308 searches: 34256212, collisions: 0.206357 ... Committed to trunk. Thanks, - Tom Print estimate usage and estimation error with --devel-trace 2019-11-28 Tom de Vries * dwz.c (off_htab_add_die): Print when using estimate. (read_debug_info): Same. Also keep ndies count for op_multifile. Print total die count, and estimation error. --- dwz.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/dwz.c b/dwz.c index e4b2548..3c886d6 100644 --- a/dwz.c +++ b/dwz.c @@ -1335,11 +1335,21 @@ off_htab_add_die (dw_cu_ref cu, dw_die_ref die, unsigned int *die_count) { size_t nr_dies; if (die_count && *die_count != 0) - nr_dies = *die_count; + { + nr_dies = *die_count; + if (tracing) + fprintf (stderr, "Using die count %zu for off_htab" + " allocation\n", nr_dies); + } else if (die_count_method == none) nr_dies = 0; else if (die_count_method == estimate) - nr_dies = estimated_nr_dies; + { + nr_dies = estimated_nr_dies; + if (tracing) + fprintf (stderr, "Using die count estimate %zu for off_htab" + " allocation\n", nr_dies); + } else assert (false); @@ -5118,13 +5128,20 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count) unsigned int estimated_nr_dies = estimate_nr_dies (); if (kind == DEBUG_INFO && multifile_mode == 0 - && die_count_method == estimate - && (estimated_nr_dies > max_die_limit - || estimated_nr_dies > low_mem_die_limit)) + && die_count_method == estimate) { - int try_ret = try_debug_info (dso); - if (try_ret != 0) - return try_ret; + bool do_count = (estimated_nr_dies > max_die_limit + || estimated_nr_dies > low_mem_die_limit); + if (tracing) + fprintf (stderr, "Using die count estimate %u to decide whether to" + " count DIEs: %s\n", estimated_nr_dies, + do_count ? "yes" : "no"); + if (do_count) + { + int try_ret = try_debug_info (dso); + if (try_ret != 0) + return try_ret; + } } if (likely (!fi_multifile && kind != DEBUG_TYPES)) @@ -5383,8 +5400,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count) ret = 2; goto fail; } - ndies++; } + ndies++; if (unlikely (low_mem_phase1)) die = &die_buf; else if (parent == NULL @@ -5740,6 +5757,14 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count) return 0; } + if (tracing) + { + if (op_multifile) + fprintf (stderr, "Die count: %u\n", ndies); + else + fprintf (stderr, "Die count: %u, %.2f%% of estimate\n", ndies, + (double)ndies / ((double)estimated_nr_dies / 100)); + } if (tracing) htab_report (off_htab, "off_htab post-parsing"); if (die_count)