=== modified file 'client/client_priv.h'
--- client/client_priv.h	2012-10-09 10:36:17 +0000
+++ client/client_priv.h	2013-01-04 04:13:20 +0000
@@ -49,7 +49,7 @@
   OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
   OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
   OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
-  OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG,
+  OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_DPROGRESS_REPORT, OPT_SERVER_ARG,
   OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
   OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
   OPT_TRIGGERS,

=== modified file 'client/mysqldump.c'
--- client/mysqldump.c	2012-08-07 13:56:51 +0000
+++ client/mysqldump.c	2013-01-04 04:13:20 +0000
@@ -93,6 +93,8 @@
           (strcmp(table, "slow_log") == 0));
 }
 
+#define PROGRESS_OUT stdout
+
 static void add_load_option(DYNAMIC_STRING *str, const char *option,
                              const char *option_value);
 static ulong find_set(TYPELIB *lib, const char *x, uint length,
@@ -106,7 +108,7 @@
                 opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
                 opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
                 opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,
-                opt_set_charset=0, opt_dump_date=1,
+                opt_set_charset=0, opt_progress_report, opt_dump_date=1,
                 opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
                 opt_delete_master_logs=0, tty_password=0,
                 opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
@@ -464,6 +466,10 @@
    "Add 'SET NAMES default_character_set' to the output.",
    &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
    0, 0, 0, 0, 0},
+  {"progress-report", OPT_DPROGRESS_REPORT, "Report progress when dumping.",
+   &opt_progress_report, &opt_progress_report, 0, GET_BOOL,
+   NO_ARG, 0, 0, 0, 0, 0, 0},
+
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
    "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
@@ -940,6 +946,12 @@
   if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
     return(ho_error);
 
+  /* Disable reporting progress, avoid affecting  */
+  if (md_result_file == stdout)
+  {
+    opt_progress_report= 0;
+  }
+
   *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
   *mysql_params->p_net_buffer_length= opt_net_buffer_length;
   if (debug_info_flag)
@@ -2218,6 +2230,35 @@
   DBUG_RETURN(0);
 }
 
+/* get row number(estimate) of db.table from information.tables */
+static ulong get_table_rows(char *table, char *db, char *where)
+{
+  DBUG_ENTER("get_table_rows");
+
+  MYSQL_RES  *result;
+  MYSQL_ROW  row;
+  char query_buff[QUERY_LENGTH];
+  char *row_num_stmt;
+  if(!where)
+  {
+    row_num_stmt= "select TABLE_ROWS from information_schema.tables where table_schema='%s' and table_name='%s'";
+    my_snprintf(query_buff, sizeof(query_buff), row_num_stmt, db, table);
+  }
+  else
+  {
+    row_num_stmt= "select count(*) from `%s`.`%s` where %s";
+    my_snprintf(query_buff, sizeof(query_buff), row_num_stmt, db, table, where);
+  }
+
+  if (mysql_query_with_error_report(mysql, &result, query_buff))
+    DBUG_RETURN(0);
+
+  row= mysql_fetch_row(result);
+  if (!row)
+    maybe_exit(EX_ILLEGAL_TABLE);
+
+  DBUG_RETURN(atoll(row[0]));
+}
 
 /*
   Print hex value for blob data.
@@ -3351,7 +3392,44 @@
   return query;
 }
 
-
+inline void output_progress(char *db, char *table, int percent, my_bool is_end)
+{
+  putc('\r', PROGRESS_OUT);
+  fflush(PROGRESS_OUT);
+
+  fprintf(PROGRESS_OUT, "current_table: %s.%s\t", db, table);
+
+  if(percent >= 100 && !is_end) percent= 99;
+
+  fprintf(PROGRESS_OUT, "Stage: %d%%", percent);
+  fflush(PROGRESS_OUT);
+}
+
+inline void report_progress_end(char* db, char *table)
+{
+  output_progress(db, table, 100, TRUE);
+  fprintf(PROGRESS_OUT, "\n");
+}
+
+inline void report_progress(char *db, char *table, ulong num_rows, ulong rownr, ulong *last_report)
+{
+  if (!rownr)
+  {
+    output_progress(db, table, 0, TRUE);
+    *last_report= 0;
+    return;
+  }
+
+  if (num_rows < 100)
+    return;
+
+  if (rownr - *last_report >= num_rows / 100)
+  {
+    output_progress(db, table, rownr / (num_rows / 100), FALSE);
+
+    *last_report= rownr;
+  }
+}
 /*
 
  SYNOPSIS
@@ -3377,6 +3455,7 @@
   char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
   int error= 0;
   ulong         rownr, row_break, total_length, init_length;
+  ulong num_rows= 0, last_report= 0;
   uint num_fields;
   MYSQL_RES     *res;
   MYSQL_FIELD   *field;
@@ -3389,6 +3468,12 @@
   */
   num_fields= get_table_structure(table, db, table_type, &ignore_flag);
 
+  if(opt_progress_report)
+  {
+    report_progress(db, table, 0, 0, &last_report);
+    num_rows= get_table_rows(table, db, where);
+  }
+
   /*
     The "table" could be a view.  If so, we don't do anything here.
   */
@@ -3585,6 +3670,8 @@
 
     while ((row= mysql_fetch_row(res)))
     {
+      if(opt_progress_report)
+        report_progress(db, table, num_rows, rownr, &last_report);
       uint i;
       ulong *lengths= mysql_fetch_lengths(res);
       rownr++;
@@ -3806,6 +3893,9 @@
       }
     }
 
+    if(opt_progress_report)
+      report_progress_end(db, table);
+
     /* XML - close table tag and supress regular output */
     if (opt_xml)
         fputs("\t</table_data>\n", md_result_file);