public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Sent timing stats to gdb_stdlog Date: Tue, 25 Jan 2022 22:26:00 +0000 (GMT) [thread overview] Message-ID: <20220125222600.DAE7B3853804@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=244ac24b51ba1375794eed93b58d5813e7c044ca commit 244ac24b51ba1375794eed93b58d5813e7c044ca Author: Tom Tromey <tom@tromey.com> Date: Wed Dec 29 14:16:02 2021 -0700 Sent timing stats to gdb_stdlog 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 -= get_prompt_for_continue_wait_time (); - printf_unfiltered (!m_msg_type - ? _("Startup time: %.6f (cpu), %.6f (wall)\n") - : _("Command execution time: %.6f (cpu), %.6f (wall)\n"), - duration<double> (cmd_time).count (), - duration<double> (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<double> (cmd_time).count (), + duration<double> (wall_time).count ()); } if (m_space_enabled && per_command_space) @@ -1005,12 +1006,13 @@ scoped_command_stats::~scoped_command_stats () long space_now = lim - lim_at_start; long space_diff = space_now - m_start_space; - 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 >= 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 >= 0 ? "+" : ""), + space_diff); #endif } @@ -1019,16 +1021,17 @@ scoped_command_stats::~scoped_command_stats () int nr_symtabs, nr_compunit_symtabs, nr_blocks; count_symtabs_and_blocks (&nr_symtabs, &nr_compunit_symtabs, &nr_blocks); - 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); } } @@ -1095,7 +1098,7 @@ scoped_command_stats::print_time (const char *msg) char out[100]; strftime (out, sizeof (out), "%F %H:%M:%S", &tm); - printf_unfiltered ("%s.%03d - %s\n", out, (int) millis, msg); + fprintf_unfiltered (gdb_stdlog, "%s.%03d - %s\n", out, (int) millis, msg); } /* Handle unknown "mt set per-command" arguments.
reply other threads:[~2022-01-25 22:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220125222600.DAE7B3853804@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).