Fix MI timings.
* mi/mi-main.c (mi_print_timing_maybe): New. (captured_mi_execute_command): Simplify. Output timings to CLI commands, too. (mi_execute_async_cli_command): Do not print timings. * mi/mi-main.h (mi_print_timing_maybe): Declare. * mi/mi-interp.c (mi_on_normal_stop): Call mi_print_timing_maybe.
This commit is contained in:
parent
c5933f6db9
commit
4333ada327
|
@ -1,3 +1,14 @@
|
||||||
|
2009-03-12 Vladimir Prus <vladimir@codesourcery.com>
|
||||||
|
|
||||||
|
Fix MI timings.
|
||||||
|
|
||||||
|
* mi/mi-main.c (mi_print_timing_maybe): New.
|
||||||
|
(captured_mi_execute_command): Simplify. Output timings to
|
||||||
|
CLI commands, too.
|
||||||
|
(mi_execute_async_cli_command): Do not print timings.
|
||||||
|
* mi/mi-main.h (mi_print_timing_maybe): Declare.
|
||||||
|
* mi/mi-interp.c (mi_on_normal_stop): Call mi_print_timing_maybe.
|
||||||
|
|
||||||
2009-03-12 Jerome Guitton <guitton@adacore.com>
|
2009-03-12 Jerome Guitton <guitton@adacore.com>
|
||||||
|
|
||||||
* xcoffread.c (process_linenos): Check if the line in the
|
* xcoffread.c (process_linenos): Check if the line in the
|
||||||
|
|
|
@ -362,6 +362,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
|
||||||
fputs_unfiltered ("*stopped", raw_stdout);
|
fputs_unfiltered ("*stopped", raw_stdout);
|
||||||
mi_out_put (mi_uiout, raw_stdout);
|
mi_out_put (mi_uiout, raw_stdout);
|
||||||
mi_out_rewind (mi_uiout);
|
mi_out_rewind (mi_uiout);
|
||||||
|
mi_print_timing_maybe ();
|
||||||
fputs_unfiltered ("\n", raw_stdout);
|
fputs_unfiltered ("\n", raw_stdout);
|
||||||
gdb_flush (raw_stdout);
|
gdb_flush (raw_stdout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1139,7 +1139,8 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
|
||||||
{
|
{
|
||||||
struct mi_parse *context = (struct mi_parse *) data;
|
struct mi_parse *context = (struct mi_parse *) data;
|
||||||
|
|
||||||
struct mi_timestamp cmd_finished;
|
if (do_timings)
|
||||||
|
current_command_ts = context->cmd_start;
|
||||||
|
|
||||||
running_result_record_printed = 0;
|
running_result_record_printed = 0;
|
||||||
switch (context->op)
|
switch (context->op)
|
||||||
|
@ -1151,14 +1152,9 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
|
||||||
fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n",
|
fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n",
|
||||||
context->token, context->command, context->args);
|
context->token, context->command, context->args);
|
||||||
|
|
||||||
if (do_timings)
|
|
||||||
current_command_ts = context->cmd_start;
|
|
||||||
|
|
||||||
mi_cmd_execute (context);
|
mi_cmd_execute (context);
|
||||||
|
|
||||||
if (do_timings)
|
|
||||||
timestamp (&cmd_finished);
|
|
||||||
|
|
||||||
/* Print the result if there were no errors.
|
/* Print the result if there were no errors.
|
||||||
|
|
||||||
Remember that on the way out of executing a command, you have
|
Remember that on the way out of executing a command, you have
|
||||||
|
@ -1174,10 +1170,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
|
||||||
? "^connected" : "^done", raw_stdout);
|
? "^connected" : "^done", raw_stdout);
|
||||||
mi_out_put (uiout, raw_stdout);
|
mi_out_put (uiout, raw_stdout);
|
||||||
mi_out_rewind (uiout);
|
mi_out_rewind (uiout);
|
||||||
/* Have to check cmd_start, since the command could be
|
mi_print_timing_maybe ();
|
||||||
-enable-timings. */
|
|
||||||
if (do_timings && context->cmd_start)
|
|
||||||
print_diff (context->cmd_start, &cmd_finished);
|
|
||||||
fputs_unfiltered ("\n", raw_stdout);
|
fputs_unfiltered ("\n", raw_stdout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1212,6 +1205,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
|
||||||
fputs_unfiltered ("^done", raw_stdout);
|
fputs_unfiltered ("^done", raw_stdout);
|
||||||
mi_out_put (uiout, raw_stdout);
|
mi_out_put (uiout, raw_stdout);
|
||||||
mi_out_rewind (uiout);
|
mi_out_rewind (uiout);
|
||||||
|
mi_print_timing_maybe ();
|
||||||
fputs_unfiltered ("\n", raw_stdout);
|
fputs_unfiltered ("\n", raw_stdout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1447,8 +1441,6 @@ mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
|
||||||
/* Do this before doing any printing. It would appear that some
|
/* Do this before doing any printing. It would appear that some
|
||||||
print code leaves garbage around in the buffer. */
|
print code leaves garbage around in the buffer. */
|
||||||
do_cleanups (old_cleanups);
|
do_cleanups (old_cleanups);
|
||||||
if (do_timings)
|
|
||||||
print_diff_now (current_command_ts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1567,6 +1559,15 @@ print_diff_now (struct mi_timestamp *start)
|
||||||
print_diff (start, &now);
|
print_diff (start, &now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mi_print_timing_maybe (void)
|
||||||
|
{
|
||||||
|
/* If the command is -enable-timing then do_timings may be
|
||||||
|
true whilst current_command_ts is not initialized. */
|
||||||
|
if (do_timings && current_command_ts)
|
||||||
|
print_diff_now (current_command_ts);
|
||||||
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
timeval_diff (struct timeval start, struct timeval end)
|
timeval_diff (struct timeval start, struct timeval end)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,5 +30,7 @@ extern char *current_token;
|
||||||
|
|
||||||
extern int running_result_record_printed;
|
extern int running_result_record_printed;
|
||||||
|
|
||||||
|
void mi_print_timing_maybe ();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue