mysql默认时区: mysql> show variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | PDT |
| time_zone | SYSTEM |
+------------------+--------+
rows in set (0.01 sec)
my.cnf配制文件修改: 可以通过修改my.cnf
在 [mysqld] 之下加
default-time-zone=timezone
来修改时区。如:
default-time-zone = '+8:00'
通过命令:
set time_zone = timezone
比如北京时间(GMT+)
set time_zone = '+8:00';
美国pst时间(GMT-:)
set time_zone = '-8:00';
eg: mysql> set time_zone = '+8:00';
Query OK, rows affected (0.17 sec) mysql> select now();
+---------------------+
| now() |
+---------------------+
| -- :: |
+---------------------+
row in set (0.00 sec) mysql> set time_zone = '-8:00';
Query OK, rows affected (0.00 sec) mysql> select now();
+---------------------+
| now() |
+---------------------+
| -- :: |
+---------------------+
row in set (0.00 sec)
mysql 数据库中的时区信息默认为空:
mysql> show tables like "%time%";
+---------------------------+
| Tables_in_mysql (%time%) |
+---------------------------+
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
+---------------------------+
5 rows in set (0.00 sec)
导入时区信息到MYSQL中
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
查看导入后的信息: mysql> SELECT * FROM time_zone_name WHERE name LIKE 'America/%' limit ;
+----------------------------------+--------------+
| Name | Time_zone_id |
+----------------------------------+--------------+
| America/Adak | |
| America/Anchorage | |
| America/Anguilla | |
| America/Antigua | |
| America/Araguaina | |
| America/Argentina/Buenos_Aires | |
| America/Argentina/Catamarca | |
| America/Argentina/ComodRivadavia | |
| America/Argentina/Cordoba | |
| America/Argentina/Jujuy | |
+----------------------------------+--------------+
rows in set (0.00 sec)
美国不仅有时区,还有夏令时,冬令时,提前一小时,或者减慢一小时(在时区时间基础上)
美国2016年夏令时将于2016年03月13日当地时间早上02:00(北京时间14:00)开始,至2016年11月6日结束,届时美国的交易时间将较冬令时提前1个小时 mysql> SELECT CONVERT_TZ('2016-03-13 01:30:00','-8:00','America/Los_Angeles') AS TIME\G
*************************** . row ***************************
TIME: -- ::
row in set (0.00 sec)
mysql> SELECT CONVERT_TZ('2016-03-13 02:30:00','-8:00','America/Los_Angeles') AS TIME\G
*************************** 1. row ***************************
TIME: 2016-03-13 03:30:00
1 row in set (0.00 sec)
内核专家:
目前在MySQL数据库中,在初始化time_zone相关表元信息以后,MySQL就可以自己完成夏令时(Daylight Saving Time)和闰秒(Leap Second)的修正,不需要额外的服务器 高手:
设置timezone后,不需要再通过__tz_convert()来转换,各个线程之间并无锁冲突, now()的影响将微乎其微。性能自然获得大大提升。 公司有人实验过,高并发下now()性能有8倍之差。
NOW()函数 不设时区信息需要__tz_convert()进行转换,带时区信息NOW(),就不需要__tz_convert()进行转换 now()不带时区转换过程:
now()或current_timestamp()等获取带有时区信息的时间时,数据库会在server层解析填充其field时,
通过内核层将gmt时间转化为所需的time类型。而转换是通内核层的libc动态库的接口__tz_convert()来实现。 这个实现一个致命的缺点是:串行化
select now();
Breakpoint , 0x00007f50e68a5ab0 in __tz_convert () from /lib64/libc.so.
(gdb) bt
# 0x00007f50e68a5ab0 in __tz_convert () from /lib64/libc.so.
# 0x00000000008a40ef in Time_zone_system::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x48e0830, t=) at /usr/src/mysql-5.6./sql/tztime.cc:
# 0x00000000006e9ce0 in Time_zone::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x48e0830, tv=...) at /usr/src/mysql-5.6./sql/tztime.h:
# 0x00000000006e5e61 in MYSQL_TIME_cache::set_datetime (this=0x48e0830, tv=..., dec_arg= '\000', tz=0x180ee30 <tz_SYSTEM>) at /usr/src/mysql-5.6./sql/item_timefunc.cc:
# 0x00000000006e7bda in Item_func_now::fix_length_and_dec (this=0x48e0760) at /usr/src/mysql-5.6./sql/item_timefunc.cc:
# 0x000000000069e0e7 in Item_func::fix_fields (this=0x48e0760, thd=0x492acb0, ref=0x48e0890) at /usr/src/mysql-5.6./sql/item_func.cc:
# 0x000000000075c155 in setup_fields (thd=0x492acb0, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x48e0bb0, allow_sum_func=true) at /usr/src/mysql-5.6./sql/sql_base.cc:
# 0x00000000007f749d in JOIN::prepare (this=0x48e0968, tables_init=0x0, wild_num=, conds_init=0x0, og_num=, order_init=0x0, group_init=0x0, having_init=0x0, select_lex_arg=0x492d248, unit_arg=0x492cc00) at /usr/src/mysql-5.6./sql/sql_resolver.cc:
# 0x00000000008080cd in mysql_prepare_select (thd=0x492acb0, tables=0x0, wild_num=, fields=..., conds=0x0, og_num=, order=0x0, group=0x0, having=0x0, select_options=, result=0x48e0940, unit=0x492cc00, select_lex=0x492d248, free_join=0x7f5081ec5e6b) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x0000000000808222 in mysql_select (thd=0x492acb0, tables=0x0, wild_num=, fields=..., conds=0x0, order=0x492d410, group=0x492d348, having=0x0, select_options=, result=0x48e0940, unit=0x492cc00, select_lex=0x492d248) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x000000000080854d in handle_select (thd=0x492acb0, result=0x48e0940, setup_tables_done_option=) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x00000000007cdc4e in execute_sqlcom_select (thd=0x492acb0, all_tables=0x0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007cf185 in mysql_execute_command (thd=0x492acb0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d67c4 in mysql_parse (thd=0x492acb0, rawbuf=0x48e06d0 "select now()", length=, parser_state=0x7f5081ec7910) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d83f4 in dispatch_command (command=COM_QUERY, thd=0x492acb0, packet=0x4910c51 "select now()", packet_length=) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d9c80 in do_command (thd=0x492acb0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x000000000078e3fb in do_handle_one_connection (thd_arg=0x492acb0) at /usr/src/mysql-5.6./sql/sql_connect.cc:
# 0x000000000078e4c1 in handle_one_connection (arg=0x492acb0) at /usr/src/mysql-5.6./sql/sql_connect.cc:
# 0x0000000000b11172 in pfs_spawn_thread (arg=0x47900b0) at /usr/src/mysql-5.6./storage/perfschema/pfs.cc:
# 0x00007f50e744083d in start_thread () from /lib64/libpthread.so.
# 0x00007f50e68edfdd in clone () from /lib64/libc.so.
# 0x0000000000000000 in ?? ()
select sysdate();
(gdb) bt
# 0x00007f50e68a5ab0 in __tz_convert () from /lib64/libc.so.
# 0x00000000008a40ef in Time_zone_system::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x7f5081ec5770, t=) at /usr/src/mysql-5.6./sql/tztime.cc:
# 0x00000000006e54de in Item_func_sysdate_local::get_date (this=0x48e0770, now_time=0x7f5081ec5770, fuzzy_date=) at /usr/src/mysql-5.6./sql/item_timefunc.cc:
# 0x0000000000634940 in Item::send (this=0x48e0770, protocol=0x492b1d0, buffer=0x7f5081ec5b70) at /usr/src/mysql-5.6./sql/item.cc:
# 0x000000000070f558 in Protocol::send_result_set_row (this=0x492b1d0, row_items=0x492d368) at /usr/src/mysql-5.6./sql/protocol.cc:
# 0x00000000007833a9 in select_send::send_data (this=0x48e0900, items=...) at /usr/src/mysql-5.6./sql/sql_class.cc:
# 0x00000000007a3ffa in JOIN::exec (this=0x48e0928) at /usr/src/mysql-5.6./sql/sql_executor.cc:
# 0x0000000000807992 in mysql_execute_select (thd=0x492acb0, select_lex=0x492d248, free_join=true) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x0000000000808351 in mysql_select (thd=0x492acb0, tables=0x0, wild_num=, fields=..., conds=0x0, order=0x492d410, group=0x492d348, having=0x0, select_options=, result=0x48e0900, unit=0x492cc00, select_lex=0x492d248) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x000000000080854d in handle_select (thd=0x492acb0, result=0x48e0900, setup_tables_done_option=) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x00000000007cdc4e in execute_sqlcom_select (thd=0x492acb0, all_tables=0x0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007cf185 in mysql_execute_command (thd=0x492acb0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d67c4 in mysql_parse (thd=0x492acb0, rawbuf=0x48e06d0 "select sysdate()", length=, parser_state=0x7f5081ec7910) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d83f4 in dispatch_command (command=COM_QUERY, thd=0x492acb0, packet=0x4910c51 "", packet_length=) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d9c80 in do_command (thd=0x492acb0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x000000000078e3fb in do_handle_one_connection (thd_arg=0x492acb0) at /usr/src/mysql-5.6./sql/sql_connect.cc:
# 0x000000000078e4c1 in handle_one_connection (arg=0x492acb0) at /usr/src/mysql-5.6./sql/sql_connect.cc:
# 0x0000000000b11172 in pfs_spawn_thread (arg=0x47900b0) at /usr/src/mysql-5.6./storage/perfschema/pfs.cc:
# 0x00007f50e744083d in start_thread () from /lib64/libpthread.so.
# 0x00007f50e68edfdd in clone () from /lib64/libc.so.
# 0x0000000000000000 in ?? ()
select now() -2
(gdb) bt
# 0x00007ff8c1c1c1c0 in localtime_r () from /lib64/libc.so.
# 0x00000000008a40ef in Time_zone_system::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x49afae0, t=) at /usr/src/mysql-5.6./sql/tztime.cc:
# 0x00000000006e9ce0 in Time_zone::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x49afae0, tv=...) at /usr/src/mysql-5.6./sql/tztime.h:
# 0x00000000006e5e61 in MYSQL_TIME_cache::set_datetime (this=0x49afae0, tv=..., dec_arg= '\000', tz=0x180ee30 <tz_SYSTEM>) at /usr/src/mysql-5.6./sql/item_timefunc.cc:
# 0x00000000006e7bda in Item_func_now::fix_length_and_dec (this=0x49afa10) at /usr/src/mysql-5.6./sql/item_timefunc.cc:
# 0x000000000069e0e7 in Item_func::fix_fields (this=0x49afa10, thd=0x48c3db0, ref=0x49afb40) at /usr/src/mysql-5.6./sql/item_func.cc:
# 0x000000000075c155 in setup_fields (thd=0x48c3db0, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x49afe60, allow_sum_func=true) at /usr/src/mysql-5.6./sql/sql_base.cc:
# 0x00000000007f749d in JOIN::prepare (this=0x49afc18, tables_init=0x0, wild_num=, conds_init=0x0, og_num=, order_init=0x0, group_init=0x0, having_init=0x0, select_lex_arg=0x48c6348, unit_arg=0x48c5d00) at /usr/src/mysql-5.6./sql/sql_resolver.cc:
# 0x00000000008080cd in mysql_prepare_select (thd=0x48c3db0, tables=0x0, wild_num=, fields=..., conds=0x0, og_num=, order=0x0, group=0x0, having=0x0, select_options=, result=0x49afbf0, unit=0x48c5d00, select_lex=0x48c6348, free_join=0x7ff85d1fce6b) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x0000000000808222 in mysql_select (thd=0x48c3db0, tables=0x0, wild_num=, fields=..., conds=0x0, order=0x48c6510, group=0x48c6448, having=0x0, select_options=, result=0x49afbf0, unit=0x48c5d00, select_lex=0x48c6348) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x000000000080854d in handle_select (thd=0x48c3db0, result=0x49afbf0, setup_tables_done_option=) at /usr/src/mysql-5.6./sql/sql_select.cc:
# 0x00000000007cdc4e in execute_sqlcom_select (thd=0x48c3db0, all_tables=0x0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007cf185 in mysql_execute_command (thd=0x48c3db0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d67c4 in mysql_parse (thd=0x48c3db0, rawbuf=0x49af980 "select now()", length=, parser_state=0x7ff85d1fe910) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d83f4 in dispatch_command (command=COM_QUERY, thd=0x48c3db0, packet=0x49a5751 "select now()", packet_length=) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x00000000007d9c80 in do_command (thd=0x48c3db0) at /usr/src/mysql-5.6./sql/sql_parse.cc:
# 0x000000000078e3fb in do_handle_one_connection (thd_arg=0x48c3db0) at /usr/src/mysql-5.6./sql/sql_connect.cc:
# 0x000000000078e4c1 in handle_one_connection (arg=0x48c3db0) at /usr/src/mysql-5.6./sql/sql_connect.cc:
# 0x0000000000b11172 in pfs_spawn_thread (arg=0x4794e60) at /usr/src/mysql-5.6./storage/perfschema/pfs.cc:
# 0x00007ff8c27b883d in start_thread () from /lib64/libpthread.so.
# 0x00007ff8c1c65fdd in clone () from /lib64/libc.so.
# 0x0000000000000000 in ?? ()
(gdb) disas
Dump of assembler code for function localtime_r:
=> 0x00007ff8c1c1c1c0 <+>: mov %rsi,%rdx
0x00007ff8c1c1c1c3 <+>: mov $0x1,%esi
0x00007ff8c1c1c1c8 <+>: jmpq 0x7ff8c1c1dab0 <__tz_convert>
End of assembler dump.
(gdb) next
Single stepping until exit from function localtime_r,
which has no line number information.
0x00007ff8c1c1dab0 in __tz_convert () from /lib64/libc.so.
(gdb) diaas
Undefined command: "diaas". Try "help".
(gdb) disas
Dump of assembler code for function __tz_convert:
=> 0x00007ff8c1c1dab0 <+>: push %r12
0x00007ff8c1c1dab2 <+>: mov %esi,%r12d
0x00007ff8c1c1dab5 <+>: push %rbp
0x00007ff8c1c1dab6 <+>: mov %rdi,%rbp
0x00007ff8c1c1dab9 <+>: push %rbx
0x00007ff8c1c1daba <+>: mov %rdx,%rbx
0x00007ff8c1c1dabd <+>: sub $0x10,%rsp
0x00007ff8c1c1dac1 <+>: test %rdi,%rdi
0x00007ff8c1c1dac4 <+>: je 0x7ff8c1c1dc6e <__tz_convert+>
0x00007ff8c1c1daca <+>: mov $0x1,%esi
0x00007ff8c1c1dacf <+>: xor %eax,%eax
0x00007ff8c1c1dad1 <+>: cmpl $0x0,0x2cb458(%rip) # 0x7ff8c1ee8f30 <__libc_multiple_threads>
0x00007ff8c1c1dad8 <+>: je 0x7ff8c1c1daea <__tz_convert+>
0x00007ff8c1c1dada <+42>: lock cmpxchg %esi,0x2c8ab2(%rip) # 0x7ff8c1ee6594 <tzset_lock>
0x00007ff8c1c1dae2 <+50>: jne 0x7ff8c1c1dd9a <_L_lock_1685>
0x00007ff8c1c1dae8 <+56>: jmp 0x7ff8c1c1daf7 <__tz_convert+71>
0x00007ff8c1c1daea <+58>: cmpxchg %esi,0x2c8aa3(%rip) # 0x7ff8c1ee6594 <tzset_lock>
0x00007ff8c1c1daf1 <+>: jne 0x7ff8c1c1dd9a <_L_lock_1685>
0x00007ff8c1c1daf7 <+>: lea 0x2cb1c2(%rip),%rax # 0x7ff8c1ee8cc0 <_tmbuf>
0x00007ff8c1c1dafe <+>: xor %edi,%edi
0x00007ff8c1c1db00 <+>: cmp %rax,%rdx
0x00007ff8c1c1db03 <+>: sete %dil
0x00007ff8c1c1db07 <+>: xor %esi,%esi
0x00007ff8c1c1db09 <+>: callq 0x7ff8c1c1d160 <tzset_internal>
0x00007ff8c1c1db0e <+>: mov 0x2cb1ec(%rip),%eax # 0x7ff8c1ee8d00 <__use_tzfile>
0x00007ff8c1c1db14 <+>: test %eax,%eax
0x00007ff8c1c1db16 <+>: je 0x7ff8c1c1db94 <__tz_convert+>
0x00007ff8c1c1db18 <+>: mov 0x0(%rbp),%rdi
0x00007ff8c1c1db1c <+>: lea 0xc(%rsp),%rcx
0x00007ff8c1c1db21 <+>: mov %rsp,%rdx
0x00007ff8c1c1db24 <+>: mov %rbx,%r8
0x00007ff8c1c1db27 <+>: mov %r12d,%esi
0x00007ff8c1c1db2a <+>: callq 0x7ff8c1c1de60 <__tzfile_compute>
0x00007ff8c1c1db2f <+>: test %rbx,%rbx
0x00007ff8c1c1db32 <+>: je 0x7ff8c1c1db64 <__tz_convert+>
0x00007ff8c1c1db34 <+>: test %r12d,%r12d
0x00007ff8c1c1db37 <+>: je 0x7ff8c1c1dbc8 <__tz_convert+>
0x00007ff8c1c1db3d <+>: mov 0x2cb1bd(%rip),%eax # 0x7ff8c1ee8d00 <__use_tzfile>
0x00007ff8c1c1db43 <+>: test %eax,%eax
0x00007ff8c1c1db45 <+>: je 0x7ff8c1c1dc13 <__tz_convert+>
0x00007ff8c1c1db4b <+>: mov 0x28(%rbx),%rsi
0x00007ff8c1c1db4f <+>: sub (%rsp),%rsi
0x00007ff8c1c1db53 <+>: mov %rbx,%rdx
0x00007ff8c1c1db56 <+>: mov %rbp,%rdi
0x00007ff8c1c1db59 <+>: callq 0x7ff8c1c1ba90 <__offtime>
0x00007ff8c1c1db5e <+>: test %eax,%eax
0x00007ff8c1c1db60 <+>: jne 0x7ff8c1c1dbc0 <__tz_convert+>
0x00007ff8c1c1db62 <+>: xor %ebx,%ebx
0x00007ff8c1c1db64 <+>: cmpl $0x0,0x2cb3c5(%rip) # 0x7ff8c1ee8f30 <__libc_multiple_threads>
0x00007ff8c1c1db6b <+>: je 0x7ff8c1c1db7c <__tz_convert+>
0x00007ff8c1c1db6d <+>: lock decl 0x2c8a20(%rip) # 0x7ff8c1ee6594 <tzset_lock>
0x00007ff8c1c1db74 <+>: jne 0x7ff8c1c1ddb9 <_L_unlock_1746>
0x00007ff8c1c1db7a <+>: jmp 0x7ff8c1c1db88 <__tz_convert+>
0x00007ff8c1c1db7c <+>: decl 0x2c8a12(%rip) # 0x7ff8c1ee6594 <tzset_lock>
0x00007ff8c1c1db82 <+>: jne 0x7ff8c1c1ddb9 <_L_unlock_1746>
0x00007ff8c1c1db88 <+>: add $0x10,%rsp
0x00007ff8c1c1db8c <+>: mov %rbx,%rax
0x00007ff8c1c1db8f <+>: pop %rbx
0x00007ff8c1c1db90 <+>: pop %rbp
0x00007ff8c1c1db91 <+>: pop %r12
0x00007ff8c1c1db93 <+>: retq
0x00007ff8c1c1db94 <+>: xor %esi,%esi
0x00007ff8c1c1db96 <+>: mov %rbx,%rdx
0x00007ff8c1c1db99 <+>: mov %rbp,%rdi
0x00007ff8c1c1db9c <+>: callq 0x7ff8c1c1ba90 <__offtime>
0x00007ff8c1c1dba1 <+>: test %eax,%eax
0x00007ff8c1c1dba3 <+>: jne 0x7ff8c1c1dbe7 <__tz_convert+>
0x00007ff8c1c1dba5 <+>: xor %ebx,%ebx
0x00007ff8c1c1dba7 <+>: movq $0x0,(%rsp)
0x00007ff8c1c1dbaf <+>: movl $0x0,0xc(%rsp)
0x00007ff8c1c1dbb7 <+>: jmpq 0x7ff8c1c1db2f <__tz_convert+>
0x00007ff8c1c1dbbc <+>: nopl 0x0(%rax)
0x00007ff8c1c1dbc0 <+>: mov 0xc(%rsp),%eax
0x00007ff8c1c1dbc4 <+>: add %eax,(%rbx)
0x00007ff8c1c1dbc6 <+>: jmp 0x7ff8c1c1db64 <__tz_convert+>
0x00007ff8c1c1dbc8 <+>: lea 0x951ae(%rip),%rax # 0x7ff8c1cb2d7d
0x00007ff8c1c1dbcf <+>: movl $0x0,0x20(%rbx)
0x00007ff8c1c1dbd6 <+>: movq $0x0,0x28(%rbx)
0x00007ff8c1c1dbde <+>: mov %rax,0x30(%rbx)
0x00007ff8c1c1dbe2 <+>: jmpq 0x7ff8c1c1db4b <__tz_convert+>
0x00007ff8c1c1dbe7 <+>: mov 0x14(%rbx),%esi
0x00007ff8c1c1dbea <+>: lea 0x2c89af(%rip),%rdi # 0x7ff8c1ee65a0 <tz_rules>
0x00007ff8c1c1dbf1 <+>: add $0x76c,%esi
0x00007ff8c1c1dbf7 <+>: callq 0x7ff8c1c1ce00 <compute_change>
0x00007ff8c1c1dbfc <+>: mov 0x14(%rbx),%esi
0x00007ff8c1c1dbff <+>: lea 0x2c89ca(%rip),%rdi # 0x7ff8c1ee65d0 <tz_rules+>
0x00007ff8c1c1dc06 <+>: add $0x76c,%esi
0x00007ff8c1c1dc0c <+>: callq 0x7ff8c1c1ce00 <compute_change>
0x00007ff8c1c1dc11 <+>: jmp 0x7ff8c1c1dba7 <__tz_convert+>
0x00007ff8c1c1dc13 <+>: mov 0x2c89a6(%rip),%rcx # 0x7ff8c1ee65c0 <tz_rules+>
0x00007ff8c1c1dc1a <+>: mov 0x2c89cf(%rip),%rdi # 0x7ff8c1ee65f0 <tz_rules+>
0x00007ff8c1c1dc21 <+>: cmp %rdi,%rcx
0x00007ff8c1c1dc24 <+>: jg 0x7ff8c1c1dc83 <__tz_convert+>
0x00007ff8c1c1dc26 <+>: mov 0x0(%rbp),%rsi
0x00007ff8c1c1dc2a <+>: xor %eax,%eax
0x00007ff8c1c1dc2c <+>: cmp %rsi,%rcx
0x00007ff8c1c1dc2f <+>: jg 0x7ff8c1c1dc39 <__tz_convert+>
0x00007ff8c1c1dc31 <+>: xor %eax,%eax
0x00007ff8c1c1dc33 <+>: cmp %rsi,%rdi
0x00007ff8c1c1dc36 <+>: setg %al
0x00007ff8c1c1dc39 <+>: movslq %eax,%rdx
0x00007ff8c1c1dc3c <+>: mov %eax,0x20(%rbx)
0x00007ff8c1c1dc3f <+>: mov 0x2c617a(%rip),%rax # 0x7ff8c1ee3dc0
0x00007ff8c1c1dc46 <+>: mov (%rax,%rdx,),%rax
0x00007ff8c1c1dc4a <+>: mov %rax,0x30(%rbx)
0x00007ff8c1c1dc4e <+>: lea (%rdx,%rdx,),%rax
0x00007ff8c1c1dc52 <+>: add %rdx,%rax
0x00007ff8c1c1dc55 <+>: lea 0x2c894c(%rip),%rdx # 0x7ff8c1ee65a8 <tz_rules+>
0x00007ff8c1c1dc5c <+>: shl $0x4,%rax
0x00007ff8c1c1dc60 <+>: mov 0x10(%rax,%rdx,),%rax
0x00007ff8c1c1dc65 <+>: mov %rax,0x28(%rbx)
0x00007ff8c1c1dc69 <+>: jmpq 0x7ff8c1c1db4b <__tz_convert+>
0x00007ff8c1c1dc6e <+>: mov 0x2c6333(%rip),%rax # 0x7ff8c1ee3fa8
0x00007ff8c1c1dc75 <+>: xor %ebx,%ebx
0x00007ff8c1c1dc77 <+>: movl $0x16,%fs:(%rax)
0x00007ff8c1c1dc7e <+>: jmpq 0x7ff8c1c1db88 <__tz_convert+>
0x00007ff8c1c1dc83 <+>: mov 0x0(%rbp),%rdx
0x00007ff8c1c1dc87 <+>: mov $0x1,%eax
0x00007ff8c1c1dc8c <+>: cmp %rdx,%rdi
0x00007ff8c1c1dc8f <+>: jg 0x7ff8c1c1dc39 <__tz_convert+>
0x00007ff8c1c1dc91 <+>: xor %eax,%eax
0x00007ff8c1c1dc93 <+>: cmp %rdx,%rcx
0x00007ff8c1c1dc96 <+>: setle %al
0x00007ff8c1c1dc99 <+>: jmp 0x7ff8c1c1dc39 <__tz_convert+>
End of assembler dump.
[root@localhost ~]# stap -v -e 'probe process("/lib64/libc-2.5.so").function("__tz_convert").call{ if( tid()==15267) printf("%s:%s %d \n",execname(),probefunc(),tid());print_ubacktrace()}' -d /usr/local/mysql56/bin/mysqld |c++filt
Pass 1: parsed user script and 109 library script(s) using 110724virt/34364res/2112shr/32900data kb, in 260usr/100sys/385real ms.
Pass 2: analyzed script: 1 probe(s), 9 function(s), 4 embed(s), 0 global(s) using 113460virt/38036res/3108shr/35636data kb, in 60usr/1050sys/2125real ms.
Pass 3: using cached /root/.systemtap/cache/a1/stap_a10e8693bbc550250f91b5363abb795b_3427.c
Pass 4: using cached /root/.systemtap/cache/a1/stap_a10e8693bbc550250f91b5363abb795b_3427.ko
Pass 5: starting run.
WARNING: Missing unwind data for module, rerun with 'stap -d /usr/local/mysql56/bin/mysql'
mysqld:__tz_convert 15267
0x7fbcecdb1ab0 : __tz_convert+0x0/0x1f0 [/lib64/libc-2.5.so]
0x8a40ef : Time_zone_system::gmt_sec_to_TIME(st_mysql_time*, long) const+0x29/0x4c [/usr/local/mysql56/bin/mysqld]
0x6e9ce0 : Time_zone::gmt_sec_to_TIME(st_mysql_time*, timeval)+0x3a/0x4c [/usr/local/mysql56/bin/mysqld]
0x6e5e61 : MYSQL_TIME_cache::set_datetime(timeval, unsigned char, Time_zone*)+0x33/0x5e [/usr/local/mysql56/bin/mysqld]
0x6e7bda : Item_func_now::fix_length_and_dec()+0x98/0xba [/usr/local/mysql56/bin/mysqld]
0x69e0e7 : Item_func::fix_fields(THD*, Item**)+0x4d1/0x548 [/usr/local/mysql56/bin/mysqld]
0x75c155 : setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, bool)+0x313/0x688 [/usr/local/mysql56/bin/mysqld]
0x7f749d : JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, st_order*, Item*, st_select_lex*, st_select_lex_unit*)+0x6c3/0x1768 [/usr/local/mysql56/bin/mysqld]
0x8080cd : mysql_prepare_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*, bool*)+0x2f9/0x34a [/usr/local/mysql56/bin/mysqld]
0x808222 : mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*)+0x104/0x23e [/usr/local/mysql56/bin/mysqld]
0x80854d : handle_select(THD*, select_result*, unsigned long)+0x1f1/0x29e [/usr/local/mysql56/bin/mysqld]
0x7cdc4e : execute_sqlcom_select(THD*, TABLE_LIST*)+0x336/0x3ba [/usr/local/mysql56/bin/mysqld]
0x7cf185 : mysql_execute_command(THD*)+0xc91/0x7ec8 [/usr/local/mysql56/bin/mysqld]
0x7d67c4 : mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x408/0x690 [/usr/local/mysql56/bin/mysqld]
0x7d83f4 : dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xd0a/0x227e [/usr/local/mysql56/bin/mysqld]
0x7d9c80 : do_command(THD*)+0x318/0x394 [/usr/local/mysql56/bin/mysqld]
0x78e3fb : do_handle_one_connection(THD*)+0x1ad/0x246 [/usr/local/mysql56/bin/mysqld]
0x78e4c1 : handle_one_connection+0x2d/0x34 [/usr/local/mysql56/bin/mysqld]
0xb11172 : pfs_spawn_thread+0x18c/0x194 [/usr/local/mysql56/bin/mysqld]
0x7fbced94c83d [/lib64/libpthread-2.5.so+0x683d/0x218000]
0x7fc104aaeab0 : __tz_convert+0x0/0x1f0 [/lib64/libc-2.5.so]
0x410901 [/usr/local/mysql56/bin/mysql+0x10901/0x15e000]
^CPass 5: run completed in 10usr/120sys/10618real ms.