diff options
Diffstat (limited to 'innobase/os')
-rw-r--r-- | innobase/os/os0file.c | 19 | ||||
-rw-r--r-- | innobase/os/os0thread.c | 76 |
2 files changed, 67 insertions, 28 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index ae3c8a45f62..3ca0fbd68a4 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -22,7 +22,7 @@ Created 10/21/1995 Heikki Tuuri #endif -/* This specifies the file permissions InnoDB uses when it craetes files in +/* This specifies the file permissions InnoDB uses when it creates files in Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to my_umask */ @@ -2483,7 +2483,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", @@ -2518,6 +2518,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 49d4c8518fb..a8b417f4f3a 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -18,26 +18,63 @@ Created 9/8/1995 Heikki Tuuri #include "srv0srv.h" +/******************************************************************* +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__ + if (a == b) { + return(TRUE); + } + + return(FALSE); +#else + if (pthread_equal(a, b)) { + return(TRUE); + } + + return(FALSE); +#endif +} + +/******************************************************************** +Converts an OS thread or thread id to a ulint. It is NOT guaranteed that +the ulint is unique for the thread though! */ + +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((ulint)(a.field1)); +#else + return((ulint)a); +#endif +} + /********************************************************************* -Returns the thread identifier of current thread. */ +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(GetCurrentThreadId()); + return(GetCurrentThread()); #else - pthread_t pthr; - - pthr = pthread_self(); - - /* TODO: in the future we have to change os_thread_id - to pthread_t; the following cast may work in a wrong way on some - systems if pthread_t is a struct; this is just a quick fix - for HP-UX to eliminate a compiler warning */ - - return(*(os_thread_id_t*)((void*) (&pthr))); + return(pthread_self()); #endif } @@ -71,7 +108,6 @@ os_thread_create( arg, 0, /* thread runs immediately */ thread_id); - ut_a(thread); if (srv_set_thread_priorities) { @@ -108,7 +144,7 @@ Returns handle to the current thread. */ os_thread_t os_thread_get_curr(void) -/*=======================*/ +/*====================*/ { #ifdef __WIN__ return(GetCurrentThread()); @@ -116,18 +152,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. */ |