2005-07-08 Shaun Jackman * gdb/symfile.c (print_transfer_performance_ms): New function. Use gettimeofday instead of date to obtain microsecond precision. (print_transfer_performance): Call print_transfer_performance_ms. --- ./gdb/symfile.c- 2004-06-24 15:09:34.000000000 -0700 +++ ./gdb/symfile.c 2005-07-08 16:25:05.000000000 -0700 @@ -54,6 +54,7 @@ #include "gdb_string.h" #include "gdb_stat.h" #include +#include #include #ifndef O_BINARY @@ -92,6 +93,9 @@ static void symbol_file_add_main_1 (char *args, int from_tty, int flags); +static void print_transfer_performance_ms (struct ui_file *, + unsigned long, unsigned long, unsigned long); + static void add_symbol_file_command (char *, int); static void add_shared_symbol_files_command (char *, int); @@ -1460,7 +1464,7 @@ { asection *s; bfd *loadfile_bfd; - time_t start_time, end_time; /* Start and end times of download */ + struct timeval start_time, end_time; /* Start and end times of download */ char *filename; struct cleanup *old_cleanups; char *offptr; @@ -1512,11 +1516,11 @@ bfd_map_over_sections (loadfile_bfd, add_section_size_callback, (void *) &cbdata.total_size); - start_time = time (NULL); + gettimeofday(&start_time, NULL); bfd_map_over_sections (loadfile_bfd, load_section_callback, &cbdata); - end_time = time (NULL); + gettimeofday(&end_time, NULL); entry = bfd_get_start_address (loadfile_bfd); ui_out_text (uiout, "Start address "); @@ -1534,8 +1538,10 @@ file is loaded in. Some targets do (e.g., remote-vx.c) but others don't (or didn't - perhaphs they have all been deleted). */ - print_transfer_performance (gdb_stdout, cbdata.data_count, - cbdata.write_count, end_time - start_time); + print_transfer_performance_ms (gdb_stdout, cbdata.data_count, + cbdata.write_count, + (end_time.tv_sec - start_time.tv_sec)*1000 + + (end_time.tv_usec - start_time.tv_usec)/1000); do_cleanups (old_cleanups); } @@ -1554,8 +1560,8 @@ end_time - start_time, 0); } -void -print_transfer_performance (struct ui_file *stream, +static void +print_transfer_performance_ms (struct ui_file *stream, unsigned long data_count, unsigned long write_count, unsigned long time_count) @@ -1564,8 +1570,8 @@ if (time_count > 0) { ui_out_field_fmt (uiout, "transfer-rate", "%lu", - (data_count * 8) / time_count); - ui_out_text (uiout, " bits/sec"); + 1000 * data_count / time_count); + ui_out_text (uiout, " bytes/sec"); } else { @@ -1581,6 +1587,16 @@ ui_out_text (uiout, ".\n"); } +void +print_transfer_performance (struct ui_file *stream, + unsigned long data_count, + unsigned long write_count, + unsigned long time_count) +{ + print_transfer_performance_ms(stream, data_count, write_count, + 1000*time_count); +} + /* This function allows the addition of incrementally linked object files. It does not modify any state in the target, only in the debugger. */ /* Note: ezannoni 2000-04-13 This function/command used to have a