diff options
author | Andrey Hristov <andrey@php.net> | 2010-01-11 14:27:35 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2010-01-11 14:27:35 +0000 |
commit | 9b8d026d86341829e1f18cfdc581ab1ab8655ce2 (patch) | |
tree | ebb412ad71df143de86786a9d247d8a481907536 /ext/mysqlnd/mysqlnd_statistics.c | |
parent | 4a549fbb3d0a1f88e3f2775b952de1130259454c (diff) | |
download | php-git-9b8d026d86341829e1f18cfdc581ab1ab8655ce2.tar.gz |
Rework the statistics macros to be reusable by external entities.
Rename handlers to triggers. Dynamically allocate space for the
statistics thus allow reusability.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_statistics.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_statistics.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c index 50eba8cfcd..756d4ce228 100644 --- a/ext/mysqlnd/mysqlnd_statistics.c +++ b/ext/mysqlnd/mysqlnd_statistics.c @@ -237,11 +237,13 @@ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LIN /* {{{ mysqlnd_stats_init */ PHPAPI void -mysqlnd_stats_init(MYSQLND_STATS ** stats) +mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count) { *stats = calloc(1, sizeof(MYSQLND_STATS)); - (*stats)->triggers = calloc(STAT_LAST, sizeof(mysqlnd_stat_trigger)); + (*stats)->values = calloc(statistic_count, sizeof(uint64_t)); + (*stats)->triggers = calloc(statistic_count, sizeof(mysqlnd_stat_trigger)); (*stats)->in_trigger = FALSE; + (*stats)->count = statistic_count; #ifdef ZTS (*stats)->LOCK_access = tsrm_mutex_alloc(); #endif @@ -258,6 +260,7 @@ mysqlnd_stats_end(MYSQLND_STATS * stats) tsrm_mutex_free(stats->LOCK_access); #endif free(stats->triggers); + free(stats->values); /* mnd_free will reference LOCK_access and crash...*/ free(stats); } |