summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-05-19 19:05:35 +0200
committerSergei Golubchik <sergii@pisem.net>2011-05-19 19:05:35 +0200
commit90b1a385daaa6bbcdc7dea518c7c527a165f1425 (patch)
tree2cc6c9da412eab9a2176ded10bdb1ca7cbb295de /sql/sql_class.h
parent404928b9f4348c1a476c4a1fa030cc89c33f08d2 (diff)
downloadmariadb-git-90b1a385daaa6bbcdc7dea518c7c527a165f1425.tar.gz
many changes to my_getsystime.c:
* my_getsystime() is only an interval timer. Its value can beused for calculating time intervals. * renamed my_getsystime() to my_interval_timer(), to make the semantics clearer and let the compiler catch wrong usages of my_getsystime() (also future ones, that may come in merges). * increased its granularity from 100ns to 1ns, old value was for UUID, but as UUID can no longer use it directly there is no need to downgrade the OS provided value * fixed the UUID code to anchor the my_interval_timer() on the epoch, as required by the UUID standard. That is, this was only needed by UUID, and now I've moved it to UUID code from my_getsystime(). * fixed other wrong usages of my_getsystime() - e.g. in calculating times for pthread_cond_timedwait. It was buggy and could've caused long waits if OS clock would be changed.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 507b2902eda..9a0a9bc5b38 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2028,17 +2028,14 @@ public:
{
start_time= hrtime_to_my_time(user_time);
start_time_sec_part= hrtime_sec_part(user_time);
- start_utime= utime_after_lock= my_micro_time();
}
else
{
- my_hrtime_t hrtime;
- my_timediff_t timediff;
- my_micro_and_hrtime(&timediff, &hrtime);
+ my_hrtime_t hrtime= my_hrtime();
start_time= hrtime_to_my_time(hrtime);
start_time_sec_part= hrtime_sec_part(hrtime);
- utime_after_lock= start_utime= timediff.val;
}
+ start_utime= utime_after_lock= microsecond_interval_timer();
}
inline void set_current_time()
{
@@ -2051,15 +2048,15 @@ public:
user_time= t;
start_time= hrtime_to_my_time(user_time);
start_time_sec_part= hrtime_sec_part(user_time);
- start_utime= utime_after_lock= my_micro_time();
+ start_utime= utime_after_lock= microsecond_interval_timer();
}
inline void set_time(my_time_t t, ulong sec_part)
{
my_hrtime_t hrtime= { hrtime_from_time(t) + sec_part };
set_time(hrtime);
}
- void set_time_after_lock() { utime_after_lock= my_micro_time(); }
- ulonglong current_utime() { return my_micro_time(); }
+ void set_time_after_lock() { utime_after_lock= microsecond_interval_timer(); }
+ ulonglong current_utime() { return microsecond_interval_timer(); }
inline ulonglong found_rows(void)
{
return limit_found_rows;