aboutsummaryrefslogtreecommitdiff
path: root/gdb/m32r-rom.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-08-02 03:02:05 +0000
committerDaniel Jacobowitz <drow@false.org>2005-08-02 03:02:05 +0000
commit2b71414df9c47e9a1deca9885bf59ecbfa82a0ad (patch)
tree96f62a4374fb903ff360f9bce3fe841753196869 /gdb/m32r-rom.c
parent4bb64c2874fb99d88129a9f329586625f9a2853b (diff)
downloadgdb-2b71414df9c47e9a1deca9885bf59ecbfa82a0ad.zip
gdb-2b71414df9c47e9a1deca9885bf59ecbfa82a0ad.tar.gz
gdb-2b71414df9c47e9a1deca9885bf59ecbfa82a0ad.tar.bz2
Suggested by Shaun Jackman <sjackman@gmail.com>:
* defs.h (print_transfer_performance): Update prototype. * m32r-rom.c (m32r_load, m32r_upload_command): Use gettimeofday for print_transfer_performance. * remote-m32r-sdi.c (m32r_load): Likewise. * symfile.c (generic_load): Likewise. (report_transfer_performance): Create a dummy struct timeval. (print_transfer_performance): Use a more accurate measure of performance.
Diffstat (limited to 'gdb/m32r-rom.c')
-rw-r--r--gdb/m32r-rom.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index f9cc5e0..a6c70e8 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -1,8 +1,8 @@
/* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
the GNU debugger.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2004 Free Software
- Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005
+ Free Software Foundation, Inc.
Adapted by Michael Snyder of Cygnus Support.
@@ -35,6 +35,7 @@
#include "command.h"
#include "gdbcmd.h"
#include "symfile.h" /* for generic load */
+#include <sys/time.h>
#include <time.h> /* for time_t */
#include "gdb_string.h"
#include "objfiles.h" /* for ALL_OBJFILES etc. */
@@ -119,7 +120,7 @@ m32r_load (char *filename, int from_tty)
bfd *abfd;
asection *s;
unsigned int i, data_count = 0;
- time_t start_time, end_time; /* for timing of download */
+ struct timeval start_time, end_time;
if (filename == NULL || filename[0] == 0)
filename = get_exec_file (1);
@@ -129,7 +130,7 @@ m32r_load (char *filename, int from_tty)
error (_("Unable to open file %s."), filename);
if (bfd_check_format (abfd, bfd_object) == 0)
error (_("File is not an object file."));
- start_time = time (NULL);
+ gettimeofday (&start_time, NULL);
#if 0
for (s = abfd->sections; s; s = s->next)
if (s->flags & SEC_LOAD)
@@ -163,10 +164,10 @@ m32r_load (char *filename, int from_tty)
return;
}
#endif
- end_time = time (NULL);
+ gettimeofday (&end_time, NULL);
printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
- print_transfer_performance (gdb_stdout, data_count, 0,
- end_time - start_time);
+ print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
+ &end_time);
/* Finally, make the PC point at the start address */
if (exec_bfd)
@@ -405,7 +406,7 @@ m32r_upload_command (char *args, int from_tty)
{
bfd *abfd;
asection *s;
- time_t start_time, end_time; /* for timing of download */
+ struct timeval start_time, end_time;
int resp_len, data_count = 0;
char buf[1024];
struct hostent *hostent;
@@ -467,7 +468,7 @@ m32r_upload_command (char *args, int from_tty)
("Need to know default download path (use 'set download-path')");
}
- start_time = time (NULL);
+ gettimeofday (&start_time, NULL);
monitor_printf ("uhip %s\r", server_addr);
resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
monitor_printf ("ulip %s\r", board_addr);
@@ -491,7 +492,7 @@ m32r_upload_command (char *args, int from_tty)
else
printf_filtered (" -- Ethernet load complete.\n");
- end_time = time (NULL);
+ gettimeofday (&end_time, NULL);
abfd = bfd_openr (args, 0);
if (abfd != NULL)
{ /* Download is done -- print section statistics */
@@ -517,8 +518,8 @@ m32r_upload_command (char *args, int from_tty)
/* Finally, make the PC point at the start address */
write_pc (bfd_get_start_address (abfd));
printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
- print_transfer_performance (gdb_stdout, data_count, 0,
- end_time - start_time);
+ print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
+ &end_time);
}
inferior_ptid = null_ptid; /* No process now */