This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Refactor 'maint time' command statistics.


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]