From bb95926939f89a562c69b64c563a3d254c8cfdfe Mon Sep 17 00:00:00 2001 From: vasil Date: Mon, 19 May 2008 13:59:42 +0000 Subject: [PATCH] branches/5.1: Fix Bug#36600 SHOW STATUS takes a lot of CPU in buf_get_latched_pages_number by removing the Innodb_buffer_pool_pages_latched variable from SHOW STATUS output in non-UNIV_DEBUG compilation. Approved by: Heikki --- buf/buf0buf.c | 2 +- handler/ha_innodb.cc | 2 ++ include/buf0buf.h | 13 ++++++++----- include/srv0srv.h | 2 ++ srv/srv0srv.c | 2 ++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/buf/buf0buf.c b/buf/buf0buf.c index 469d3ac05d7..901ce8e0fef 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -2328,7 +2328,6 @@ buf_print(void) ut_a(buf_validate()); } -#endif /* UNIV_DEBUG */ /************************************************************************* Returns the number of latched pages in the buffer pool. */ @@ -2361,6 +2360,7 @@ buf_get_latched_pages_number(void) return(fixed_pages_number); } +#endif /* UNIV_DEBUG */ /************************************************************************* Returns the number of pending buf pool ios. */ diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 2e0cdfd670c..27b565e0112 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -334,8 +334,10 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG}, {"buffer_pool_pages_free", (char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG}, +#ifdef UNIV_DEBUG {"buffer_pool_pages_latched", (char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG}, +#endif /* UNIV_DEBUG */ {"buffer_pool_pages_misc", (char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG}, {"buffer_pool_pages_total", diff --git a/include/buf0buf.h b/include/buf0buf.h index 979c28f64ed..3e8972d9182 100644 --- a/include/buf0buf.h +++ b/include/buf0buf.h @@ -495,7 +495,15 @@ Prints info of the buffer pool data structure. */ void buf_print(void); /*============*/ + +/************************************************************************* +Returns the number of latched pages in the buffer pool. */ + +ulint +buf_get_latched_pages_number(void); +/*==============================*/ #endif /* UNIV_DEBUG */ + /************************************************************************ Prints a page to stderr. */ @@ -503,12 +511,7 @@ void buf_page_print( /*===========*/ byte* read_buf); /* in: a database page */ -/************************************************************************* -Returns the number of latched pages in the buffer pool. */ -ulint -buf_get_latched_pages_number(void); -/*==============================*/ /************************************************************************* Returns the number of pending buf pool ios. */ diff --git a/include/srv0srv.h b/include/srv0srv.h index f0bfd3b07ce..91daa6816b2 100644 --- a/include/srv0srv.h +++ b/include/srv0srv.h @@ -501,7 +501,9 @@ struct export_var_struct{ ulint innodb_buffer_pool_pages_dirty; ulint innodb_buffer_pool_pages_misc; ulint innodb_buffer_pool_pages_free; +#ifdef UNIV_DEBUG ulint innodb_buffer_pool_pages_latched; +#endif /* UNIV_DEBUG */ ulint innodb_buffer_pool_read_requests; ulint innodb_buffer_pool_reads; ulint innodb_buffer_pool_wait_free; diff --git a/srv/srv0srv.c b/srv/srv0srv.c index 53fa5c58ded..773b5d583e0 100644 --- a/srv/srv0srv.c +++ b/srv/srv0srv.c @@ -1825,8 +1825,10 @@ srv_export_innodb_status(void) = UT_LIST_GET_LEN(buf_pool->flush_list); export_vars.innodb_buffer_pool_pages_free = UT_LIST_GET_LEN(buf_pool->free); +#ifdef UNIV_DEBUG export_vars.innodb_buffer_pool_pages_latched = buf_get_latched_pages_number(); +#endif /* UNIV_DEBUG */ export_vars.innodb_buffer_pool_pages_total = buf_pool->curr_size; export_vars.innodb_buffer_pool_pages_misc = buf_pool->max_size