summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-04-28 17:15:38 +0300
committerMonty <monty@mariadb.org>2016-04-28 17:15:38 +0300
commit636bb59034fd13d2e1b27af42adbb01ddeb3bd82 (patch)
tree476c6baee07e742b5c50a2786e1246f29b1a63cb /sql/sql_test.cc
parent32d3d9f7dffa8ef96e6268b53f35453da2f6484d (diff)
downloadmariadb-git-636bb59034fd13d2e1b27af42adbb01ddeb3bd82.tar.gz
Final fixes for Memory_used
- Change some static variables to dynamic to ensure that we don't do any memory allocations before server starts or stops - Print more memory information on SIGHUP. Fixed output. - Write out if memory was lost if run with --debug-at-exit - Fixed wrong #ifdef in sql_cache.cc
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc60
1 files changed, 34 insertions, 26 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 642cf208908..86f7dc268b9 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -54,7 +54,7 @@ static const char *lock_descriptions[] =
};
-#ifndef DBUG_OFF
+#ifdef EXTRA_DEBUG
void
print_where(COND *cond,const char *info, enum_query_type query_type)
@@ -559,16 +559,19 @@ C_MODE_END
void mysql_print_status()
{
char current_dir[FN_REFLEN];
+ char llbuff[10][22];
STATUS_VAR tmp;
+ uint count;
- calc_sum_of_all_status(&tmp);
+ count= calc_sum_of_all_status(&tmp);
printf("\nStatus information:\n\n");
(void) my_getwd(current_dir, sizeof(current_dir),MYF(0));
printf("Current dir: %s\n", current_dir);
- printf("Running threads: %d Stack size: %ld\n", thread_count,
+ printf("Running threads: %d Cached threads: %lu Stack size: %ld\n",
+ count, cached_thread_count,
(long) my_thread_stack_size);
+#ifdef EXTRA_DEBUG
thr_print_locks(); // Write some debug info
-#ifndef DBUG_OFF
print_cached_tables();
#endif
/* Print key cache status */
@@ -614,28 +617,33 @@ Next alarm time: %lu\n",
#ifdef HAVE_MALLINFO
struct mallinfo info= mallinfo();
printf("\nMemory status:\n\
-Non-mmapped space allocated from system: %d\n\
-Number of free chunks: %d\n\
-Number of fastbin blocks: %d\n\
-Number of mmapped regions: %d\n\
-Space in mmapped regions: %d\n\
-Maximum total allocated space: %d\n\
-Space available in freed fastbin blocks: %d\n\
-Total allocated space: %d\n\
-Total free space: %d\n\
-Top-most, releasable space: %d\n\
-Estimated memory (with thread stack): %ld\n",
- (int) info.arena ,
- (int) info.ordblks,
- (int) info.smblks,
- (int) info.hblks,
- (int) info.hblkhd,
- (int) info.usmblks,
- (int) info.fsmblks,
- (int) info.uordblks,
- (int) info.fordblks,
- (int) info.keepcost,
- (long) (thread_count * my_thread_stack_size + info.hblkhd + info.arena));
+Non-mmapped space allocated from system: %s\n\
+Number of free chunks: %lu\n\
+Number of fastbin blocks: %lu\n\
+Number of mmapped regions: %lu\n\
+Space in mmapped regions: %s\n\
+Maximum total allocated space: %s\n\
+Space available in freed fastbin blocks: %s\n\
+Total allocated space: %s\n\
+Total free space: %s\n\
+Top-most, releasable space: %s\n\
+Estimated memory (with thread stack): %s\n\
+Global memory allocated by server: %s\n\
+Memory allocated by threads: %s\n",
+ llstr(info.arena, llbuff[0]),
+ (ulong) info.ordblks,
+ (ulong) info.smblks,
+ (ulong) info.hblks,
+ llstr(info.hblkhd, llbuff[1]),
+ llstr(info.usmblks, llbuff[2]),
+ llstr(info.fsmblks, llbuff[3]),
+ llstr(info.uordblks, llbuff[4]),
+ llstr(info.fordblks, llbuff[5]),
+ llstr(info.keepcost, llbuff[6]),
+ llstr((count + cached_thread_count)* my_thread_stack_size + info.hblkhd + info.arena, llbuff[7]),
+ llstr(tmp.global_memory_used, llbuff[8]),
+ llstr(tmp.local_memory_used, llbuff[9]));
+
#endif
#ifdef HAVE_EVENT_SCHEDULER