add bo_cnt for debug 69/77969/1 accepted/tizen/common/20160703.131041 accepted/tizen/ivi/20160703.110729 accepted/tizen/mobile/20160703.110712 accepted/tizen/tv/20160703.110721 accepted/tizen/wearable/20160703.110725 submit/tizen/20160702.130303
authorSooChan Lim <sc1.lim@samsung.com>
Sat, 2 Jul 2016 12:55:52 +0000 (21:55 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Sat, 2 Jul 2016 12:55:52 +0000 (21:55 +0900)
print the bo informations in the process
when the bo number is over 500.

Change-Id: I1fb91ca9d17467c15d2610b5ac402ce3c159ded7

src/tbm_bufmgr.c
src/tbm_bufmgr_int.h

index 725c395..494c07a 100644 (file)
@@ -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);
index d74f2f4..3a54cb0 100644 (file)
@@ -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 */