maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #08716
Re: [Commits] 3f0b023: MDEV-7952 - clock_gettime() takes 0.24% in OLTP RO
Hi, Sergey!
On Jun 17, svoj@xxxxxxxxxxx wrote:
> revision-id: 3f0b02351a53e0fcaee8554c2c852fb3da8fe7da
> parent(s): 5d03dd20a4abbfd9777b619dfd51a6927323955a
> committer: Sergey Vojtovich
> branch nick: mariadb
> timestamp: 2015-06-17 18:55:38 +0400
> message:
>
> MDEV-7952 - clock_gettime() takes 0.24% in OLTP RO
>
> Initialize abs_timeout when it is about to be used. This saves one my_hrtime()
> call on hot path (when we acquire MDL lock without waiting).
ok
> When filling I_S.PROCESSLIST use THD::start_utime/THD::utime_after_query instead
> of THD::start_time. This allows us to save 2 clock_gettime() calls.
see below
> diff --git a/sql/sql_show.cc b/sql/sql_show.cc
> index 1e4723d..fa3161a 100644
> --- a/sql/sql_show.cc
> +++ b/sql/sql_show.cc
> @@ -2730,7 +2730,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
> TABLE *table= tables->table;
> CHARSET_INFO *cs= system_charset_info;
> char *user;
> - my_hrtime_t unow= my_hrtime();
> + ulonglong unow= microsecond_interval_timer();
> DBUG_ENTER("fill_schema_processlist");
>
> DEBUG_SYNC(thd,"fill_schema_processlist_after_unow");
> @@ -2793,9 +2793,12 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
> table->field[4]->store(command_name[tmp->get_command()].str,
> command_name[tmp->get_command()].length, cs);
> /* MYSQL_TIME */
> - ulonglong start_utime= tmp->start_time * HRTIME_RESOLUTION + tmp->start_time_sec_part;
> - ulonglong utime= start_utime && start_utime < unow.val
> - ? unow.val - start_utime : 0;
> + ulonglong utime= tmp->start_utime;
> + ulonglong utime_after_query_snapshot= tmp->utime_after_query;
> + if (utime < utime_after_query_snapshot)
> + utime= utime_after_query_snapshot; // COM_SLEEP
> + utime= utime && utime < unow ? unow - utime : 0;
1.
Please add an assert here that utime<=unow. It uses
microsecond_interval_timer(), which is supposed to be strictly
increasing (unlike my_hrtime()).
2.
You might need to update mysqld_list_processes() too.
> table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE);
> /* STATE */
Regards,
Sergei
Follow ups