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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c186793b
Commit
c186793b
authored
Feb 26, 2007
by
cmiller@calliope.local.cmiller/calliope.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some changes suggested Serg, from message <20070223210659.GA24202@janus.mylan>
parent
b30fd9b4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
62 deletions
+45
-62
configure.in
configure.in
+1
-1
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+0
-2
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
sql/sql_profile.cc
sql/sql_profile.cc
+38
-52
sql/sql_profile.h
sql/sql_profile.h
+1
-2
sql/sql_select.cc
sql/sql_select.cc
+2
-2
No files found.
configure.in
View file @
c186793b
...
...
@@ -669,7 +669,7 @@ fi
# Add query profiler
AC_ARG_ENABLE
(
profiling,
[
--disable-profiling
Build a version without query profiling code
]
,
AS_HELP_STRING
([
--disable-profiling
]
,
[
Build a version without query profiling code]
)
,
[
ENABLED_PROFILING
=
$enableval
]
,
[
ENABLED_PROFILING
=
yes
])
...
...
sql/set_var.cc
View file @
c186793b
...
...
@@ -548,7 +548,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
#ifdef ENABLED_PROFILING
static
sys_var_thd_bit
sys_profiling
(
"profiling"
,
NULL
,
set_option_bit
,
ulonglong
(
OPTION_PROFILING
));
sys_var_thd_ulong
sys_profiling_history_size
(
"profiling_history_size"
,
s
tatic
s
ys_var_thd_ulong
sys_profiling_history_size
(
"profiling_history_size"
,
&
SV
::
profiling_history_size
);
#endif
...
...
sql/sql_lex.cc
View file @
c186793b
...
...
@@ -173,9 +173,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex
->
proc_list
.
first
=
0
;
lex
->
escape_used
=
FALSE
;
lex
->
reset_query_tables_list
(
FALSE
);
#ifdef ENABLED_PROFILING
lex
->
profile_options
=
PROFILE_NONE
;
#endif
lex
->
nest_level
=
0
;
lex
->
allow_sum_func
=
0
;
lex
->
in_sum_func
=
NULL
;
...
...
sql/sql_parse.cc
View file @
c186793b
...
...
@@ -2707,7 +2707,7 @@ mysql_execute_command(THD *thd)
if
(
res
)
goto
error
;
#else
my_error
(
ER_FEATURE_DISABLED
,
MYF
(
0
),
"
query profiling
"
,
"enable-profiling"
);
my_error
(
ER_FEATURE_DISABLED
,
MYF
(
0
),
"
SHOW PROFILES
"
,
"enable-profiling"
);
goto
error
;
#endif
break
;
...
...
@@ -2724,7 +2724,7 @@ mysql_execute_command(THD *thd)
if
(
res
)
goto
error
;
#else
my_error
(
ER_FEATURE_DISABLED
,
MYF
(
0
),
"
query profiling
"
,
"enable-profiling"
);
my_error
(
ER_FEATURE_DISABLED
,
MYF
(
0
),
"
SHOW PROFILE
"
,
"enable-profiling"
);
goto
error
;
#endif
break
;
...
...
sql/sql_profile.cc
View file @
c186793b
/* Copyright (C) 200
5
MySQL AB
/* Copyright (C) 200
7
MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
...
...
@@ -12,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA */
#include "mysql_priv.h"
...
...
@@ -42,24 +41,24 @@ int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables,
ST_FIELD_INFO
query_profile_statistics_info
[]
=
{
/* name, length, type, value, maybe_null, old_name */
{
"Q
uery_id
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
},
{
"S
eq
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
},
{
"S
tate
"
,
30
,
MYSQL_TYPE_STRING
,
0
,
false
,
NULL
},
{
"D
uration
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
false
,
NULL
},
{
"CPU_
user
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
true
,
NULL
},
{
"CPU_
system
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
true
,
NULL
},
{
"C
ontext_voluntary
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"C
ontext_involuntary
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"B
lock_ops_in
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"B
lock_ops_out
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"M
essages_sent
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"M
essages_received
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"P
age_faults_major
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"P
age_faults_minor
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"S
waps
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"S
ource_function
"
,
30
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
},
{
"S
ource_file
"
,
20
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
},
{
"S
ource_line
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"Q
UERY_ID
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
},
{
"S
EQ
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
},
{
"S
TATE
"
,
30
,
MYSQL_TYPE_STRING
,
0
,
false
,
NULL
},
{
"D
URATION
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
false
,
NULL
},
{
"CPU_
USER
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
true
,
NULL
},
{
"CPU_
SYSTEM
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
true
,
NULL
},
{
"C
ONTEXT_VOLUNTARY
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"C
ONTEXT_INVOLUNTARY
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"B
LOCK_OPS_IN
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"B
LOCK_OPS_OUT
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"M
ESSAGES_SENT
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"M
ESSAGES_RECEIVED
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"P
AGE_FAULTS_MAJOR
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"P
AGE_FAULTS_MINOR
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"S
WAPS
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"S
OURCE_FUNCTION
"
,
30
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
},
{
"S
OURCE_FILE
"
,
20
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
},
{
"S
OURCE_LINE
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
NULL
,
0
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
}
};
...
...
@@ -107,20 +106,9 @@ void PROFILE_ENTRY::set_status(const char *status_arg, const char *function_arg,
Compute all the space we'll need to allocate one block for everything
we'll need, instead of N mallocs.
*/
if
(
status_arg
!=
NULL
)
sizes
[
0
]
=
strlen
(
status_arg
)
+
1
;
else
sizes
[
0
]
=
0
;
if
(
function_arg
!=
NULL
)
sizes
[
1
]
=
strlen
(
function_arg
)
+
1
;
else
sizes
[
1
]
=
0
;
if
(
file_arg
!=
NULL
)
sizes
[
2
]
=
strlen
(
file_arg
)
+
1
;
else
sizes
[
2
]
=
0
;
sizes
[
0
]
=
(
status_arg
==
NULL
)
?
0
:
strlen
(
status_arg
)
+
1
;
sizes
[
1
]
=
(
function_arg
==
NULL
)
?
0
:
strlen
(
function_arg
)
+
1
;
sizes
[
2
]
=
(
file_arg
==
NULL
)
?
0
:
strlen
(
file_arg
)
+
1
;
allocated_status_memory
=
(
char
*
)
my_malloc
(
sizes
[
0
]
+
sizes
[
1
]
+
sizes
[
2
],
MYF
(
0
));
DBUG_ASSERT
(
allocated_status_memory
!=
NULL
);
...
...
@@ -237,7 +225,6 @@ void QUERY_PROFILE::status(const char *status_arg,
*/
saved_mem_root
=
thd
->
mem_root
;
thd
->
mem_root
=
&
profiling
->
mem_root
;
//thd->mem_root= NULL;
if
(
function_arg
&&
file_arg
)
{
...
...
@@ -375,7 +362,6 @@ bool QUERY_PROFILE::show(uint options)
protocol
->
store
(
entry
->
status
,
strlen
(
entry
->
status
),
system_charset_info
);
protocol
->
store
((
double
)(
entry
->
time_usecs
-
last_time
)
/
(
1000.0
*
1000
),
(
uint32
)
TIME_FLOAT_DIGITS
-
1
,
&
elapsed
);
//protocol->store((double)(entry->time - last_time)/(1000*1000*10));
if
(
options
&
PROFILE_CPU
)
{
...
...
@@ -739,54 +725,54 @@ int PROFILING::fill_statistics_info(THD *thd, struct st_table_list *tables, Item
#ifdef HAVE_GETRUSAGE
table
->
field
[
4
]
->
store
((
double
)
RUSAGE_DIFF_USEC
(
entry
->
rusage
.
ru_utime
,
last_rusage
->
ru_utime
)
/
(
1000.0
*
1000
));
table
->
field
[
4
]
->
null_ptr
=
NULL
;
table
->
field
[
4
]
->
set_notnull
()
;
table
->
field
[
5
]
->
store
((
double
)
RUSAGE_DIFF_USEC
(
entry
->
rusage
.
ru_stime
,
last_rusage
->
ru_stime
)
/
(
1000.0
*
1000
));
table
->
field
[
5
]
->
null_ptr
=
NULL
;
table
->
field
[
5
]
->
set_notnull
()
;
#else
/* TODO: Add CPU-usage info for non-BSD systems */
#endif
#ifdef HAVE_GETRUSAGE
table
->
field
[
6
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_nvcsw
-
last_rusage
->
ru_nvcsw
));
table
->
field
[
6
]
->
null_ptr
=
NULL
;
table
->
field
[
6
]
->
set_notnull
()
;
table
->
field
[
7
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_nivcsw
-
last_rusage
->
ru_nivcsw
));
table
->
field
[
7
]
->
null_ptr
=
NULL
;
table
->
field
[
7
]
->
set_notnull
()
;
#else
/* TODO: Add context switch info for non-BSD systems */
#endif
#ifdef HAVE_GETRUSAGE
table
->
field
[
8
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_inblock
-
last_rusage
->
ru_inblock
));
table
->
field
[
8
]
->
null_ptr
=
NULL
;
table
->
field
[
8
]
->
set_notnull
()
;
table
->
field
[
9
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_oublock
-
last_rusage
->
ru_oublock
));
table
->
field
[
9
]
->
null_ptr
=
NULL
;
table
->
field
[
9
]
->
set_notnull
()
;
#else
/* TODO: Add block IO info for non-BSD systems */
#endif
#ifdef HAVE_GETRUSAGE
table
->
field
[
10
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_msgsnd
-
last_rusage
->
ru_msgsnd
),
true
);
table
->
field
[
10
]
->
null_ptr
=
NULL
;
table
->
field
[
10
]
->
set_notnull
()
;
table
->
field
[
11
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_msgrcv
-
last_rusage
->
ru_msgrcv
),
true
);
table
->
field
[
11
]
->
null_ptr
=
NULL
;
table
->
field
[
11
]
->
set_notnull
()
;
#else
/* TODO: Add message info for non-BSD systems */
#endif
#ifdef HAVE_GETRUSAGE
table
->
field
[
12
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_majflt
-
last_rusage
->
ru_majflt
),
true
);
table
->
field
[
12
]
->
null_ptr
=
NULL
;
table
->
field
[
12
]
->
set_notnull
()
;
table
->
field
[
13
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_minflt
-
last_rusage
->
ru_minflt
),
true
);
table
->
field
[
13
]
->
null_ptr
=
NULL
;
table
->
field
[
13
]
->
set_notnull
()
;
#else
/* TODO: Add page fault info for non-BSD systems */
#endif
#ifdef HAVE_GETRUSAGE
table
->
field
[
14
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_nswap
-
last_rusage
->
ru_nswap
),
true
);
table
->
field
[
14
]
->
null_ptr
=
NULL
;
table
->
field
[
14
]
->
set_notnull
()
;
#else
/* TODO: Add swap info for non-BSD systems */
#endif
...
...
@@ -795,11 +781,11 @@ int PROFILING::fill_statistics_info(THD *thd, struct st_table_list *tables, Item
{
table
->
field
[
15
]
->
store
(
entry
->
function
,
strlen
(
entry
->
function
),
system_charset_info
);
table
->
field
[
15
]
->
null_ptr
=
NULL
;
table
->
field
[
15
]
->
set_notnull
()
;
table
->
field
[
16
]
->
store
(
entry
->
file
,
strlen
(
entry
->
file
),
system_charset_info
);
table
->
field
[
16
]
->
null_ptr
=
NULL
;
table
->
field
[
16
]
->
set_notnull
()
;
table
->
field
[
17
]
->
store
(
entry
->
line
,
true
);
table
->
field
[
17
]
->
null_ptr
=
NULL
;
table
->
field
[
17
]
->
set_notnull
()
;
}
if
(
schema_table_store_record
(
thd
,
table
))
...
...
sql/sql_profile.h
View file @
c186793b
...
...
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
...
...
sql/sql_select.cc
View file @
c186793b
...
...
@@ -1234,8 +1234,8 @@ JOIN::optimize()
if
(
!
group_list
&&
!
exec_tmp_table1
->
distinct
&&
order
&&
simple_order
)
{
thd_proc_info
(
thd
,
"Sorting for order"
);
if
(
create_sort_index
(
thd
,
this
,
order
,
thd_proc_info
(
thd
,
"Sorting for order"
);
if
(
create_sort_index
(
thd
,
this
,
order
,
HA_POS_ERROR
,
HA_POS_ERROR
))
{
DBUG_RETURN
(
1
);
...
...
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