2007-07-03 Ilko Iliev <iliev@ronetix.at>
Daniel Jacobowitz <dan@codesourcery.com> * symfile.c (print_transfer_performance): Avoid integer overflow. Use larger units.
This commit is contained in:
parent
3cfad14c4a
commit
9f43d28cb0
2 changed files with 24 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-07-03 Ilko Iliev <iliev@ronetix.at>
|
||||||
|
Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* symfile.c (print_transfer_performance): Avoid integer overflow.
|
||||||
|
Use larger units.
|
||||||
|
|
||||||
2007-07-03 Markus Deuling <deuling@de.ibm.com>
|
2007-07-03 Markus Deuling <deuling@de.ibm.com>
|
||||||
|
|
||||||
* cp-namespace.c (lookup_symbol_file): Add block to
|
* cp-namespace.c (lookup_symbol_file): Add block to
|
||||||
|
|
|
@ -1947,7 +1947,7 @@ print_transfer_performance (struct ui_file *stream,
|
||||||
const struct timeval *start_time,
|
const struct timeval *start_time,
|
||||||
const struct timeval *end_time)
|
const struct timeval *end_time)
|
||||||
{
|
{
|
||||||
unsigned long time_count;
|
ULONGEST time_count;
|
||||||
|
|
||||||
/* Compute the elapsed time in milliseconds, as a tradeoff between
|
/* Compute the elapsed time in milliseconds, as a tradeoff between
|
||||||
accuracy and overflow. */
|
accuracy and overflow. */
|
||||||
|
@ -1957,9 +1957,23 @@ print_transfer_performance (struct ui_file *stream,
|
||||||
ui_out_text (uiout, "Transfer rate: ");
|
ui_out_text (uiout, "Transfer rate: ");
|
||||||
if (time_count > 0)
|
if (time_count > 0)
|
||||||
{
|
{
|
||||||
ui_out_field_fmt (uiout, "transfer-rate", "%lu",
|
unsigned long rate = ((ULONGEST) data_count * 1000) / time_count;
|
||||||
1000 * (data_count * 8) / time_count);
|
|
||||||
ui_out_text (uiout, " bits/sec");
|
if (ui_out_is_mi_like_p (uiout))
|
||||||
|
{
|
||||||
|
ui_out_field_fmt (uiout, "transfer-rate", "%lu", rate * 8);
|
||||||
|
ui_out_text (uiout, " bits/sec");
|
||||||
|
}
|
||||||
|
else if (rate < 1024)
|
||||||
|
{
|
||||||
|
ui_out_field_fmt (uiout, "transfer-rate", "%lu", rate);
|
||||||
|
ui_out_text (uiout, " bytes/sec");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui_out_field_fmt (uiout, "transfer-rate", "%lu", rate / 1024);
|
||||||
|
ui_out_text (uiout, " KB/sec");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue