aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-11-04 16:45:13 +0000
committerDoug Evans <dje@google.com>2011-11-04 16:45:13 +0000
commit0a1c4d10f1054325af840fc780a121ed10d69e63 (patch)
tree602d1865bff947c8f3abe515da26de01dda5be70 /gdb/utils.c
parenta1d705ee1b50481b05809413906cc5955f3b2730 (diff)
downloadgdb-0a1c4d10f1054325af840fc780a121ed10d69e63.zip
gdb-0a1c4d10f1054325af840fc780a121ed10d69e63.tar.gz
gdb-0a1c4d10f1054325af840fc780a121ed10d69e63.tar.bz2
* utils.c: #include "timeval-utils.h".
(cmd_stats): Rename start_time to start_cpu_time. New member start_wall_time. (report_command_stats): Report wall time. (make_command_stats_cleanup): Record start wall time. doc/ * gdb.texinfo (Maintenance Commands): Update docs of "maint time".
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 5c03e71..008baac 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -45,6 +45,7 @@
#endif
#include <signal.h>
+#include "timeval-utils.h"
#include "gdbcmd.h"
#include "serial.h"
#include "bfd.h"
@@ -691,7 +692,8 @@ static int display_space;
struct cmd_stats
{
int msg_type;
- long start_time;
+ long start_cpu_time;
+ struct timeval start_wall_time;
long start_space;
};
@@ -723,12 +725,18 @@ report_command_stats (void *arg)
if (display_time)
{
- long cmd_time = get_run_time () - start_stats->start_time;
+ long cmd_time = get_run_time () - start_stats->start_cpu_time;
+ struct timeval now_wall_time, delta_wall_time;
+
+ gettimeofday (&now_wall_time, NULL);
+ timeval_sub (&delta_wall_time,
+ &now_wall_time, &start_stats->start_wall_time);
printf_unfiltered (msg_type == 0
- ? _("Startup time: %ld.%06ld\n")
- : _("Command execution time: %ld.%06ld\n"),
- cmd_time / 1000000, cmd_time % 1000000);
+ ? _("Startup time: %ld.%06ld (cpu), %ld.%06ld (wall)\n")
+ : _("Command execution time: %ld.%06ld (cpu), %ld.%06ld (wall)\n"),
+ cmd_time / 1000000, cmd_time % 1000000,
+ delta_wall_time.tv_sec, delta_wall_time.tv_usec);
}
if (display_space)
@@ -764,7 +772,8 @@ make_command_stats_cleanup (int msg_type)
#endif
new_stat->msg_type = msg_type;
- new_stat->start_time = get_run_time ();
+ new_stat->start_cpu_time = get_run_time ();
+ gettimeofday (&new_stat->start_wall_time, NULL);
return make_cleanup_dtor (report_command_stats, new_stat, xfree);
}