diff -Naur mysql-5.5.10/sql/mysqld.cc mysql-5.5.10_max_used_ts/sql/mysqld.cc --- mysql-5.5.10/sql/mysqld.cc 2011-03-09 16:11:38.000000000 +0100 +++ mysql-5.5.10_max_used_ts/sql/mysqld.cc 2011-03-29 14:40:38.000000000 +0200 @@ -332,6 +332,7 @@ static uint kill_cached_threads, wake_thread; static ulong killed_threads; static ulong max_used_connections; +static ulong max_used_connections_ts; static volatile ulong cached_thread_count= 0; static char *mysqld_user, *mysqld_chroot; static char *default_character_set_name; @@ -2393,6 +2394,7 @@ (ulong) dflt_key_cache->key_cache_mem_size); fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size); fprintf(stderr, "max_used_connections=%lu\n", max_used_connections); + fprintf(stderr, "max_used_connections_ts=%lu\n", max_used_connections_ts); fprintf(stderr, "max_threads=%u\n", thread_scheduler->max_threads); fprintf(stderr, "thread_count=%u\n", thread_count); fprintf(stderr, "connection_count=%u\n", connection_count); @@ -5013,6 +5015,9 @@ if (connection_count > max_used_connections) max_used_connections= connection_count; + if (connection_count >= max_used_connections) + max_used_connections_ts= (ulong)my_time(0); + mysql_mutex_unlock(&LOCK_connection_count); /* Start a new thread to handle connection. */ @@ -6462,6 +6467,7 @@ {"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG}, {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, + {"Max_used_connections_ts", (char*) &max_used_connections_ts, SHOW_LONG}, {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH}, {"Open_files", (char*) &my_file_opened, SHOW_LONG_NOFLUSH}, {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH},