More accurate memory metrics

pull/1130/head
René Cannaò 9 years ago
parent b1b9ad6598
commit 708f14a6e6

@ -157,6 +157,9 @@ unsigned int MySQL_Authentication::memory_usage() {
if (ado->sha1_pass) ret += SHA_DIGEST_LENGTH;
if (ado->default_schema) ret += strlen(ado->default_schema) + 1;
}
ret += sizeof(creds_group_t);
ret += sizeof(PtrArray);
ret += (creds_frontends.cred_array->size * sizeof(void *));
for (i=0; i<creds_backends.cred_array->len; i++) {
account_details_t *ado=(account_details_t *)creds_backends.cred_array->index(i);
ret += sizeof(account_details_t);
@ -165,6 +168,9 @@ unsigned int MySQL_Authentication::memory_usage() {
if (ado->sha1_pass) ret += SHA_DIGEST_LENGTH;
if (ado->default_schema) ret += strlen(ado->default_schema) + 1;
}
ret += sizeof(creds_group_t);
ret += sizeof(PtrArray);
ret += (creds_backends.cred_array->size * sizeof(void *));
#ifdef PROXYSQL_AUTH_PTHREAD_MUTEX
pthread_rwlock_unlock(&creds_frontends.lock);
pthread_rwlock_unlock(&creds_backends.lock);

@ -684,6 +684,12 @@ unsigned long Query_Processor::get_query_digests_total_size() {
if (qds->digest_text)
ret += strlen(qds->digest_text) + 1;
}
#if !defined(__FreeBSD__) && !defined(__APPLE__)
ret += ((sizeof(uint64_t) + sizeof(void *) + sizeof(std::_Rb_tree_node_base)) * digest_umap.size() );
#else
ret += ((sizeof(uint64_t) + sizeof(void *) + 32) * digest_umap.size() );
#endif
#ifdef PROXYSQL_QPRO_PTHREAD_MUTEX
pthread_rwlock_unlock(&digest_rwlock);
#else

Loading…
Cancel
Save