remove useless logInfo

pull/37/head
YuQing 2020-09-21 22:27:16 +08:00
parent 556b7337c4
commit dc43f8254a
5 changed files with 21 additions and 10 deletions

View File

@ -25,7 +25,8 @@ static struct fast_allocator_info malloc_allocator;
(allocator)->pooled = _pooled; \ (allocator)->pooled = _pooled; \
acontext->allocator_array.allocators[ \ acontext->allocator_array.allocators[ \
acontext->allocator_array.count++] = allocator; \ acontext->allocator_array.count++] = allocator; \
/* logInfo("count: %d, magic_number: %d", acontext->allocator_array.count, (allocator)->magic_number); */\ /* logInfo("count: %d, magic_number: %d", acontext->allocator_array.count, \
(allocator)->magic_number); */ \
} while (0) } while (0)
@ -388,8 +389,10 @@ int fast_allocator_retry_reclaim(struct fast_allocator_context *acontext,
acontext->allocator_array.last_reclaim_time = get_current_time(); acontext->allocator_array.last_reclaim_time = get_current_time();
malloc_bytes = acontext->allocator_array.malloc_bytes; malloc_bytes = acontext->allocator_array.malloc_bytes;
logInfo("malloc_bytes: %"PRId64", ratio: %f", malloc_bytes, (double)acontext->alloc_bytes / /*
(double)malloc_bytes); logInfo("malloc_bytes: %"PRId64", ratio: %f", malloc_bytes,
(double)acontext->alloc_bytes / (double)malloc_bytes);
*/
if (malloc_bytes == 0 || (double)acontext->alloc_bytes / if (malloc_bytes == 0 || (double)acontext->alloc_bytes /
(double)malloc_bytes >= acontext->allocator_array.expect_usage_ratio) (double)malloc_bytes >= acontext->allocator_array.expect_usage_ratio)
@ -402,7 +405,7 @@ int fast_allocator_retry_reclaim(struct fast_allocator_context *acontext,
if (fast_mblock_reclaim(&acontext->allocator_array. if (fast_mblock_reclaim(&acontext->allocator_array.
allocators[i]->mblock, 0, &reclaim_count, NULL) == 0) allocators[i]->mblock, 0, &reclaim_count, NULL) == 0)
{ {
logInfo("reclaim_count: %d", reclaim_count); //logInfo("reclaim_count: %d", reclaim_count);
*total_reclaim_bytes += reclaim_count * *total_reclaim_bytes += reclaim_count *
acontext->allocator_array.allocators[i]-> acontext->allocator_array.allocators[i]->
mblock.info.trunk_size; mblock.info.trunk_size;
@ -440,7 +443,7 @@ void *fast_allocator_alloc(struct fast_allocator_context *acontext,
{ {
return NULL; return NULL;
} }
logInfo("reclaimed bytes: %"PRId64, total_reclaim_bytes); //logInfo("reclaimed bytes: %"PRId64, total_reclaim_bytes);
if (total_reclaim_bytes < allocator_info->mblock.info.trunk_size) if (total_reclaim_bytes < allocator_info->mblock.info.trunk_size)
{ {
return NULL; return NULL;

View File

@ -116,8 +116,9 @@ static void delete_from_mblock_list(struct fast_mblock_man *mblock)
pStat->trunk_total_count += current->info.trunk_total_count; \ pStat->trunk_total_count += current->info.trunk_total_count; \
pStat->trunk_used_count += current->info.trunk_used_count; \ pStat->trunk_used_count += current->info.trunk_used_count; \
pStat->instance_count += current->info.instance_count; \ pStat->instance_count += current->info.instance_count; \
/* logInfo("name: %s, element_size: %d, total_count: %d, used_count: %d", */ \ /* logInfo("name: %s, element_size: %d, total_count: %d, " \
/* pStat->name, pStat->element_size, pStat->element_total_count, pStat->element_used_count); */\ "used_count: %d", pStat->name, pStat->element_size, \
pStat->element_total_count, pStat->element_used_count); */ \
} while (0) } while (0)
int fast_mblock_manager_stat(struct fast_mblock_info *stats, int fast_mblock_manager_stat(struct fast_mblock_info *stats,

View File

@ -29,11 +29,16 @@ extern "C" {
#define LOG_COMPRESS_FLAGS_ENABLED 1 #define LOG_COMPRESS_FLAGS_ENABLED 1
#define LOG_COMPRESS_FLAGS_NEW_THREAD 2 #define LOG_COMPRESS_FLAGS_NEW_THREAD 2
#define LOG_NOTHING (LOG_DEBUG + 10)
struct log_context; struct log_context;
//log header line callback //log header line callback
typedef void (*LogHeaderCallback)(struct log_context *pContext); typedef void (*LogHeaderCallback)(struct log_context *pContext);
#define FC_LOG_BY_LEVEL(level) \
(level <= g_log_context.log_level)
typedef struct log_context typedef struct log_context
{ {
/* log level value please see: sys/syslog.h /* log level value please see: sys/syslog.h

View File

@ -60,8 +60,10 @@ static inline void shared_buffer_hold(SharedBuffer *buffer)
static inline void shared_buffer_release(SharedBuffer *buffer) static inline void shared_buffer_release(SharedBuffer *buffer)
{ {
if (__sync_sub_and_fetch(&buffer->reffer_count, 1) == 0) { if (__sync_sub_and_fetch(&buffer->reffer_count, 1) == 0) {
logInfo("file: "__FILE__", line: %d, " /*
logDebug("file: "__FILE__", line: %d, "
"free shared buffer: %p", __LINE__, buffer); "free shared buffer: %p", __LINE__, buffer);
*/
fast_mblock_free_object(&buffer->ctx->allocator, buffer); fast_mblock_free_object(&buffer->ctx->allocator, buffer);
} }
} }

View File

@ -31,7 +31,7 @@ static void *thread_entrance(void *arg)
PTHREAD_MUTEX_LOCK(&pool->lock); PTHREAD_MUTEX_LOCK(&pool->lock);
pool->thread_counts.running++; pool->thread_counts.running++;
logInfo("thread pool: %s, index: %d start, running count: %d", logDebug("thread pool: %s, index: %d start, running count: %d",
pool->name, thread->index, pool->thread_counts.running); pool->name, thread->index, pool->thread_counts.running);
PTHREAD_MUTEX_UNLOCK(&pool->lock); PTHREAD_MUTEX_UNLOCK(&pool->lock);
@ -100,7 +100,7 @@ static void *thread_entrance(void *arg)
} }
PTHREAD_MUTEX_LOCK(&pool->lock); PTHREAD_MUTEX_LOCK(&pool->lock);
logInfo("thread pool: %s, index: %d exit, running count: %d", logDebug("thread pool: %s, index: %d exit, running count: %d",
pool->name, thread->index, pool->thread_counts.running); pool->name, thread->index, pool->thread_counts.running);
PTHREAD_MUTEX_UNLOCK(&pool->lock); PTHREAD_MUTEX_UNLOCK(&pool->lock);