summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <mronstrom@mysql.com>2005-07-18 13:31:02 +0200
committerunknown <mronstrom@mysql.com>2005-07-18 13:31:02 +0200
commitcd483c5520949ee9840628b68cd78b9a8c88e6b5 (patch)
tree49a4797f25aaf50e6e6c5ab9d193608d969a612e /include
parent22545f477752987c8f70c0bc4740d2e8b67a6578 (diff)
downloadmariadb-git-cd483c5520949ee9840628b68cd78b9a8c88e6b5.tar.gz
Patch for push of wl1354 Partitioning
Diffstat (limited to 'include')
-rw-r--r--include/my_base.h1
-rw-r--r--include/my_global.h88
-rw-r--r--include/mysql_com.h2
-rw-r--r--include/queues.h3
4 files changed, 94 insertions, 0 deletions
diff --git a/include/my_base.h b/include/my_base.h
index c76cf8c604e..0a2f5c2393e 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -388,6 +388,7 @@ enum data_file_type {
#define EQ_RANGE 32
#define NULL_RANGE 64
#define GEOM_FLAG 128
+#define SKIP_RANGE 256
typedef struct st_key_range
{
diff --git a/include/my_global.h b/include/my_global.h
index 61850931a8e..5a93e47a608 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -101,6 +101,94 @@
#define unlikely(x) __builtin_expect((x),0)
+/*
+ The macros below are useful in optimising places where it has been
+ discovered that cache misses stall the process and where a prefetch
+ of the cache line can improve matters. This is available in GCC 3.1.1
+ and later versions.
+ PREFETCH_READ says that addr is going to be used for reading and that
+ it is to be kept in caches if possible for a while
+ PREFETCH_WRITE also says that the item to be cached is likely to be
+ updated.
+ The *LOCALITY scripts are also available for experimentation purposes
+ mostly and should only be used if they are verified to improve matters.
+ For more input see GCC manual (available in GCC 3.1.1 and later)
+*/
+
+#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
+#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3)
+#define PREFETCH_WRITE(addr) \
+ __builtin_prefetch(addr, 1, 3)
+#define PREFETCH_READ_LOCALITY(addr, locality) \
+ __builtin_prefetch(addr, 0, locality)
+#define PREFETCH_WRITE_LOCALITY(addr, locality) \
+ __builtin_prefetch(addr, 1, locality)
+#else
+#define PREFETCH_READ(addr)
+#define PREFETCH_READ_LOCALITY(addr, locality)
+#define PREFETCH_WRITE(addr)
+#define PREFETCH_WRITE_LOCALITY(addr, locality)
+#endif
+
+/*
+ The following macro is used to ensure that code often used in most
+ SQL statements and definitely for parts of the SQL processing are
+ kept in a code segment by itself. This has the advantage that the
+ risk of common code being overlapping in caches of the CPU is less.
+ This can be a cause of big performance problems.
+ Routines should be put in this category with care and when they are
+ put there one should also strive to make as much of the error handling
+ as possible (or uncommon code of the routine) to execute in a
+ separate method to avoid moving to much code to this code segment.
+
+ It is very easy to use, simply add HOT_METHOD at the end of the
+ function declaration.
+ For more input see GCC manual (available in GCC 2.95 and later)
+*/
+
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
+#define HOT_METHOD \
+ __attribute__ ((section ("hot_code_section")))
+#else
+#define HOT_METHOD
+#endif
+
+/*
+ The following macro is used to ensure that popular global variables
+ are located next to each other to avoid that they contend for the
+ same cache lines.
+
+ It is very easy to use, simply add HOT_DATA at the end of the declaration
+ of the variable, the variable must be initialised because of the way
+ that linker works so a declaration using HOT_DATA should look like:
+ uint global_hot_data HOT_DATA = 0;
+ For more input see GCC manual (available in GCC 2.95 and later)
+*/
+
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
+#define HOT_DATA \
+ __attribute__ ((section ("hot_data_section")))
+#else
+#define HOT_DATA
+#endif
+
+
+/*
+ The following macros are used to control inlining a bit more than
+ usual. These macros are used to ensure that inlining always or
+ never occurs (independent of compilation mode).
+ For more input see GCC manual (available in GCC 3.1.1 and later)
+*/
+
+#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
+#define ALWAYS_INLINE __attribute__ ((always_inline))
+#define NEVER_INLINE __attribute__ ((noinline))
+#else
+#define ALWAYS_INLINE
+#define NEVER_INLINE
+#endif
+
+
/* Fix problem with S_ISLNK() on Linux */
#if defined(TARGET_OS_LINUX)
#undef _GNU_SOURCE
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 969fba4a433..8dcc50e15ec 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -88,6 +88,8 @@ enum enum_server_command
#define GROUP_FLAG 32768 /* Intern: Group field */
#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */
+#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
+#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
diff --git a/include/queues.h b/include/queues.h
index 02ab768198e..a8b676b763c 100644
--- a/include/queues.h
+++ b/include/queues.h
@@ -41,6 +41,9 @@ typedef struct st_queue {
#define queue_element(queue,index) ((queue)->root[index+1])
#define queue_end(queue) ((queue)->root[(queue)->elements])
#define queue_replaced(queue) _downheap(queue,1)
+#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
+#define queue_set_max_at_top(queue, set_arg) \
+ (queue)->max_at_top= set_arg ? (-1 ^ 1) : 0
typedef int (*queue_compare)(void *,byte *, byte *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,