diff options
author | heikki@hundin.mysql.fi <> | 2002-08-06 22:59:13 +0300 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2002-08-06 22:59:13 +0300 |
commit | 042facc475a7a1d7610aba66526965e5b5ec5261 (patch) | |
tree | 0ed7a5d28436450a6e79787357c337dfae761d1d /innobase/os | |
parent | 5fadf19295e31a0332de4f1ed3362ba1ce51e4ab (diff) | |
download | mariadb-git-042facc475a7a1d7610aba66526965e5b5ec5261.tar.gz |
Many files:
Merge InnoDB-3.23.52d
Diffstat (limited to 'innobase/os')
-rw-r--r-- | innobase/os/os0file.c | 17 | ||||
-rw-r--r-- | innobase/os/os0thread.c | 85 |
2 files changed, 65 insertions, 37 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index e40de2198c1..10bb9bb66d7 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -2486,7 +2486,7 @@ loop: buf += sprintf(buf, "\n"); current_time = time(NULL); - time_elapsed = difftime(current_time, os_last_printout); + time_elapsed = 0.001 + difftime(current_time, os_last_printout); buf += sprintf(buf, "Pending flushes (fsync) log: %lu; buffer pool: %lu\n", @@ -2521,6 +2521,21 @@ loop: } /************************************************************************** +Refreshes the statistics used to print per-second averages. */ + +void +os_aio_refresh_stats(void) +/*======================*/ +{ + os_n_file_reads_old = os_n_file_reads; + os_n_file_writes_old = os_n_file_writes; + os_n_fsyncs_old = os_n_fsyncs; + os_bytes_read_since_printout = 0; + + os_last_printout = time(NULL); +} + +/************************************************************************** Checks that all slots in the system have been freed, that is, there are no pending io operations. */ diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index 44817302340..75f19f6d175 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -18,37 +18,63 @@ Created 9/8/1995 Heikki Tuuri #include "srv0srv.h" -/********************************************************************* -Returns the thread identifier of current thread. */ - -os_thread_id_t -os_thread_get_curr_id(void) -/*=======================*/ +/******************************************************************* +Compares two threads or thread ids for equality */ + +ibool +os_thread_eq( +/*=========*/ + /* out: TRUE if equal */ + os_thread_t a, /* in: OS thread or thread id */ + os_thread_t b) /* in: OS thread or thread id */ { #ifdef __WIN__ - return(GetCurrentThreadId()); + if (a == b) { + return(TRUE); + } + + return(FALSE); #else - pthread_t pthr; + if (pthread_equal(a, b)) { + return(TRUE); + } - pthr = pthread_self(); + return(FALSE); +#endif +} -#ifdef HPUX - /* TODO: in the future we have to change os_thread_id - to pthread_t! */ +/******************************************************************** +Converts an OS thread or thread id to a ulint. It is NOT guaranteed that +the ulint is unique for the thread though! */ - /* In HP-UX a pthread_t seems to be a struct of three fields: - field1, field2, field3, and the first probably determines (?) - the thread identity. */ +ulint +os_thread_pf( +/*=========*/ + os_thread_t a) +{ +#ifdef UNIV_HPUX + /* In HP-UX a pthread_t is a struct of 3 fields: field1, field2, + field3. We do not know if field1 determines the thread uniquely. */ - return((os_thread_id_t)(pthr.field1)); + return((ulint)(a.field1)); #else - /* TODO: define os_thread_id_t in Unix as the same as pthread_t - and compare them with appropriate Posix pthread functions! - The following typecast will not work if pthread_t is not - an integer or a pointer to a unique object for the thread! */ - - return((os_thread_id_t)pthr); + return((ulint)a); #endif +} + +/********************************************************************* +Returns the thread identifier of current thread. Currently the thread +identifier is the thread handle itself. Note that in HP-UX pthread_t is +a struct of 3 fields. */ + +os_thread_id_t +os_thread_get_curr_id(void) +/*=======================*/ +{ +#ifdef __WIN__ + return(GetCurrentThread()); +#else + return(pthread_self()); #endif } @@ -81,7 +107,6 @@ os_thread_create( arg, 0, /* thread runs immediately */ thread_id); - ut_a(thread); if (srv_set_thread_priorities) { @@ -118,7 +143,7 @@ Returns handle to the current thread. */ os_thread_t os_thread_get_curr(void) -/*=======================*/ +/*====================*/ { #ifdef __WIN__ return(GetCurrentThread()); @@ -126,18 +151,6 @@ os_thread_get_curr(void) return(pthread_self()); #endif } - -/********************************************************************* -Converts a thread id to a ulint. */ - -ulint -os_thread_conv_id_to_ulint( -/*=======================*/ - /* out: converted to ulint */ - os_thread_id_t id) /* in: thread id */ -{ - return((ulint)id); -} /********************************************************************* Advises the os to give up remainder of the thread's time slice. */ |