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
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
60 deletions
+43
-60
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
No files found.
configure.in
View file @
c186793b
...
@@ -669,7 +669,7 @@ fi
...
@@ -669,7 +669,7 @@ fi
# Add query profiler
# Add query profiler
AC_ARG_ENABLE
(
profiling,
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
=
$enableval
]
,
[
ENABLED_PROFILING
=
yes
])
[
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,
...
@@ -548,7 +548,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
#ifdef ENABLED_PROFILING
#ifdef ENABLED_PROFILING
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
));
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
);
&
SV
::
profiling_history_size
);
#endif
#endif
...
...
sql/sql_lex.cc
View file @
c186793b
...
@@ -173,9 +173,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
...
@@ -173,9 +173,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex
->
proc_list
.
first
=
0
;
lex
->
proc_list
.
first
=
0
;
lex
->
escape_used
=
FALSE
;
lex
->
escape_used
=
FALSE
;
lex
->
reset_query_tables_list
(
FALSE
);
lex
->
reset_query_tables_list
(
FALSE
);
#ifdef ENABLED_PROFILING
lex
->
profile_options
=
PROFILE_NONE
;
lex
->
profile_options
=
PROFILE_NONE
;
#endif
lex
->
nest_level
=
0
;
lex
->
nest_level
=
0
;
lex
->
allow_sum_func
=
0
;
lex
->
allow_sum_func
=
0
;
lex
->
in_sum_func
=
NULL
;
lex
->
in_sum_func
=
NULL
;
...
...
sql/sql_parse.cc
View file @
c186793b
...
@@ -2707,7 +2707,7 @@ mysql_execute_command(THD *thd)
...
@@ -2707,7 +2707,7 @@ mysql_execute_command(THD *thd)
if
(
res
)
if
(
res
)
goto
error
;
goto
error
;
#else
#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
;
goto
error
;
#endif
#endif
break
;
break
;
...
@@ -2724,7 +2724,7 @@ mysql_execute_command(THD *thd)
...
@@ -2724,7 +2724,7 @@ mysql_execute_command(THD *thd)
if
(
res
)
if
(
res
)
goto
error
;
goto
error
;
#else
#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
;
goto
error
;
#endif
#endif
break
;
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
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
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; version 2 of the License.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
...
@@ -42,24 +41,24 @@ int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables,
...
@@ -42,24 +41,24 @@ int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables,
ST_FIELD_INFO
query_profile_statistics_info
[]
=
ST_FIELD_INFO
query_profile_statistics_info
[]
=
{
{
/* name, length, type, value, maybe_null, old_name */
/* name, length, type, value, maybe_null, old_name */
{
"Q
uery_id
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
},
{
"Q
UERY_ID
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
},
{
"S
eq
"
,
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
},
{
"S
TATE
"
,
30
,
MYSQL_TYPE_STRING
,
0
,
false
,
NULL
},
{
"D
uration
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
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_
USER
"
,
TIME_FLOAT_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
true
,
NULL
},
{
"CPU_
system
"
,
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_VOLUNTARY
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"C
ontext_involuntary
"
,
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_IN
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"B
lock_ops_out
"
,
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_SENT
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"M
essages_received
"
,
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_MAJOR
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"P
age_faults_minor
"
,
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
WAPS
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"S
ource_function
"
,
30
,
MYSQL_TYPE_STRING
,
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_FILE
"
,
20
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
},
{
"S
ource_line
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
"S
OURCE_LINE
"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
NULL
},
{
NULL
,
0
,
MYSQL_TYPE_STRING
,
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,
...
@@ -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
Compute all the space we'll need to allocate one block for everything
we'll need, instead of N mallocs.
we'll need, instead of N mallocs.
*/
*/
if
(
status_arg
!=
NULL
)
sizes
[
0
]
=
(
status_arg
==
NULL
)
?
0
:
strlen
(
status_arg
)
+
1
;
sizes
[
0
]
=
strlen
(
status_arg
)
+
1
;
sizes
[
1
]
=
(
function_arg
==
NULL
)
?
0
:
strlen
(
function_arg
)
+
1
;
else
sizes
[
2
]
=
(
file_arg
==
NULL
)
?
0
:
strlen
(
file_arg
)
+
1
;
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
;
allocated_status_memory
=
(
char
*
)
my_malloc
(
sizes
[
0
]
+
sizes
[
1
]
+
sizes
[
2
],
MYF
(
0
));
allocated_status_memory
=
(
char
*
)
my_malloc
(
sizes
[
0
]
+
sizes
[
1
]
+
sizes
[
2
],
MYF
(
0
));
DBUG_ASSERT
(
allocated_status_memory
!=
NULL
);
DBUG_ASSERT
(
allocated_status_memory
!=
NULL
);
...
@@ -237,7 +225,6 @@ void QUERY_PROFILE::status(const char *status_arg,
...
@@ -237,7 +225,6 @@ void QUERY_PROFILE::status(const char *status_arg,
*/
*/
saved_mem_root
=
thd
->
mem_root
;
saved_mem_root
=
thd
->
mem_root
;
thd
->
mem_root
=
&
profiling
->
mem_root
;
thd
->
mem_root
=
&
profiling
->
mem_root
;
//thd->mem_root= NULL;
if
(
function_arg
&&
file_arg
)
if
(
function_arg
&&
file_arg
)
{
{
...
@@ -375,7 +362,6 @@ bool QUERY_PROFILE::show(uint options)
...
@@ -375,7 +362,6 @@ bool QUERY_PROFILE::show(uint options)
protocol
->
store
(
entry
->
status
,
strlen
(
entry
->
status
),
system_charset_info
);
protocol
->
store
(
entry
->
status
,
strlen
(
entry
->
status
),
system_charset_info
);
protocol
->
store
((
double
)(
entry
->
time_usecs
-
last_time
)
/
(
1000.0
*
1000
),
protocol
->
store
((
double
)(
entry
->
time_usecs
-
last_time
)
/
(
1000.0
*
1000
),
(
uint32
)
TIME_FLOAT_DIGITS
-
1
,
&
elapsed
);
(
uint32
)
TIME_FLOAT_DIGITS
-
1
,
&
elapsed
);
//protocol->store((double)(entry->time - last_time)/(1000*1000*10));
if
(
options
&
PROFILE_CPU
)
if
(
options
&
PROFILE_CPU
)
{
{
...
@@ -739,54 +725,54 @@ int PROFILING::fill_statistics_info(THD *thd, struct st_table_list *tables, Item
...
@@ -739,54 +725,54 @@ int PROFILING::fill_statistics_info(THD *thd, struct st_table_list *tables, Item
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
table
->
field
[
4
]
->
store
((
double
)
RUSAGE_DIFF_USEC
(
entry
->
rusage
.
ru_utime
,
table
->
field
[
4
]
->
store
((
double
)
RUSAGE_DIFF_USEC
(
entry
->
rusage
.
ru_utime
,
last_rusage
->
ru_utime
)
/
(
1000.0
*
1000
));
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
,
table
->
field
[
5
]
->
store
((
double
)
RUSAGE_DIFF_USEC
(
entry
->
rusage
.
ru_stime
,
last_rusage
->
ru_stime
)
/
(
1000.0
*
1000
));
last_rusage
->
ru_stime
)
/
(
1000.0
*
1000
));
table
->
field
[
5
]
->
null_ptr
=
NULL
;
table
->
field
[
5
]
->
set_notnull
()
;
#else
#else
/* TODO: Add CPU-usage info for non-BSD systems */
/* TODO: Add CPU-usage info for non-BSD systems */
#endif
#endif
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
table
->
field
[
6
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_nvcsw
-
last_rusage
->
ru_nvcsw
));
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
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_nivcsw
-
last_rusage
->
ru_nivcsw
));
table
->
field
[
7
]
->
null_ptr
=
NULL
;
table
->
field
[
7
]
->
set_notnull
()
;
#else
#else
/* TODO: Add context switch info for non-BSD systems */
/* TODO: Add context switch info for non-BSD systems */
#endif
#endif
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
table
->
field
[
8
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_inblock
-
last_rusage
->
ru_inblock
));
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
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_oublock
-
last_rusage
->
ru_oublock
));
table
->
field
[
9
]
->
null_ptr
=
NULL
;
table
->
field
[
9
]
->
set_notnull
()
;
#else
#else
/* TODO: Add block IO info for non-BSD systems */
/* TODO: Add block IO info for non-BSD systems */
#endif
#endif
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
table
->
field
[
10
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_msgsnd
-
last_rusage
->
ru_msgsnd
),
true
);
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
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_msgrcv
-
last_rusage
->
ru_msgrcv
),
true
);
table
->
field
[
11
]
->
null_ptr
=
NULL
;
table
->
field
[
11
]
->
set_notnull
()
;
#else
#else
/* TODO: Add message info for non-BSD systems */
/* TODO: Add message info for non-BSD systems */
#endif
#endif
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
table
->
field
[
12
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_majflt
-
last_rusage
->
ru_majflt
),
true
);
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
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_minflt
-
last_rusage
->
ru_minflt
),
true
);
table
->
field
[
13
]
->
null_ptr
=
NULL
;
table
->
field
[
13
]
->
set_notnull
()
;
#else
#else
/* TODO: Add page fault info for non-BSD systems */
/* TODO: Add page fault info for non-BSD systems */
#endif
#endif
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
table
->
field
[
14
]
->
store
((
uint32
)(
entry
->
rusage
.
ru_nswap
-
last_rusage
->
ru_nswap
),
true
);
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
#else
/* TODO: Add swap info for non-BSD systems */
/* TODO: Add swap info for non-BSD systems */
#endif
#endif
...
@@ -795,11 +781,11 @@ int PROFILING::fill_statistics_info(THD *thd, struct st_table_list *tables, Item
...
@@ -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
),
table
->
field
[
15
]
->
store
(
entry
->
function
,
strlen
(
entry
->
function
),
system_charset_info
);
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
]
->
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
]
->
store
(
entry
->
line
,
true
);
table
->
field
[
17
]
->
null_ptr
=
NULL
;
table
->
field
[
17
]
->
set_notnull
()
;
}
}
if
(
schema_table_store_record
(
thd
,
table
))
if
(
schema_table_store_record
(
thd
,
table
))
...
...
sql/sql_profile.h
View file @
c186793b
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
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
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; version 2 of the License.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
...
...
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