Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4822696e
Commit
4822696e
authored
May 05, 2009
by
Chad MILLER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull 5.1 treatment of community features into 5.0.
parent
14f923c0
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
88 additions
and
27 deletions
+88
-27
configure.in
configure.in
+30
-6
mysql-test/include/have_community_features.inc
mysql-test/include/have_community_features.inc
+4
-0
mysql-test/include/have_profiling.inc
mysql-test/include/have_profiling.inc
+4
-0
mysql-test/r/have_community_features.require
mysql-test/r/have_community_features.require
+2
-0
mysql-test/r/have_profiling.require
mysql-test/r/have_profiling.require
+2
-0
mysql-test/t/profiling.test
mysql-test/t/profiling.test
+2
-0
sql/mysql_priv.h
sql/mysql_priv.h
+2
-0
sql/mysqld.cc
sql/mysqld.cc
+17
-1
sql/set_var.cc
sql/set_var.cc
+3
-1
sql/sp_head.cc
sql/sp_head.cc
+5
-5
sql/sql_class.cc
sql/sql_class.cc
+2
-2
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+7
-7
sql/sql_prepare.cc
sql/sql_prepare.cc
+1
-1
sql/sql_profile.cc
sql/sql_profile.cc
+2
-2
sql/sql_profile.h
sql/sql_profile.h
+1
-1
sql/sql_show.cc
sql/sql_show.cc
+3
-0
No files found.
configure.in
View file @
4822696e
...
@@ -661,7 +661,6 @@ then
...
@@ -661,7 +661,6 @@ then
fi
fi
fi
fi
AC_ARG_WITH
(
server-suffix,
AC_ARG_WITH
(
server-suffix,
[
--with-server-suffix
Append value to the version string.],
[
--with-server-suffix
Append value to the version string.],
[
MYSQL_SERVER_SUFFIX
=
`
echo
"
$withval
"
|
sed
-e
's/^\(...................................\)..*$/\1/'
`
]
,
[
MYSQL_SERVER_SUFFIX
=
`
echo
"
$withval
"
|
sed
-e
's/^\(...................................\)..*$/\1/'
`
]
,
...
@@ -724,17 +723,42 @@ else
...
@@ -724,17 +723,42 @@ else
AC_MSG_RESULT
([
no]
)
AC_MSG_RESULT
([
no]
)
fi
fi
AC_MSG_CHECKING
(
whether features provided by the user community should be included.
)
AC_ARG_ENABLE
(
community-features,
AC_HELP_STRING
(
[
--enable-community-features
]
,
[
Enable additional features provided by the user community.]
)
,
[
ENABLE_COMMUNITY_FEATURES
=
$enableval
]
,
[
ENABLE_COMMUNITY_FEATURES
=
no
]
)
if
test
"
$ENABLE_COMMUNITY_FEATURES
"
=
"yes"
then
AC_DEFINE
([
COMMUNITY_SERVER],
[
1],
[
Whether features provided by the user community should be included]
)
AC_MSG_RESULT
([
yes
])
else
AC_MSG_RESULT
([
no]
)
fi
# Add query profiler
# Add query profiler
AC_MSG_CHECKING
(
whether query profiling should be included
)
AC_ARG_ENABLE
(
profiling,
AC_ARG_ENABLE
(
profiling,
AS_HELP_STRING
([
--
disable-profiling
]
,
[
Build a version without query profiling code
]
)
,
AS_HELP_STRING
([
--
enable-profiling
]
,
[
Add query-profiling code.
]
)
,
[
ENABLED_PROFILING
=
$enableval
]
,
[
ENABLED_PROFILING
=
$enableval
]
,
[
ENABLED_PROFILING
=
yes
])
[
ENABLED_PROFILING
=
no
])
if
test
"
$ENABLED_PROFILING
"
=
"yes"
if
test
"
$ENABLED_PROFILING
"
=
"yes"
then
then
AC_DEFINE
([
ENABLED_PROFILING],
[
1],
if
test
"
$ENABLE_COMMUNITY_FEATURES
"
=
"yes"
;
[
If SHOW PROFILE should be enabled]
)
then
AC_MSG_RESULT
([
yes
])
AC_DEFINE
([
ENABLED_PROFILING],
[
1],
[
If SHOW PROFILE should be enabled]
)
AC_MSG_RESULT
([
yes
])
else
ENABLED_PROFILING
=
"no"
AC_MSG_RESULT
([
no, overridden because community-features disabled]
)
AC_MSG_ERROR
([
This is almost certainly wrong. Add
--enable-community-features
or remove
--enable-profiling
.]
)
fi
else
else
AC_MSG_RESULT
([
no]
)
AC_MSG_RESULT
([
no]
)
fi
fi
...
...
mysql-test/include/have_community_features.inc
0 → 100644
View file @
4822696e
--
require
r
/
have_community_features
.
require
--
disable_query_log
show
variables
like
'have_community_features'
;
--
enable_query_log
mysql-test/include/have_profiling.inc
0 → 100644
View file @
4822696e
--
require
r
/
have_profiling
.
require
--
disable_query_log
show
variables
like
'have_profiling'
;
--
enable_query_log
mysql-test/r/have_community_features.require
0 → 100644
View file @
4822696e
Variable_name Value
have_community_features YES
mysql-test/r/have_profiling.require
0 → 100644
View file @
4822696e
Variable_name Value
have_profiling YES
mysql-test/t/profiling.test
View file @
4822696e
--
source
include
/
have_profiling
.
inc
# Verify that the protocol isn't violated if we ask for profiling info
# Verify that the protocol isn't violated if we ask for profiling info
# before profiling has recorded anything.
# before profiling has recorded anything.
show
profiles
;
show
profiles
;
...
...
sql/mysql_priv.h
View file @
4822696e
...
@@ -1479,6 +1479,8 @@ extern SHOW_COMP_OPTION have_query_cache;
...
@@ -1479,6 +1479,8 @@ extern SHOW_COMP_OPTION have_query_cache;
extern
SHOW_COMP_OPTION
have_geometry
,
have_rtree_keys
;
extern
SHOW_COMP_OPTION
have_geometry
,
have_rtree_keys
;
extern
SHOW_COMP_OPTION
have_crypt
;
extern
SHOW_COMP_OPTION
have_crypt
;
extern
SHOW_COMP_OPTION
have_compress
;
extern
SHOW_COMP_OPTION
have_compress
;
extern
SHOW_COMP_OPTION
have_community_features
;
extern
SHOW_COMP_OPTION
have_profiling
;
#ifndef __WIN__
#ifndef __WIN__
extern
pthread_t
signal_thread
;
extern
pthread_t
signal_thread
;
...
...
sql/mysqld.cc
View file @
4822696e
...
@@ -538,6 +538,8 @@ SHOW_COMP_OPTION have_isam;
...
@@ -538,6 +538,8 @@ SHOW_COMP_OPTION have_isam;
SHOW_COMP_OPTION
have_raid
,
have_ssl
,
have_symlink
,
have_query_cache
;
SHOW_COMP_OPTION
have_raid
,
have_ssl
,
have_symlink
,
have_query_cache
;
SHOW_COMP_OPTION
have_geometry
,
have_rtree_keys
,
have_dlopen
;
SHOW_COMP_OPTION
have_geometry
,
have_rtree_keys
,
have_dlopen
;
SHOW_COMP_OPTION
have_crypt
,
have_compress
;
SHOW_COMP_OPTION
have_crypt
,
have_compress
;
SHOW_COMP_OPTION
have_community_features
;
SHOW_COMP_OPTION
have_profiling
;
/* Thread specific variables */
/* Thread specific variables */
...
@@ -5638,7 +5640,7 @@ Disable with --skip-ndbcluster (will save memory).",
...
@@ -5638,7 +5640,7 @@ Disable with --skip-ndbcluster (will save memory).",
"Maximum time in seconds to wait for the port to become free. "
"Maximum time in seconds to wait for the port to become free. "
"(Default: no wait)"
,
(
gptr
*
)
&
mysqld_port_timeout
,
"(Default: no wait)"
,
(
gptr
*
)
&
mysqld_port_timeout
,
(
gptr
*
)
&
mysqld_port_timeout
,
0
,
GET_UINT
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
(
gptr
*
)
&
mysqld_port_timeout
,
0
,
GET_UINT
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
{
"profiling_history_size"
,
OPT_PROFILING
,
"Limit of query profiling memory"
,
{
"profiling_history_size"
,
OPT_PROFILING
,
"Limit of query profiling memory"
,
(
gptr
*
)
&
global_system_variables
.
profiling_history_size
,
(
gptr
*
)
&
global_system_variables
.
profiling_history_size
,
(
gptr
*
)
&
max_system_variables
.
profiling_history_size
,
(
gptr
*
)
&
max_system_variables
.
profiling_history_size
,
...
@@ -6685,7 +6687,9 @@ struct show_var_st status_vars[]= {
...
@@ -6685,7 +6687,9 @@ struct show_var_st status_vars[]= {
{
"Threads_created"
,
(
char
*
)
&
thread_created
,
SHOW_LONG_CONST
},
{
"Threads_created"
,
(
char
*
)
&
thread_created
,
SHOW_LONG_CONST
},
{
"Threads_running"
,
(
char
*
)
&
thread_running
,
SHOW_INT_CONST
},
{
"Threads_running"
,
(
char
*
)
&
thread_running
,
SHOW_INT_CONST
},
{
"Uptime"
,
(
char
*
)
0
,
SHOW_STARTTIME
},
{
"Uptime"
,
(
char
*
)
0
,
SHOW_STARTTIME
},
#ifdef COMMUNITY_SERVER
{
"Uptime_since_flush_status"
,(
char
*
)
0
,
SHOW_FLUSHTIME
},
{
"Uptime_since_flush_status"
,(
char
*
)
0
,
SHOW_FLUSHTIME
},
#endif
{
NullS
,
NullS
,
SHOW_LONG
}
{
NullS
,
NullS
,
SHOW_LONG
}
};
};
...
@@ -6992,6 +6996,16 @@ static void mysql_init_variables(void)
...
@@ -6992,6 +6996,16 @@ static void mysql_init_variables(void)
#if !defined(my_pthread_setprio) && !defined(HAVE_PTHREAD_SETSCHEDPARAM)
#if !defined(my_pthread_setprio) && !defined(HAVE_PTHREAD_SETSCHEDPARAM)
opt_specialflag
|=
SPECIAL_NO_PRIOR
;
opt_specialflag
|=
SPECIAL_NO_PRIOR
;
#endif
#endif
#ifdef ENABLED_PROFILING
have_profiling
=
SHOW_OPTION_YES
;
#else
have_profiling
=
SHOW_OPTION_NO
;
#endif
#ifdef COMMUNITY_SERVER
have_community_features
=
SHOW_OPTION_YES
;
#else
have_community_features
=
SHOW_OPTION_NO
;
#endif
#if defined(__WIN__) || defined(__NETWARE__)
#if defined(__WIN__) || defined(__NETWARE__)
/* Allow Win32 and NetWare users to move MySQL anywhere */
/* Allow Win32 and NetWare users to move MySQL anywhere */
...
@@ -8016,7 +8030,9 @@ void refresh_status(THD *thd)
...
@@ -8016,7 +8030,9 @@ void refresh_status(THD *thd)
/* Reset the counters of all key caches (default and named). */
/* Reset the counters of all key caches (default and named). */
process_key_caches
(
reset_key_cache_counters
);
process_key_caches
(
reset_key_cache_counters
);
#ifdef COMMUNITY_SERVER
flush_status_time
=
time
((
time_t
*
)
0
);
flush_status_time
=
time
((
time_t
*
)
0
);
#endif
pthread_mutex_unlock
(
&
LOCK_status
);
pthread_mutex_unlock
(
&
LOCK_status
);
/*
/*
...
...
sql/set_var.cc
View file @
4822696e
...
@@ -564,7 +564,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
...
@@ -564,7 +564,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
set_option_bit
,
set_option_bit
,
OPTION_RELAXED_UNIQUE_CHECKS
,
OPTION_RELAXED_UNIQUE_CHECKS
,
1
);
1
);
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
static
sys_var_thd_bit
sys_profiling
(
"profiling"
,
NULL
,
set_option_bit
,
static
sys_var_thd_bit
sys_profiling
(
"profiling"
,
NULL
,
set_option_bit
,
ulonglong
(
OPTION_PROFILING
));
ulonglong
(
OPTION_PROFILING
));
static
sys_var_thd_ulong
sys_profiling_history_size
(
"profiling_history_size"
,
static
sys_var_thd_ulong
sys_profiling_history_size
(
"profiling_history_size"
,
...
@@ -899,6 +899,8 @@ struct show_var_st init_vars[]= {
...
@@ -899,6 +899,8 @@ struct show_var_st init_vars[]= {
{
"have_bdb"
,
(
char
*
)
&
have_berkeley_db
,
SHOW_HAVE
},
{
"have_bdb"
,
(
char
*
)
&
have_berkeley_db
,
SHOW_HAVE
},
{
"have_blackhole_engine"
,
(
char
*
)
&
have_blackhole_db
,
SHOW_HAVE
},
{
"have_blackhole_engine"
,
(
char
*
)
&
have_blackhole_db
,
SHOW_HAVE
},
{
"have_compress"
,
(
char
*
)
&
have_compress
,
SHOW_HAVE
},
{
"have_compress"
,
(
char
*
)
&
have_compress
,
SHOW_HAVE
},
{
"have_community_features"
,
(
char
*
)
&
have_community_features
,
SHOW_HAVE
},
{
"have_profiling"
,
(
char
*
)
&
have_profiling
,
SHOW_HAVE
},
{
"have_crypt"
,
(
char
*
)
&
have_crypt
,
SHOW_HAVE
},
{
"have_crypt"
,
(
char
*
)
&
have_crypt
,
SHOW_HAVE
},
{
"have_csv"
,
(
char
*
)
&
have_csv_db
,
SHOW_HAVE
},
{
"have_csv"
,
(
char
*
)
&
have_csv_db
,
SHOW_HAVE
},
{
"have_dynamic_loading"
,
(
char
*
)
&
have_dlopen
,
SHOW_HAVE
},
{
"have_dynamic_loading"
,
(
char
*
)
&
have_dlopen
,
SHOW_HAVE
},
...
...
sql/sp_head.cc
View file @
4822696e
...
@@ -1103,7 +1103,7 @@ sp_head::execute(THD *thd)
...
@@ -1103,7 +1103,7 @@ sp_head::execute(THD *thd)
*/
*/
thd
->
spcont
->
callers_arena
=
&
backup_arena
;
thd
->
spcont
->
callers_arena
=
&
backup_arena
;
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
/* Discard the initial part of executing routines. */
/* Discard the initial part of executing routines. */
thd
->
profiling
.
discard_current_query
();
thd
->
profiling
.
discard_current_query
();
#endif
#endif
...
@@ -1112,7 +1112,7 @@ sp_head::execute(THD *thd)
...
@@ -1112,7 +1112,7 @@ sp_head::execute(THD *thd)
sp_instr
*
i
;
sp_instr
*
i
;
uint
hip
;
// Handler ip
uint
hip
;
// Handler ip
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
/*
/*
Treat each "instr" of a routine as discrete unit that could be profiled.
Treat each "instr" of a routine as discrete unit that could be profiled.
Profiling only records information for segments of code that set the
Profiling only records information for segments of code that set the
...
@@ -1125,7 +1125,7 @@ sp_head::execute(THD *thd)
...
@@ -1125,7 +1125,7 @@ sp_head::execute(THD *thd)
i
=
get_instr
(
ip
);
// Returns NULL when we're done.
i
=
get_instr
(
ip
);
// Returns NULL when we're done.
if
(
i
==
NULL
)
if
(
i
==
NULL
)
{
{
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
discard_current_query
();
thd
->
profiling
.
discard_current_query
();
#endif
#endif
break
;
break
;
...
@@ -1209,7 +1209,7 @@ sp_head::execute(THD *thd)
...
@@ -1209,7 +1209,7 @@ sp_head::execute(THD *thd)
}
}
}
while
(
!
err_status
&&
!
thd
->
killed
);
}
while
(
!
err_status
&&
!
thd
->
killed
);
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
finish_current_query
();
thd
->
profiling
.
finish_current_query
();
thd
->
profiling
.
start_new_query
(
"tail end of routine"
);
thd
->
profiling
.
start_new_query
(
"tail end of routine"
);
#endif
#endif
...
@@ -2633,7 +2633,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
...
@@ -2633,7 +2633,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
query
=
thd
->
query
;
query
=
thd
->
query
;
query_length
=
thd
->
query_length
;
query_length
=
thd
->
query_length
;
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
/* This s-p instr is profilable and will be captured. */
/* This s-p instr is profilable and will be captured. */
thd
->
profiling
.
set_query_source
(
m_query
.
str
,
m_query
.
length
);
thd
->
profiling
.
set_query_source
(
m_query
.
str
,
m_query
.
length
);
#endif
#endif
...
...
sql/sql_class.cc
View file @
4822696e
...
@@ -173,7 +173,7 @@ const char *set_thd_proc_info(THD *thd, const char *info,
...
@@ -173,7 +173,7 @@ const char *set_thd_proc_info(THD *thd, const char *info,
{
{
const
char
*
old_info
=
thd
->
proc_info
;
const
char
*
old_info
=
thd
->
proc_info
;
DBUG_PRINT
(
"proc_info"
,
(
"%s:%d %s"
,
calling_file
,
calling_line
,
info
));
DBUG_PRINT
(
"proc_info"
,
(
"%s:%d %s"
,
calling_file
,
calling_line
,
info
));
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
status_change
(
info
,
calling_function
,
calling_file
,
calling_line
);
thd
->
profiling
.
status_change
(
info
,
calling_function
,
calling_file
,
calling_line
);
#endif
#endif
thd
->
proc_info
=
info
;
thd
->
proc_info
=
info
;
...
@@ -272,7 +272,7 @@ THD::THD()
...
@@ -272,7 +272,7 @@ THD::THD()
init
();
init
();
/* Initialize sub structures */
/* Initialize sub structures */
init_sql_alloc
(
&
warn_root
,
WARN_ALLOC_BLOCK_SIZE
,
WARN_ALLOC_PREALLOC_SIZE
);
init_sql_alloc
(
&
warn_root
,
WARN_ALLOC_BLOCK_SIZE
,
WARN_ALLOC_PREALLOC_SIZE
);
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
profiling
.
set_thd
(
this
);
profiling
.
set_thd
(
this
);
#endif
#endif
user_connect
=
(
USER_CONN
*
)
0
;
user_connect
=
(
USER_CONN
*
)
0
;
...
...
sql/sql_class.h
View file @
4822696e
...
@@ -1434,7 +1434,7 @@ public:
...
@@ -1434,7 +1434,7 @@ public:
List
<
MYSQL_ERROR
>
warn_list
;
List
<
MYSQL_ERROR
>
warn_list
;
uint
warn_count
[(
uint
)
MYSQL_ERROR
::
WARN_LEVEL_END
];
uint
warn_count
[(
uint
)
MYSQL_ERROR
::
WARN_LEVEL_END
];
uint
total_warn_count
;
uint
total_warn_count
;
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
PROFILING
profiling
;
PROFILING
profiling
;
#endif
#endif
...
...
sql/sql_parse.cc
View file @
4822696e
...
@@ -1355,7 +1355,7 @@ pthread_handler_t handle_bootstrap(void *arg)
...
@@ -1355,7 +1355,7 @@ pthread_handler_t handle_bootstrap(void *arg)
thd
->
db_length
+
1
+
QUERY_CACHE_FLAGS_SIZE
);
thd
->
db_length
+
1
+
QUERY_CACHE_FLAGS_SIZE
);
thd
->
query
[
length
]
=
'\0'
;
thd
->
query
[
length
]
=
'\0'
;
DBUG_PRINT
(
"query"
,(
"%-.4096s"
,
thd
->
query
));
DBUG_PRINT
(
"query"
,(
"%-.4096s"
,
thd
->
query
));
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
set_query_source
(
thd
->
query
,
length
);
thd
->
profiling
.
set_query_source
(
thd
->
query
,
length
);
#endif
#endif
...
@@ -1594,7 +1594,7 @@ static bool do_command(THD *thd)
...
@@ -1594,7 +1594,7 @@ static bool do_command(THD *thd)
net_new_transaction
(
net
);
net_new_transaction
(
net
);
packet_length
=
my_net_read
(
net
);
packet_length
=
my_net_read
(
net
);
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
start_new_query
();
thd
->
profiling
.
start_new_query
();
#endif
#endif
if
(
packet_length
==
packet_error
)
if
(
packet_length
==
packet_error
)
...
@@ -1642,7 +1642,7 @@ static bool do_command(THD *thd)
...
@@ -1642,7 +1642,7 @@ static bool do_command(THD *thd)
return_value
=
dispatch_command
(
command
,
thd
,
packet
+
1
,
(
uint
)
(
packet_length
));
return_value
=
dispatch_command
(
command
,
thd
,
packet
+
1
,
(
uint
)
(
packet_length
));
out:
out:
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
finish_current_query
();
thd
->
profiling
.
finish_current_query
();
#endif
#endif
DBUG_RETURN
(
return_value
);
DBUG_RETURN
(
return_value
);
...
@@ -1951,7 +1951,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1951,7 +1951,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_log
.
write
(
thd
,
command
,
format
,
thd
->
query_length
,
thd
->
query
);
mysql_log
.
write
(
thd
,
command
,
format
,
thd
->
query_length
,
thd
->
query
);
DBUG_PRINT
(
"query"
,(
"%-.4096s"
,
thd
->
query
));
DBUG_PRINT
(
"query"
,(
"%-.4096s"
,
thd
->
query
));
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
set_query_source
(
thd
->
query
,
thd
->
query_length
);
thd
->
profiling
.
set_query_source
(
thd
->
query
,
thd
->
query_length
);
#endif
#endif
...
@@ -1981,7 +1981,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1981,7 +1981,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
length
--
;
length
--
;
}
}
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
thd
->
profiling
.
finish_current_query
();
thd
->
profiling
.
finish_current_query
();
thd
->
profiling
.
start_new_query
(
"continuing"
);
thd
->
profiling
.
start_new_query
(
"continuing"
);
thd
->
profiling
.
set_query_source
(
next_packet
,
length
);
thd
->
profiling
.
set_query_source
(
next_packet
,
length
);
...
@@ -2485,7 +2485,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
...
@@ -2485,7 +2485,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
Mark this current profiling record to be discarded. We don't
Mark this current profiling record to be discarded. We don't
wish to have SHOW commands show up in profiling.
wish to have SHOW commands show up in profiling.
*/
*/
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd
->
profiling
.
discard_current_query
();
thd
->
profiling
.
discard_current_query
();
#endif
#endif
break
;
break
;
...
@@ -2961,7 +2961,7 @@ mysql_execute_command(THD *thd)
...
@@ -2961,7 +2961,7 @@ mysql_execute_command(THD *thd)
}
}
case
SQLCOM_SHOW_PROFILES
:
case
SQLCOM_SHOW_PROFILES
:
{
{
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd
->
profiling
.
discard_current_query
();
thd
->
profiling
.
discard_current_query
();
res
=
thd
->
profiling
.
show_profiles
();
res
=
thd
->
profiling
.
show_profiles
();
if
(
res
)
if
(
res
)
...
...
sql/sql_prepare.cc
View file @
4822696e
...
@@ -2283,7 +2283,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
...
@@ -2283,7 +2283,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_execute"
)))
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_execute"
)))
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
#if
def ENABLED_PROFILING
#if
defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd
->
profiling
.
set_query_source
(
stmt
->
query
,
stmt
->
query_length
);
thd
->
profiling
.
set_query_source
(
stmt
->
query
,
stmt
->
query_length
);
#endif
#endif
DBUG_PRINT
(
"exec_query"
,
(
"%s"
,
stmt
->
query
));
DBUG_PRINT
(
"exec_query"
,
(
"%s"
,
stmt
->
query
));
...
...
sql/sql_profile.cc
View file @
4822696e
...
@@ -47,7 +47,7 @@ const char * const _unknown_func_ = "<unknown>";
...
@@ -47,7 +47,7 @@ const char * const _unknown_func_ = "<unknown>";
int
fill_query_profile_statistics_info
(
THD
*
thd
,
TABLE_LIST
*
tables
,
int
fill_query_profile_statistics_info
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
*
cond
)
Item
*
cond
)
{
{
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
return
(
thd
->
profiling
.
fill_statistics_info
(
thd
,
tables
,
cond
));
return
(
thd
->
profiling
.
fill_statistics_info
(
thd
,
tables
,
cond
));
#else
#else
my_error
(
ER_FEATURE_DISABLED
,
MYF
(
0
),
"SHOW PROFILE"
,
"enable-profiling"
);
my_error
(
ER_FEATURE_DISABLED
,
MYF
(
0
),
"SHOW PROFILE"
,
"enable-profiling"
);
...
@@ -129,7 +129,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
...
@@ -129,7 +129,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
}
}
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
#define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec)
#define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec)
#define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2)))
#define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2)))
...
...
sql/sql_profile.h
View file @
4822696e
...
@@ -54,7 +54,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
...
@@ -54,7 +54,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
#define PROFILE_ALL (~0)
#define PROFILE_ALL (~0)
#if defined(ENABLED_PROFILING)
#if defined(ENABLED_PROFILING)
&& defined(COMMUNITY_SERVER)
#include "mysql_priv.h"
#include "mysql_priv.h"
#ifdef HAVE_SYS_RESOURCE_H
#ifdef HAVE_SYS_RESOURCE_H
...
...
sql/sql_show.cc
View file @
4822696e
...
@@ -1549,9 +1549,12 @@ static bool show_status_array(THD *thd, const char *wild,
...
@@ -1549,9 +1549,12 @@ static bool show_status_array(THD *thd, const char *wild,
nr
=
(
long
)
(
thd
->
query_start
()
-
server_start_time
);
nr
=
(
long
)
(
thd
->
query_start
()
-
server_start_time
);
end
=
int10_to_str
(
nr
,
buff
,
10
);
end
=
int10_to_str
(
nr
,
buff
,
10
);
break
;
break
;
#ifdef COMMUNITY_SERVER
case
SHOW_FLUSHTIME
:
case
SHOW_FLUSHTIME
:
nr
=
(
long
)
(
thd
->
query_start
()
-
flush_status_time
);
nr
=
(
long
)
(
thd
->
query_start
()
-
flush_status_time
);
end
=
int10_to_str
(
nr
,
buff
,
10
);
end
=
int10_to_str
(
nr
,
buff
,
10
);
break
;
#endif
case
SHOW_QUERIES
:
case
SHOW_QUERIES
:
end
=
int10_to_str
((
long
)
thd
->
query_id
,
buff
,
10
);
end
=
int10_to_str
((
long
)
thd
->
query_id
,
buff
,
10
);
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment