summaryrefslogtreecommitdiff
path: root/ext/mysqlnd
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-04-22 13:03:44 +0000
committerAndrey Hristov <andrey@php.net>2010-04-22 13:03:44 +0000
commit2556733787ea41701c0cbb19237f24e17f57b48b (patch)
tree1bf8486e63724bd1ed3ec6478c11b44b462c71a6 /ext/mysqlnd
parenta1f753c8e35d76bde07c75c886e85bb8102ff0d4 (diff)
downloadphp-git-2556733787ea41701c0cbb19237f24e17f57b48b.tar.gz
Add the posibility to switch off the compilation of statistics
collection, for those who want to optimize the last percent of their binaries.
Diffstat (limited to 'ext/mysqlnd')
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.h41
1 files changed, 31 insertions, 10 deletions
diff --git a/ext/mysqlnd/mysqlnd_statistics.h b/ext/mysqlnd/mysqlnd_statistics.h
index 6b7695c404..c54976b9ae 100644
--- a/ext/mysqlnd/mysqlnd_statistics.h
+++ b/ext/mysqlnd/mysqlnd_statistics.h
@@ -42,21 +42,28 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
#define MYSQLND_STATS_UNLOCK(stats)
#endif
+#ifndef MYSQLND_CORE_STATISTICS_TRIGGERS_DISABLED
+#define MYSQLND_STAT_CALL_TRIGGER(s_array, statistic, val) \
+ if ((s_array)->triggers[(statistic)] && (s_array)->in_trigger == FALSE) { \
+ (s_array)->in_trigger = TRUE; \
+ MYSQLND_STATS_UNLOCK((s_array)); \
+ \
+ (s_array)->triggers[(statistic)]((s_array), (statistic), (val) TSRMLS_CC); \
+ \
+ MYSQLND_STATS_LOCK((s_array)); \
+ (s_array)->in_trigger = FALSE; \
+ }
+#else
+#define MYSQLND_STAT_CALL_TRIGGER(s_array, statistic, val)
+#endif /* MYSQLND_CORE_STATISTICS_TRIGGERS_DISABLED */
+
#define MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(stats, statistic, value) \
{ \
MYSQLND_STATS_LOCK(stats); \
(stats)->values[(statistic)] += (value); \
- if ((stats)->triggers[(statistic)] && (stats)->in_trigger == FALSE) { \
- (stats)->in_trigger = TRUE; \
- MYSQLND_STATS_UNLOCK(stats); \
- \
- (stats)->triggers[(statistic)]((stats), (statistic), (value) TSRMLS_CC); \
- \
- MYSQLND_STATS_LOCK(stats); \
- (stats)->in_trigger = FALSE; \
- } \
+ MYSQLND_STAT_CALL_TRIGGER((stats), (statistic), (value)); \
MYSQLND_STATS_UNLOCK(_p_s); \
- } \
+ }
#define MYSQLND_DEC_STATISTIC(enabler, stats, statistic) \
{ \
@@ -116,6 +123,9 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
}
+
+#ifndef MYSQLND_CORE_STATISTICS_DISABLED
+
#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic))
@@ -141,6 +151,17 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2), (statistic3), (value3)); \
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), (conn_stats), (statistic1), (value1), (statistic2), (value2), (statistic3), (value3));
+#else
+
+#define MYSQLND_INC_GLOBAL_STATISTIC(statistic)
+#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic)
+#define MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(statistic1, value1, statistic2, value2)
+#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic)
+#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value)
+#define MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn_stats, statistic1, value1, statistic2, value2)
+#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3)
+
+#endif /* MYSQLND_CORE_STATISTICS_DISABLED */
PHPAPI void mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING * names, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC);