This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Refactor 'maint time' command statistics.
- From: Tom Tromey <tromey at redhat dot com>
- To: Paul Hilfinger <Hilfinger at adacore dot com>
- Cc: gdb-patches at sourceware dot org, brobecker at adacore dot com, Paul Hilfinger <Hilfinger at cs dot berkeley dot edu>
- Date: Thu, 24 Jun 2010 10:21:04 -0600
- Subject: Re: [RFA] Refactor 'maint time' command statistics.
- References: <1277281366-548-1-git-send-email-Hilfinger@adacore.com>
- Reply-to: tromey at redhat dot com
>>>>> "Paul" == Paul Hilfinger <Hilfinger@adacore.com> writes:
Paul> Refactor 'maint time' code and make it work for errors, too.
Paul> Consolidate code for displaying per-command time and space
Paul> statistics to avoid duplication. Piggyback on cleanups so that
Paul> statistics get printed even when commands terminate as a result of
Paul> an error.
This looks pretty good. A couple nits...
Paul> + printf_unfiltered (msg_type == 0 ?
Paul> + _("Startup time: %ld.%06ld\n") :
Paul> + _("Command execution time: %ld.%06ld\n"),
In the GNU style the "?" and ":" should appear at the start of lines,
not the end.
Paul> + printf_unfiltered (msg_type == 0 ?
Paul> + _("Space used: %ld (%c%ld during startup)\n") :
Paul> + _("Space used: %ld (%c%ld for this command)\n"),
Likewise.
Paul> + struct cmd_stats *new_stat = XMALLOC (struct cmd_stats);
[...]
Paul> + return make_cleanup (report_command_stats, new_stat);
It is more future-proof to use make_cleanup_dtor, so that the allocated
closure is freed even if the cleanup is discarded. (Then I think you
also need to remove the xfree from report_command_stats.)
This is ok with those changes.
thanks,
Tom