From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id DAE7B3853804; Tue, 25 Jan 2022 22:26:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAE7B3853804 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Sent timing stats to gdb_stdlog X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 1475b18b772bc06830b221edfdb0259ac2db6773 X-Git-Newrev: 244ac24b51ba1375794eed93b58d5813e7c044ca Message-Id: <20220125222600.DAE7B3853804@sourceware.org> Date: Tue, 25 Jan 2022 22:26:00 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2022 22:26:01 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D244ac24b51ba= 1375794eed93b58d5813e7c044ca commit 244ac24b51ba1375794eed93b58d5813e7c044ca Author: Tom Tromey Date: Wed Dec 29 14:16:02 2021 -0700 Sent timing stats to gdb_stdlog =20 This changes the time / space / symtab per-command statistics code to send its output to gdb_stdlog rather than gdb_stdout. This seems slightly more correct to me. Diff: --- gdb/maint.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/gdb/maint.c b/gdb/maint.c index 3584974c9e1..7e84b60fea0 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -990,11 +990,12 @@ scoped_command_stats::~scoped_command_stats () /* Subtract time spend in prompt_for_continue from walltime. */ wall_time -=3D get_prompt_for_continue_wait_time (); =20 - printf_unfiltered (!m_msg_type - ? _("Startup time: %.6f (cpu), %.6f (wall)\n") - : _("Command execution time: %.6f (cpu), %.6f (wall)\n"), - duration (cmd_time).count (), - duration (wall_time).count ()); + fprintf_unfiltered (gdb_stdlog, + !m_msg_type + ? _("Startup time: %.6f (cpu), %.6f (wall)\n") + : _("Command execution time: %.6f (cpu), %.6f (wall)\n"), + duration (cmd_time).count (), + duration (wall_time).count ()); } =20 if (m_space_enabled && per_command_space) @@ -1005,12 +1006,13 @@ scoped_command_stats::~scoped_command_stats () long space_now =3D lim - lim_at_start; long space_diff =3D space_now - m_start_space; =20 - printf_unfiltered (!m_msg_type - ? _("Space used: %ld (%s%ld during startup)\n") - : _("Space used: %ld (%s%ld for this command)\n"), - space_now, - (space_diff >=3D 0 ? "+" : ""), - space_diff); + fprintf_unfiltered (gdb_stdlog, + !m_msg_type + ? _("Space used: %ld (%s%ld during startup)\n") + : _("Space used: %ld (%s%ld for this command)\n"), + space_now, + (space_diff >=3D 0 ? "+" : ""), + space_diff); #endif } =20 @@ -1019,16 +1021,17 @@ scoped_command_stats::~scoped_command_stats () int nr_symtabs, nr_compunit_symtabs, nr_blocks; =20 count_symtabs_and_blocks (&nr_symtabs, &nr_compunit_symtabs, &nr_blo= cks); - printf_unfiltered (_("#symtabs: %d (+%d)," - " #compunits: %d (+%d)," - " #blocks: %d (+%d)\n"), - nr_symtabs, - nr_symtabs - m_start_nr_symtabs, - nr_compunit_symtabs, - (nr_compunit_symtabs - - m_start_nr_compunit_symtabs), - nr_blocks, - nr_blocks - m_start_nr_blocks); + fprintf_unfiltered (gdb_stdlog, + _("#symtabs: %d (+%d)," + " #compunits: %d (+%d)," + " #blocks: %d (+%d)\n"), + nr_symtabs, + nr_symtabs - m_start_nr_symtabs, + nr_compunit_symtabs, + (nr_compunit_symtabs + - m_start_nr_compunit_symtabs), + nr_blocks, + nr_blocks - m_start_nr_blocks); } } =20 @@ -1095,7 +1098,7 @@ scoped_command_stats::print_time (const char *msg) char out[100]; strftime (out, sizeof (out), "%F %H:%M:%S", &tm); =20 - printf_unfiltered ("%s.%03d - %s\n", out, (int) millis, msg); + fprintf_unfiltered (gdb_stdlog, "%s.%03d - %s\n", out, (int) millis, msg= ); } =20 /* Handle unknown "mt set per-command" arguments.