]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* symfile.c (report_transfer_performance): New function.
authorStan Shebs <shebs@codesourcery.com>
Thu, 4 Apr 1996 23:57:02 +0000 (23:57 +0000)
committerStan Shebs <shebs@codesourcery.com>
Thu, 4 Apr 1996 23:57:02 +0000 (23:57 +0000)
(generic_load): Call it to report transfer rate.
* remote-e7000.c (e7000_load): Ditto.
PR 9353

gdb/ChangeLog
gdb/remote-e7000.c
gdb/symfile.c

index 8f658a2670fbce17d72d24ae472419ded1a57a39..8c0718b85ae5d295e7b73fe88291d82e8756b9cf 100644 (file)
@@ -1,3 +1,9 @@
+Thu Apr  4 15:43:07 1996  Stan Shebs  <shebs@andros.cygnus.com>
+
+       * symfile.c (report_transfer_performance): New function.
+       (generic_load): Call it to report transfer rate.
+       * remote-e7000.c (e7000_load): Ditto.
+
 Mon Apr  1 16:31:00 1996  Stan Shebs  <shebs@andros.cygnus.com>
 
        * mpw-make.sed: Change references to config.h to be in objdir,
index 01c985621d41aab5fe396f42eac688d5c1324d0c..e0f54b2ba8c7a644dc9410819c760a6b1a2f3fc4 100644 (file)
@@ -44,6 +44,8 @@
 #include "serial.h"
 #include "remote-utils.h"
 #include "symfile.h"
+#include <time.h>
+
 #if 0
 #define HARD_BREAKPOINTS
 #define BC_BREAKPOINTS 0
@@ -56,6 +58,9 @@
 
 extern void notice_quit PARAMS ((void));
 
+extern void report_transfer_performance PARAMS ((unsigned long,
+                                                time_t, time_t));
+
 /* Local function declarations.  */
 
 static void e7000_close PARAMS ((int));
@@ -580,8 +585,12 @@ or \t\ttarget e7000 pc\n");
 
   expect_prompt ();
 
+  puts_e7000debug ("b -\r");
+
+  expect_prompt ();
+
   if (from_tty)
-    printf_filtered ("Remote %s connected to %s\n", target_shortname,
+    printf_filtered ("Remote target %s connected to %s\n", target_shortname,
                     dev_name);
 
 #ifdef GDB_TARGET_IS_H8300
@@ -1391,6 +1400,8 @@ e7000_load (args, from_tty)
   char *filename;
   int quiet;
   int nostart;
+  time_t start_time, end_time; /* Start and end times of download */
+  unsigned long data_count;    /* Number of bytes transferred to memory */
 
   if (!strchr (dev_name, ':'))
     {
@@ -1442,6 +1453,9 @@ e7000_load (args, from_tty)
     error ("\"%s\" is not an object file: %s", filename,
           bfd_errmsg (bfd_get_error ()));
 
+  start_time = time (NULL);
+  data_count = 0;
+
   puts_e7000debug ("mw\r");
 
   expect ("\nOK");
@@ -1465,6 +1479,8 @@ e7000_load (args, from_tty)
 
          fptr = 0;
          
+         data_count += section_size;
+
          while (section_size > 0)
            {
              int count;
@@ -1488,7 +1504,9 @@ e7000_load (args, from_tty)
              bfd_get_section_contents (pbfd, section, buf + 10, fptr, count);
 
              if (SERIAL_WRITE (e7000_desc, buf, count + 10))
-               fprintf_unfiltered (gdb_stderr, "e7000_load: SERIAL_WRITE failed: %s\n", safe_strerror(errno));
+               fprintf_unfiltered (gdb_stderr,
+                                   "e7000_load: SERIAL_WRITE failed: %s\n",
+                                   safe_strerror(errno));
 
              expect ("OK");
 
@@ -1509,6 +1527,8 @@ e7000_load (args, from_tty)
 
   expect_prompt ();
 
+  end_time = time (NULL);
+
 /* Finally, make the PC point at the start address */
 
   if (exec_bfd)
@@ -1534,6 +1554,8 @@ e7000_load (args, from_tty)
 /*      start_routine (entry);*/
     }
 
+  report_transfer_performance (data_count, start_time, end_time);
+
   do_cleanups (old_chain);
 }
 
index de2928f39c8ff7ba910a584da438616f0649842b..f5d4e15524952e2d363ab30de7aed547b2addd4b 100644 (file)
@@ -67,34 +67,28 @@ struct complaint empty_symtab_complaint = {
 
 extern int info_verbose;
 
+extern void report_transfer_performance PARAMS ((unsigned long,
+                                                time_t, time_t));
+
 /* Functions this file defines */
 
-static void
-set_initial_language PARAMS ((void));
+static void set_initial_language PARAMS ((void));
 
-static void
-load_command PARAMS ((char *, int));
+static void load_command PARAMS ((char *, int));
 
-static void
-add_symbol_file_command PARAMS ((char *, int));
+static void add_symbol_file_command PARAMS ((char *, int));
 
-static void
-add_shared_symbol_files_command PARAMS ((char *, int));
+static void add_shared_symbol_files_command PARAMS ((char *, int));
 
-static void
-cashier_psymtab PARAMS ((struct partial_symtab *));
+static void cashier_psymtab PARAMS ((struct partial_symtab *));
 
-static int
-compare_psymbols PARAMS ((const void *, const void *));
+static int compare_psymbols PARAMS ((const void *, const void *));
 
-static int
-compare_symbols PARAMS ((const void *, const void *));
+static int compare_symbols PARAMS ((const void *, const void *));
 
-static bfd *
-symfile_bfd_open PARAMS ((char *));
+static bfd *symfile_bfd_open PARAMS ((char *));
 
-static void
-find_sym_fns PARAMS ((struct objfile *));
+static void find_sym_fns PARAMS ((struct objfile *));
 
 /* List of all available sym_fns.  On gdb startup, each object file reader
    calls add_symtab_fns() to register information on each format it is
@@ -995,13 +989,27 @@ generic_load (filename, from_tty)
      loaded in.  remote-nindy.c had no call to symbol_file_add, but remote-vx.c
      does.  */
 
-  if (end_time != start_time)
-   printf_filtered ("Transfer rate: %d bits/sec.\n",
-                    (data_count * 8)/(end_time - start_time));
+  report_transfer_performance (data_count, start_time, end_time);
 
   do_cleanups (old_cleanups);
 }
 
+/* Report how fast the transfer went. */
+
+void
+report_transfer_performance (data_count, start_time, end_time)
+unsigned long data_count;
+time_t start_time, end_time;
+{
+  printf_filtered ("Transfer rate: ");
+  if (end_time != start_time)
+    printf_filtered ("%d bits/sec",
+                    (data_count * 8) / (end_time - start_time));
+  else
+    printf_filtered ("%d bits in <1 sec", (data_count * 8));
+  printf_filtered (".\n");
+}
+
 /* This function allows the addition of incrementally linked object files.
    It does not modify any state in the target, only in the debugger.  */