mysql 时区 , 夏令时,冬令时

时间:2024-04-15 12:25:09

 

mysql默认时区:


mysql> show variables like \'%time_zone%\'; +------------------+--------+ | Variable_name | Value | +------------------+--------+ | system_time_zone | PDT | | time_zone | SYSTEM | +------------------+--------+ 2 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+0800set time_zone = \'+8:00\';
美国pst时间(GMT-08:00set time_zone = \'-8:00\';

 

eg:

mysql> set time_zone = \'+8:00\'; Query OK, 0 rows affected (0.17 sec) mysql> select now(); +---------------------+ | now() | +---------------------+ | 2016-06-23 16:32:53 | +---------------------+ 1 row in set (0.00 sec) mysql> set time_zone = \'-8:00\'; Query OK, 0 rows affected (0.00 sec) mysql> select now(); +---------------------+ | now() | +---------------------+ | 2016-06-23 00:33:21 | +---------------------+ 1 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 10; +----------------------------------+--------------+ | Name | Time_zone_id | +----------------------------------+--------------+ | America/Adak | 54 | | America/Anchorage | 55 | | America/Anguilla | 56 | | America/Antigua | 57 | | America/Araguaina | 58 | | America/Argentina/Buenos_Aires | 59 | | America/Argentina/Catamarca | 60 | | America/Argentina/ComodRivadavia | 61 | | America/Argentina/Cordoba | 62 | | America/Argentina/Jujuy | 63 | +----------------------------------+--------------+ 10 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 *************************** 1. row *************************** TIME: 2016-03-13 01:30:00 1 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 2, 0x00007f50e68a5ab0 in __tz_convert () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f50e68a5ab0 in __tz_convert () from /lib64/libc.so.6
#1  0x00000000008a40ef in Time_zone_system::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x48e0830, t=1467609071) at /usr/src/mysql-5.6.28/sql/tztime.cc:1079
#2  0x00000000006e9ce0 in Time_zone::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x48e0830, tv=...) at /usr/src/mysql-5.6.28/sql/tztime.h:60
#3  0x00000000006e5e61 in MYSQL_TIME_cache::set_datetime (this=0x48e0830, tv=..., dec_arg=0 \'\000\', tz=0x180ee30 <tz_SYSTEM>) at /usr/src/mysql-5.6.28/sql/item_timefunc.cc:1747
#4  0x00000000006e7bda in Item_func_now::fix_length_and_dec (this=0x48e0760) at /usr/src/mysql-5.6.28/sql/item_timefunc.cc:1866
#5  0x000000000069e0e7 in Item_func::fix_fields (this=0x48e0760, thd=0x492acb0, ref=0x48e0890) at /usr/src/mysql-5.6.28/sql/item_func.cc:231
#6  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.28/sql/sql_base.cc:8400
#7  0x00000000007f749d in JOIN::prepare (this=0x48e0968, tables_init=0x0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, group_init=0x0, having_init=0x0, select_lex_arg=0x492d248, unit_arg=0x492cc00) at /usr/src/mysql-5.6.28/sql/sql_resolver.cc:168
#8  0x00000000008080cd in mysql_prepare_select (thd=0x492acb0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, select_options=2147748608, result=0x48e0940, unit=0x492cc00, select_lex=0x492d248, free_join=0x7f5081ec5e6b) at /usr/src/mysql-5.6.28/sql/sql_select.cc:1055
#9  0x0000000000808222 in mysql_select (thd=0x492acb0, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x492d410, group=0x492d348, having=0x0, select_options=2147748608, result=0x48e0940, unit=0x492cc00, select_lex=0x492d248) at /usr/src/mysql-5.6.28/sql/sql_select.cc:1178
#10 0x000000000080854d in handle_select (thd=0x492acb0, result=0x48e0940, setup_tables_done_option=0) at /usr/src/mysql-5.6.28/sql/sql_select.cc:110
#11 0x00000000007cdc4e in execute_sqlcom_select (thd=0x492acb0, all_tables=0x0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:5134
#12 0x00000000007cf185 in mysql_execute_command (thd=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:2656
#13 0x00000000007d67c4 in mysql_parse (thd=0x492acb0, rawbuf=0x48e06d0 "select now()", length=12, parser_state=0x7f5081ec7910) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:6386
#14 0x00000000007d83f4 in dispatch_command (command=COM_QUERY, thd=0x492acb0, packet=0x4910c51 "select now()", packet_length=12) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:1340
#15 0x00000000007d9c80 in do_command (thd=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:1037
#16 0x000000000078e3fb in do_handle_one_connection (thd_arg=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_connect.cc:982
#17 0x000000000078e4c1 in handle_one_connection (arg=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_connect.cc:898
#18 0x0000000000b11172 in pfs_spawn_thread (arg=0x47900b0) at /usr/src/mysql-5.6.28/storage/perfschema/pfs.cc:1860
#19 0x00007f50e744083d in start_thread () from /lib64/libpthread.so.0
#20 0x00007f50e68edfdd in clone () from /lib64/libc.so.6
#21 0x0000000000000000 in ?? ()

 

select sysdate();

(gdb) bt
#0  0x00007f50e68a5ab0 in __tz_convert () from /lib64/libc.so.6
#1  0x00000000008a40ef in Time_zone_system::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x7f5081ec5770, t=1467609724) at /usr/src/mysql-5.6.28/sql/tztime.cc:1079
#2  0x00000000006e54de in Item_func_sysdate_local::get_date (this=0x48e0770, now_time=0x7f5081ec5770, fuzzy_date=1) at /usr/src/mysql-5.6.28/sql/item_timefunc.cc:1910
#3  0x0000000000634940 in Item::send (this=0x48e0770, protocol=0x492b1d0, buffer=0x7f5081ec5b70) at /usr/src/mysql-5.6.28/sql/item.cc:6925
#4  0x000000000070f558 in Protocol::send_result_set_row (this=0x492b1d0, row_items=0x492d368) at /usr/src/mysql-5.6.28/sql/protocol.cc:847
#5  0x00000000007833a9 in select_send::send_data (this=0x48e0900, items=...) at /usr/src/mysql-5.6.28/sql/sql_class.cc:2531
#6  0x00000000007a3ffa in JOIN::exec (this=0x48e0928) at /usr/src/mysql-5.6.28/sql/sql_executor.cc:149
#7  0x0000000000807992 in mysql_execute_select (thd=0x492acb0, select_lex=0x492d248, free_join=true) at /usr/src/mysql-5.6.28/sql/sql_select.cc:1101
#8  0x0000000000808351 in mysql_select (thd=0x492acb0, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x492d410, group=0x492d348, having=0x0, select_options=2147748608, result=0x48e0900, unit=0x492cc00, select_lex=0x492d248) at /usr/src/mysql-5.6.28/sql/sql_select.cc:1222
#9  0x000000000080854d in handle_select (thd=0x492acb0, result=0x48e0900, setup_tables_done_option=0) at /usr/src/mysql-5.6.28/sql/sql_select.cc:110
#10 0x00000000007cdc4e in execute_sqlcom_select (thd=0x492acb0, all_tables=0x0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:5134
#11 0x00000000007cf185 in mysql_execute_command (thd=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:2656
#12 0x00000000007d67c4 in mysql_parse (thd=0x492acb0, rawbuf=0x48e06d0 "select sysdate()", length=16, parser_state=0x7f5081ec7910) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:6386
#13 0x00000000007d83f4 in dispatch_command (command=COM_QUERY, thd=0x492acb0, packet=0x4910c51 "", packet_length=16) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:1340
#14 0x00000000007d9c80 in do_command (thd=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:1037
#15 0x000000000078e3fb in do_handle_one_connection (thd_arg=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_connect.cc:982
#16 0x000000000078e4c1 in handle_one_connection (arg=0x492acb0) at /usr/src/mysql-5.6.28/sql/sql_connect.cc:898
#17 0x0000000000b11172 in pfs_spawn_thread (arg=0x47900b0) at /usr/src/mysql-5.6.28/storage/perfschema/pfs.cc:1860
#18 0x00007f50e744083d in start_thread () from /lib64/libpthread.so.0
#19 0x00007f50e68edfdd in clone () from /lib64/libc.so.6
#20 0x0000000000000000 in ?? ()

 

 select now() -2
(gdb) bt
#0  0x00007ff8c1c1c1c0 in localtime_r () from /lib64/libc.so.6
#1  0x00000000008a40ef in Time_zone_system::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x49afae0, t=1467636107) at /usr/src/mysql-5.6.28/sql/tztime.cc:1079
#2  0x00000000006e9ce0 in Time_zone::gmt_sec_to_TIME (this=0x180ee30 <tz_SYSTEM>, tmp=0x49afae0, tv=...) at /usr/src/mysql-5.6.28/sql/tztime.h:60
#3  0x00000000006e5e61 in MYSQL_TIME_cache::set_datetime (this=0x49afae0, tv=..., dec_arg=0 \'\000\', tz=0x180ee30 <tz_SYSTEM>) at /usr/src/mysql-5.6.28/sql/item_timefunc.cc:1747
#4  0x00000000006e7bda in Item_func_now::fix_length_and_dec (this=0x49afa10) at /usr/src/mysql-5.6.28/sql/item_timefunc.cc:1866
#5  0x000000000069e0e7 in Item_func::fix_fields (this=0x49afa10, thd=0x48c3db0, ref=0x49afb40) at /usr/src/mysql-5.6.28/sql/item_func.cc:231
#6  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.28/sql/sql_base.cc:8400
#7  0x00000000007f749d in JOIN::prepare (this=0x49afc18, tables_init=0x0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, group_init=0x0, having_init=0x0, select_lex_arg=0x48c6348, unit_arg=0x48c5d00) at /usr/src/mysql-5.6.28/sql/sql_resolver.cc:168
#8  0x00000000008080cd in mysql_prepare_select (thd=0x48c3db0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, select_options=2147748608, result=0x49afbf0, unit=0x48c5d00, select_lex=0x48c6348, free_join=0x7ff85d1fce6b) at /usr/src/mysql-5.6.28/sql/sql_select.cc:1055
#9  0x0000000000808222 in mysql_select (thd=0x48c3db0, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x48c6510, group=0x48c6448, having=0x0, select_options=2147748608, result=0x49afbf0, unit=0x48c5d00, select_lex=0x48c6348) at /usr/src/mysql-5.6.28/sql/sql_select.cc:1178
#10 0x000000000080854d in handle_select (thd=0x48c3db0, result=0x49afbf0, setup_tables_done_option=0) at /usr/src/mysql-5.6.28/sql/sql_select.cc:110
#11 0x00000000007cdc4e in execute_sqlcom_select (thd=0x48c3db0, all_tables=0x0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:5134
#12 0x00000000007cf185 in mysql_execute_command (thd=0x48c3db0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:2656
#13 0x00000000007d67c4 in mysql_parse (thd=0x48c3db0, rawbuf=0x49af980 "select now()", length=12, parser_state=0x7ff85d1fe910) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:6386
#14 0x00000000007d83f4 in dispatch_command (command=COM_QUERY, thd=0x48c3db0, packet=0x49a5751 "select now()", packet_length=12) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:1340
#15 0x00000000007d9c80 in do_command (thd=0x48c3db0) at /usr/src/mysql-5.6.28/sql/sql_parse.cc:1037
#16 0x000000000078e3fb in do_handle_one_connection (thd_arg=0x48c3db0) at /usr/src/mysql-5.6.28/sql/sql_connect.cc:982
#17 0x000000000078e4c1 in handle_one_connection (arg=0x48c3db0) at /usr/src/mysql-5.6.28/sql/sql_connect.cc:898
#18 0x0000000000b11172 in pfs_spawn_thread (arg=0x4794e60) at /usr/src/mysql-5.6.28/storage/perfschema/pfs.cc:1860
#19 0x00007ff8c27b883d in start_thread () from /lib64/libpthread.so.0
#20 0x00007ff8c1c65fdd in clone () from /lib64/libc.so.6
#21 0x0000000000000000 in ?? ()
(gdb) disas
Dump of assembler code for function localtime_r:
=> 0x00007ff8c1c1c1c0 <+0>:     mov    %rsi,%rdx
   0x00007ff8c1c1c1c3 <+3>:     mov    $0x1,%esi
   0x00007ff8c1c1c1c8 <+8>:     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.6
(gdb) diaas
Undefined command: "diaas".  Try "help".
(gdb) disas
Dump of assembler code for function __tz_convert:
=> 0x00007ff8c1c1dab0 <+0>:     push   %r12
   0x00007ff8c1c1dab2 <+2>:     mov    %esi,%r12d
   0x00007ff8c1c1dab5 <+5>:     push   %rbp
   0x00007ff8c1c1dab6 <+6>:     mov    %rdi,%rbp
   0x00007ff8c1c1dab9 <+9>:     push   %rbx
   0x00007ff8c1c1daba <+10>:    mov    %rdx,%rbx
   0x00007ff8c1c1dabd <+13>:    sub    $0x10,%rsp
   0x00007ff8c1c1dac1 <+17>:    test   %rdi,%rdi
   0x00007ff8c1c1dac4 <+20>:    je     0x7ff8c1c1dc6e <__tz_convert+446>
   0x00007ff8c1c1daca <+26>:    mov    $0x1,%esi
   0x00007ff8c1c1dacf <+31>:    xor    %eax,%eax
   0x00007ff8c1c1dad1 <+33>:    cmpl   $0x0,0x2cb458(%rip)        # 0x7ff8c1ee8f30 <__libc_multiple_threads>
   0x00007ff8c1c1dad8 <+40>:    je     0x7ff8c1c1daea <__tz_convert+58>
   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 <+65>:    jne    0x7ff8c1c1dd9a <_L_lock_1685>
   0x00007ff8c1c1daf7 <+71>:    lea    0x2cb1c2(%rip),%rax        # 0x7ff8c1ee8cc0 <_tmbuf>
   0x00007ff8c1c1dafe <+78>:    xor    %edi,%edi
   0x00007ff8c1c1db00 <+80>:    cmp    %rax,%rdx
   0x00007ff8c1c1db03 <+83>:    sete   %dil
   0x00007ff8c1c1db07 <+87>:    xor    %esi,%esi
   0x00007ff8c1c1db09 <+89>:    callq  0x7ff8c1c1d160 <tzset_internal>
   0x00007ff8c1c1db0e <+94>:    mov    0x2cb1ec(%rip),%eax        # 0x7ff8c1ee8d00 <__use_tzfile>
   0x00007ff8c1c1db14 <+100>:   test   %eax,%eax
   0x00007ff8c1c1db16 <+102>:   je     0x7ff8c1c1db94 <__tz_convert+228>
   0x00007ff8c1c1db18 <+104>:   mov    0x0(%rbp),%rdi
   0x00007ff8c1c1db1c <+108>:   lea    0xc(%rsp),%rcx
   0x00007ff8c1c1db21 <+113>:   mov    %rsp,%rdx
   0x00007ff8c1c1db24 <+116>:   mov    %rbx,%r8
   0x00007ff8c1c1db27 <+119>:   mov    %r12d,%esi
   0x00007ff8c1c1db2a <+122>:   callq  0x7ff8c1c1de60 <__tzfile_compute>
   0x00007ff8c1c1db2f <+127>:   test   %rbx,%rbx
   0x00007ff8c1c1db32 <+130>:   je     0x7ff8c1c1db64 <__tz_convert+180>
   0x00007ff8c1c1db34 <+132>:   test   %r12d,%r12d
   0x00007ff8c1c1db37 <+135>:   je     0x7ff8c1c1dbc8 <__tz_convert+280>
   0x00007ff8c1c1db3d <+141>:   mov    0x2cb1bd(%rip),%eax        # 0x7ff8c1ee8d00 <__use_tzfile>
   0x00007ff8c1c1db43 <+147>:   test   %eax,%eax
   0x00007ff8c1c1db45 <+149>:   je     0x7ff8c1c1dc13 <__tz_convert+355>
   0x00007ff8c1c1db4b <+155>:   mov    0x28(%rbx),%rsi
   0x00007ff8c1c1db4f <+159>:   sub    (%rsp),%rsi
   0x00007ff8c1c1db53 <+163>:   mov    %rbx,%rdx
   0x00007ff8c1c1db56 <+166>:   mov    %rbp,%rdi
   0x00007ff8c1c1db59 <+169>:   callq  0x7ff8c1c1ba90 <__offtime>
   0x00007ff8c1c1db5e <+174>:   test   %eax,%eax
   0x00007ff8c1c1db60 <+176>:   jne    0x7ff8c1c1dbc0 <__tz_convert+272>
   0x00007ff8c1c1db62 <+178>:   xor    %ebx,%ebx
   0x00007ff8c1c1db64 <+180>:   cmpl   $0x0,0x2cb3c5(%rip)        # 0x7ff8c1ee8f30 <__libc_multiple_threads>
   0x00007ff8c1c1db6b <+187>:   je     0x7ff8c1c1db7c <__tz_convert+204>
   0x00007ff8c1c1db6d <+189>:   lock decl 0x2c8a20(%rip)        # 0x7ff8c1ee6594 <tzset_lock>
   0x00007ff8c1c1db74 <+196>:   jne    0x7ff8c1c1ddb9 <_L_unlock_1746>
   0x00007ff8c1c1db7a <+202>:   jmp    0x7ff8c1c1db88 <__tz_convert+216>
   0x00007ff8c1c1db7c <+204>:   decl   0x2c8a12(%rip)        # 0x7ff8c1ee6594 <tzset_lock>
   0x00007ff8c1c1db82 <+210>:   jne    0x7ff8c1c1ddb9 <_L_unlock_1746>
   0x00007ff8c1c1db88 <+216>:   add    $0x10,%rsp
   0x00007ff8c1c1db8c <+220>:   mov    %rbx,%rax
   0x00007ff8c1c1db8f <+223>:   pop    %rbx
   0x00007ff8c1c1db90 <+224>:   pop    %rbp
   0x00007ff8c1c1db91 <+225>:   pop    %r12
   0x00007ff8c1c1db93 <+227>:   retq   
   0x00007ff8c1c1db94 <+228>:   xor    %esi,%esi
   0x00007ff8c1c1db96 <+230>:   mov    %rbx,%rdx
   0x00007ff8c1c1db99 <+233>:   mov    %rbp,%rdi
   0x00007ff8c1c1db9c <+236>:   callq  0x7ff8c1c1ba90 <__offtime>
   0x00007ff8c1c1dba1 <+241>:   test   %eax,%eax
   0x00007ff8c1c1dba3 <+243>:   jne    0x7ff8c1c1dbe7 <__tz_convert+311>
   0x00007ff8c1c1dba5 <+245>:   xor    %ebx,%ebx
   0x00007ff8c1c1dba7 <+247>:   movq   $0x0,(%rsp)
   0x00007ff8c1c1dbaf <+255>:   movl   $0x0,0xc(%rsp)
   0x00007ff8c1c1dbb7 <+263>:   jmpq   0x7ff8c1c1db2f <__tz_convert+127>
   0x00007ff8c1c1dbbc <+268>:   nopl   0x0(%rax)
   0x00007ff8c1c1dbc0 <+272>:   mov    0xc(%rsp),%eax
   0x00007ff8c1c1dbc4 <+276>:   add    %eax,(%rbx)
   0x00007ff8c1c1dbc6 <+278>:   jmp    0x7ff8c1c1db64 <__tz_convert+180>
   0x00007ff8c1c1dbc8 <+280>:   lea    0x951ae(%rip),%rax        # 0x7ff8c1cb2d7d
   0x00007ff8c1c1dbcf <+287>:   movl   $0x0,0x20(%rbx)
   0x00007ff8c1c1dbd6 <+294>:   movq   $0x0,0x28(%rbx)
   0x00007ff8c1c1dbde <+302>:   mov    %rax,0x30(%rbx)
   0x00007ff8c1c1dbe2 <+306>:   jmpq   0x7ff8c1c1db4b <__tz_convert+155>
   0x00007ff8c1c1dbe7 <+311>:   mov    0x14(%rbx),%esi
   0x00007ff8c1c1dbea <+314>:   lea    0x2c89af(%rip),%rdi        # 0x7ff8c1ee65a0 <tz_rules>
   0x00007ff8c1c1dbf1 <+321>:   add    $0x76c,%esi
   0x00007ff8c1c1dbf7 <+327>:   callq  0x7ff8c1c1ce00 <compute_change>
   0x00007ff8c1c1dbfc <+332>:   mov    0x14(%rbx),%esi
   0x00007ff8c1c1dbff <+335>:   lea    0x2c89ca(%rip),%rdi        # 0x7ff8c1ee65d0 <tz_rules+48>
   0x00007ff8c1c1dc06 <+342>:   add    $0x76c,%esi
   0x00007ff8c1c1dc0c <+348>:   callq  0x7ff8c1c1ce00 <compute_change>
   0x00007ff8c1c1dc11 <+353>:   jmp    0x7ff8c1c1dba7 <__tz_convert+247>
   0x00007ff8c1c1dc13 <+355>:   mov    0x2c89a6(%rip),%rcx        # 0x7ff8c1ee65c0 <tz_rules+32>
   0x00007ff8c1c1dc1a <+362>:   mov    0x2c89cf(%rip),%rdi        # 0x7ff8c1ee65f0 <tz_rules+80>
   0x00007ff8c1c1dc21 <+369>:   cmp    %rdi,%rcx
   0x00007ff8c1c1dc24 <+372>:   jg     0x7ff8c1c1dc83 <__tz_convert+467>
   0x00007ff8c1c1dc26 <+374>:   mov    0x0(%rbp),%rsi
   0x00007ff8c1c1dc2a <+378>:   xor    %eax,%eax
   0x00007ff8c1c1dc2c <+380>:   cmp    %rsi,%rcx
   0x00007ff8c1c1dc2f <+383>:   jg     0x7ff8c1c1dc39 <__tz_convert+393>
   0x00007ff8c1c1dc31 <+385>:   xor    %eax,%eax
   0x00007ff8c1c1dc33 <+387>:   cmp    %rsi,%rdi
   0x00007ff8c1c1dc36 <+390>:   setg   %al
   0x00007ff8c1c1dc39 <+393>:   movslq %eax,%rdx
   0x00007ff8c1c1dc3c <+396>:   mov    %eax,0x20(%rbx)
   0x00007ff8c1c1dc3f <+399>:   mov    0x2c617a(%rip),%rax        # 0x7ff8c1ee3dc0
   0x00007ff8c1c1dc46 <+406>:   mov    (%rax,%rdx,8),%rax
   0x00007ff8c1c1dc4a <+410>:   mov    %rax,0x30(%rbx)
   0x00007ff8c1c1dc4e <+414>:   lea    (%rdx,%rdx,1),%rax
   0x00007ff8c1c1dc52 <+418>:   add    %rdx,%rax
   0x00007ff8c1c1dc55 <+421>:   lea    0x2c894c(%rip),%rdx        # 0x7ff8c1ee65a8 <tz_rules+8>
   0x00007ff8c1c1dc5c <+428>:   shl    $0x4,%rax
   0x00007ff8c1c1dc60 <+432>:   mov    0x10(%rax,%rdx,1),%rax
   0x00007ff8c1c1dc65 <+437>:   mov    %rax,0x28(%rbx)
   0x00007ff8c1c1dc69 <+441>:   jmpq   0x7ff8c1c1db4b <__tz_convert+155>
   0x00007ff8c1c1dc6e <+446>:   mov    0x2c6333(%rip),%rax        # 0x7ff8c1ee3fa8
   0x00007ff8c1c1dc75 <+453>:   xor    %ebx,%ebx
   0x00007ff8c1c1dc77 <+455>:   movl   $0x16,%fs:(%rax)
   0x00007ff8c1c1dc7e <+462>:   jmpq   0x7ff8c1c1db88 <__tz_convert+216>
   0x00007ff8c1c1dc83 <+467>:   mov    0x0(%rbp),%rdx
   0x00007ff8c1c1dc87 <+471>:   mov    $0x1,%eax
   0x00007ff8c1c1dc8c <+476>:   cmp    %rdx,%rdi
   0x00007ff8c1c1dc8f <+479>:   jg     0x7ff8c1c1dc39 <__tz_convert+393>
   0x00007ff8c1c1dc91 <+481>:   xor    %eax,%eax
   0x00007ff8c1c1dc93 <+483>:   cmp    %rdx,%rcx
   0x00007ff8c1c1dc96 <+486>:   setle  %al
   0x00007ff8c1c1dc99 <+489>:   jmp    0x7ff8c1c1dc39 <__tz_convert+393>
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.