!194 PathCacheMemoryDump内存占用统计错误

Merge pull request !194 from Far/master
This commit is contained in:
openharmony_ci 2021-04-29 09:58:45 +08:00 committed by Gitee
commit 6467ebb2dd
1 changed files with 3 additions and 1 deletions

View File

@ -64,16 +64,18 @@ void PathCacheDump(void)
void PathCacheMemoryDump(void) void PathCacheMemoryDump(void)
{ {
int pathCacheNum = 0; int pathCacheNum = 0;
int nameSum = 0;
for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) { for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) {
LIST_HEAD *dhead = &g_pathCacheHashEntrys[i]; LIST_HEAD *dhead = &g_pathCacheHashEntrys[i];
struct PathCache *dent = NULL; struct PathCache *dent = NULL;
LOS_DL_LIST_FOR_EACH_ENTRY(dent, dhead, struct PathCache, hashEntry) { LOS_DL_LIST_FOR_EACH_ENTRY(dent, dhead, struct PathCache, hashEntry) {
pathCacheNum++; pathCacheNum++;
nameSum += dent->nameLen;
} }
} }
PRINTK("pathCache number = %d\n", pathCacheNum); PRINTK("pathCache number = %d\n", pathCacheNum);
PRINTK("pathCache memory size = %d(B)\n", pathCacheNum * sizeof(struct PathCache)); PRINTK("pathCache memory size = %d(B)\n", pathCacheNum * sizeof(struct PathCache) + nameSum);
} }
static uint32_t NameHash(const char *name, int len, struct Vnode *dvp) static uint32_t NameHash(const char *name, int len, struct Vnode *dvp)