~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/ut0ut.h

  • Committer: Patrick Crews
  • Date: 2010-09-14 20:21:03 UTC
  • mto: (1771.1.1 pcrews)
  • mto: This revision was merged to the branch mainline in revision 1772.
  • Revision ID: gleebix@gmail.com-20100914202103-1db2n0bshzafep19
Moved transaction_log tests into updated non-publisher-based tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
4
 
Copyright (C) 2009 Sun Microsystems, Inc.
 
3
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
 
4
Copyright (c) 2009, Sun Microsystems, Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
7
7
Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
18
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
19
 
20
20
You should have received a copy of the GNU General Public License along with
21
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
22
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
21
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
22
Place, Suite 330, Boston, MA 02111-1307 USA
23
23
 
24
24
*****************************************************************************/
25
25
 
34
34
#define ut0ut_h
35
35
 
36
36
#include "univ.i"
37
 
 
38
 
#include "db0err.h"
39
 
 
40
 
#ifndef UNIV_HOTBACKUP
41
 
# include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
42
 
#endif /* UNIV_HOTBACKUP */
43
 
 
44
37
#include <time.h>
45
38
#ifndef MYSQL_SERVER
46
39
#include <ctype.h>
54
47
/** Time stamp */
55
48
typedef time_t  ib_time_t;
56
49
 
57
 
#ifndef UNIV_HOTBACKUP
58
 
#if defined(HAVE_IB_PAUSE_INSTRUCTION)
 
50
#if defined(IB_HAVE_PAUSE_INSTRUCTION)
59
51
#  ifdef WIN32
60
52
     /* In the Win32 API, the x86 PAUSE instruction is executed by calling
61
53
     the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
71
63
#elif defined(HAVE_ATOMIC_BUILTINS)
72
64
#  define UT_RELAX_CPU() do { \
73
65
     volatile lint      volatile_var; \
74
 
     if (os_compare_and_swap_lint(&volatile_var, 0, 1)) ((void)0); \
 
66
     os_compare_and_swap_lint(&volatile_var, 0, 1); \
75
67
   } while (0)
76
68
#else
77
69
#  define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
92
84
                os_thread_sleep(2000 /* 2 ms */);               \
93
85
        }                                                       \
94
86
} while (0)
95
 
#endif /* !UNIV_HOTBACKUP */
96
87
 
97
88
/********************************************************//**
98
89
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
225
216
ib_time_t
226
217
ut_time(void);
227
218
/*=========*/
228
 
#ifndef UNIV_HOTBACKUP
229
219
/**********************************************************//**
230
220
Returns system time.
231
221
Upon successful completion, the value 0 is returned; otherwise the
249
239
ut_time_us(
250
240
/*=======*/
251
241
        ullint* tloc);  /*!< out: us since epoch, if non-NULL */
252
 
/**********************************************************//**
253
 
Returns the number of milliseconds since some epoch.  The
254
 
value may wrap around.  It should only be used for heuristic
255
 
purposes.
256
 
@return ms since epoch */
257
 
UNIV_INTERN
258
 
ulint
259
 
ut_time_ms(void);
260
 
/*============*/
261
 
#endif /* !UNIV_HOTBACKUP */
262
242
 
263
243
/**********************************************************//**
264
244
Returns the difference of two times in seconds.
397
377
# define ut_snprintf    snprintf
398
378
#endif /* __WIN__ */
399
379
 
400
 
/*************************************************************//**
401
 
Convert an error number to a human readable text message. The
402
 
returned string is static and should not be freed or modified.
403
 
@return string, describing the error */
404
 
UNIV_INTERN
405
 
const char*
406
 
ut_strerr(
407
 
/*======*/
408
 
        enum db_err     num);   /*!< in: error number */
409
 
 
410
380
#ifndef UNIV_NONINL
411
381
#include "ut0ut.ic"
412
382
#endif