summaryrefslogtreecommitdiff
path: root/mysys/my_getsystime.c
diff options
context:
space:
mode:
authorunknown <jani@hynda.mysql.fi>2008-02-18 16:47:00 +0200
committerunknown <jani@hynda.mysql.fi>2008-02-18 16:47:00 +0200
commit641bc9a45f1c7cdeca495f0941928a6195c3abfc (patch)
treef0c00b4674c6884d882c188a2c146c3bff15bdde /mysys/my_getsystime.c
parentad144fa6e10f5e2c037716eaaa09dce8a50cd285 (diff)
downloadmariadb-git-641bc9a45f1c7cdeca495f0941928a6195c3abfc.tar.gz
Fixed a previous patch.
BitKeeper/etc/ignore: added libmysqld/sql_profile.cc client/mysqltest.c: Use my_micro_time() instead of my_getsystime() for faster execution. include/config-win.h: Moved a definition into a header file. mysys/my_getsystime.c: Use GetSystemTimeAsFileTime() instead of QueryPerformanceCounter() for faster execution.
Diffstat (limited to 'mysys/my_getsystime.c')
-rw-r--r--mysys/my_getsystime.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c
index 4fdd979f4bb..e4f6abd1d68 100644
--- a/mysys/my_getsystime.c
+++ b/mysys/my_getsystime.c
@@ -41,7 +41,7 @@ ulonglong my_getsystime()
{
QueryPerformanceCounter(&t_cnt);
return ((t_cnt.QuadPart / query_performance_frequency * 10000000) +
- (t_cnt.QuadPart % query_performance_frequency * 10000000 /
+ ((t_cnt.QuadPart % query_performance_frequency) * 10000000 /
query_performance_frequency) + query_performance_offset);
}
return 0;
@@ -108,21 +108,14 @@ time_t my_time(myf flags __attribute__((unused)))
ulonglong my_micro_time()
{
- ulonglong newtime;
#if defined(__WIN__)
- if (query_performance_frequency)
- {
- QueryPerformanceCounter((LARGE_INTEGER*) &newtime);
- return ((newtime / query_performance_frequency * 10000000) +
- (newtime % query_performance_frequency * 10000000 /
- query_performance_frequency));
- }
- else
- newtime= (GetTickCount() * 1000); /* GetTickCount only returns millisec */
- return newtime;
+ ulonglong newtime;
+ GetSystemTimeAsFileTime((FILETIME*)&newtime);
+ return (newtime/10);
#elif defined(HAVE_GETHRTIME)
return gethrtime()/1000;
#else
+ ulonglong newtime;
struct timeval t;
/*
The following loop is here because gettimeofday may fail on some systems
@@ -161,19 +154,11 @@ ulonglong my_micro_time()
ulonglong my_micro_time_and_time(time_t *time_arg)
{
- ulonglong newtime;
#if defined(__WIN__)
- if (query_performance_frequency)
- {
- QueryPerformanceCounter((LARGE_INTEGER*) &newtime);
- return ((newtime / query_performance_frequency * 10000000) +
- (newtime % query_performance_frequency * 10000000 /
- query_performance_frequency));
- }
- else
- newtime= (GetTickCount() * 1000); /* GetTickCount only returns millisec. */
- (void) time(time_arg);
- return newtime;
+ ulonglong newtime;
+ GetSystemTimeAsFileTime((FILETIME*)&newtime);
+ *time_arg= (newtime-OFFSET_TO_EPOCH)/10000000;
+ return (newtime/10);
#elif defined(HAVE_GETHRTIME)
/*
Solaris has a very slow time() call. We optimize this by using the very
@@ -194,6 +179,7 @@ ulonglong my_micro_time_and_time(time_t *time_arg)
pthread_mutex_unlock(&THR_LOCK_time);
return cur_gethrtime/1000;
#else
+ ulonglong newtime;
struct timeval t;
/*
The following loop is here because gettimeofday may fail on some systems