From: SooChan Lim Date: Sat, 2 Jul 2016 12:55:52 +0000 (+0900) Subject: add bo_cnt for debug X-Git-Tag: accepted/tizen/common/20160703.131041^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b592d0eacd419de89ca309c217de7af17e60473;p=platform%2Fcore%2Fuifw%2Flibtbm.git add bo_cnt for debug print the bo informations in the process when the bo number is over 500. Change-Id: I1fb91ca9d17467c15d2610b5ac402ce3c159ded7 --- diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index 725c395..494c07a 100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -78,6 +78,19 @@ _tbm_set_last_result(tbm_error_e err) } /* LCOV_EXCL_START */ +static int last_chk_bo_cnt = 0; +static void +_tbm_util_check_bo_cnt(tbm_bufmgr bufmgr) +{ + if (bufmgr->bo_cnt >= 500 && ((bufmgr->bo_cnt % 20) == 0)) { + if (bufmgr->bo_cnt > last_chk_bo_cnt) { + TBM_DEBUG("============TBM BO CNT DEBUG: bo_cnt=%d\n", bufmgr->bo_cnt); + tbm_bufmgr_debug_show(bufmgr); + last_chk_bo_cnt = bufmgr->bo_cnt; + } + } +} + static void _tbm_util_get_appname_brief(char *brief) { @@ -343,6 +356,8 @@ _tbm_bo_unref(tbm_bo bo) LIST_DEL(&bo->item_link); free(bo); bo = NULL; + + bufmgr->bo_cnt--; } } @@ -722,6 +737,9 @@ tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags) return NULL; } + _tbm_util_check_bo_cnt(bufmgr); + bufmgr->bo_cnt++; + bo->bufmgr = bufmgr; pthread_mutex_lock(&bufmgr->lock); @@ -757,6 +775,8 @@ tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key) tbm_bo tmp = NULL; void *bo_priv = NULL; + _tbm_util_check_bo_cnt(bufmgr); + pthread_mutex_lock(&bufmgr->lock); bo = calloc(1, sizeof(struct _tbm_bo)); @@ -765,6 +785,8 @@ tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key) return NULL; } + bufmgr->bo_cnt++; + bo->bufmgr = bufmgr; bo_priv = bufmgr->backend->bo_import(bo, key); @@ -816,6 +838,8 @@ tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd) tbm_bo tmp = NULL; void *bo_priv = NULL; + _tbm_util_check_bo_cnt(bufmgr); + pthread_mutex_lock(&bufmgr->lock); bo = calloc(1, sizeof(struct _tbm_bo)); @@ -824,6 +848,8 @@ tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd) return NULL; } + bufmgr->bo_cnt++; + bo->bufmgr = bufmgr; bo_priv = bufmgr->backend->bo_import_fd(bo, fd); diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index d74f2f4..3a54cb0 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -209,6 +209,8 @@ struct _tbm_bufmgr { int lock_type; /* lock_type of bufmgr */ + unsigned int bo_cnt; /* number of bos */ + struct list_head bo_list; /* list of bos belonging to bufmgr */ struct list_head surf_list; /* list of surfaces belonging to bufmgr */