summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_statistics.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-01-11 12:37:42 +0000
committerAndrey Hristov <andrey@php.net>2010-01-11 12:37:42 +0000
commit4a549fbb3d0a1f88e3f2775b952de1130259454c (patch)
treed35aada364e6a7b3509f6f334433a2e9940c7947 /ext/mysqlnd/mysqlnd_statistics.c
parentd2f681cecd43dd40c369b5e29568b87252134e6f (diff)
downloadphp-git-4a549fbb3d0a1f88e3f2775b952de1130259454c.tar.gz
missed to commit to the branch
Diffstat (limited to 'ext/mysqlnd/mysqlnd_statistics.c')
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c
index 0d6d4b9d25..50eba8cfcd 100644
--- a/ext/mysqlnd/mysqlnd_statistics.c
+++ b/ext/mysqlnd/mysqlnd_statistics.c
@@ -240,7 +240,8 @@ PHPAPI void
mysqlnd_stats_init(MYSQLND_STATS ** stats)
{
*stats = calloc(1, sizeof(MYSQLND_STATS));
- (*stats)->handlers = calloc(STAT_LAST, sizeof(mysqlnd_stat_handler));
+ (*stats)->triggers = calloc(STAT_LAST, sizeof(mysqlnd_stat_trigger));
+ (*stats)->in_trigger = FALSE;
#ifdef ZTS
(*stats)->LOCK_access = tsrm_mutex_alloc();
#endif
@@ -256,13 +257,46 @@ mysqlnd_stats_end(MYSQLND_STATS * stats)
#ifdef ZTS
tsrm_mutex_free(stats->LOCK_access);
#endif
- free(stats->handlers);
+ free(stats->triggers);
/* mnd_free will reference LOCK_access and crash...*/
free(stats);
}
/* }}} */
+/* {{{ mysqlnd_stats_set_trigger */
+PHPAPI mysqlnd_stat_trigger
+mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger TSRMLS_DC)
+{
+ mysqlnd_stat_trigger ret = NULL;
+ DBG_ENTER("mysqlnd_stats_set_trigger");
+ if (stats) {
+ MYSQLND_STATS_LOCK(stats);
+ ret = stats->triggers[stat];
+ stats->triggers[stat] = trigger;
+ MYSQLND_STATS_UNLOCK(stats);
+ }
+ DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_stats_set_handler */
+PHPAPI mysqlnd_stat_trigger
+mysqlnd_stats_reset_triggers(MYSQLND_STATS * const stats TSRMLS_DC)
+{
+ mysqlnd_stat_trigger ret = NULL;
+ DBG_ENTER("mysqlnd_stats_reset_trigger");
+ if (stats) {
+ MYSQLND_STATS_LOCK(stats);
+ memset(stats->triggers, 0, STAT_LAST * sizeof(mysqlnd_stat_trigger));
+ MYSQLND_STATS_UNLOCK(stats);
+ }
+ DBG_RETURN(ret);
+}
+/* }}} */
+
+
/*
* Local variables:
* tab-width: 4