* cli/cli-cmds.c (disassemble_command): Add support of disassemble
[deliverable/binutils-gdb.git] / gdb / event-top.c
index 718e245014c3ac3e884e9d803b5179a2345511c2..0fc7f899a0e7b809cc9ca9eefa8807326b7ca460 100644 (file)
@@ -476,12 +476,7 @@ static void
 command_handler (char *command)
 {
   int stdin_is_tty = ISATTY (stdin);
-  long time_at_cmd_start;
-#ifdef HAVE_SBRK
-  long space_at_cmd_start = 0;
-#endif
-  extern int display_time;
-  extern int display_space;
+  struct cleanup *stat_chain;
 
   quit_flag = 0;
   if (instream == stdin && stdin_is_tty)
@@ -498,43 +493,14 @@ command_handler (char *command)
       execute_command ("quit", stdin == instream);
     }
 
-  time_at_cmd_start = get_run_time ();
-
-  if (display_space)
-    {
-#ifdef HAVE_SBRK
-      char *lim = (char *) sbrk (0);
-
-      space_at_cmd_start = lim - lim_at_start;
-#endif
-    }
+  stat_chain = make_command_stats_cleanup (1);
 
   execute_command (command, instream == stdin);
 
   /* Do any commands attached to breakpoint we stopped at.  */
   bpstat_do_actions ();
 
-  if (display_time)
-    {
-      long cmd_time = get_run_time () - time_at_cmd_start;
-
-      printf_unfiltered (_("Command execution time: %ld.%06ld\n"),
-                        cmd_time / 1000000, cmd_time % 1000000);
-    }
-
-  if (display_space)
-    {
-#ifdef HAVE_SBRK
-      char *lim = (char *) sbrk (0);
-      long space_now = lim - lim_at_start;
-      long space_diff = space_now - space_at_cmd_start;
-
-      printf_unfiltered (_("Space used: %ld (%c%ld for this command)\n"),
-                        space_now,
-                        (space_diff >= 0 ? '+' : '-'),
-                        space_diff);
-#endif
-    }
+  do_cleanups (stat_chain);
 }
 
 /* Handle a complete line of input. This is called by the callback
This page took 0.025144 seconds and 4 git commands to generate.