提交 87da7c79 编写于 作者: F Far

fix: PathCacheMemoryDump miscalculate the RAM usage of PathCache

PathCacheMemoryDump miscalculate the RAM usage of PathCache for not
counting the name field of PathCache, which is allocated with PathCache

Close #I3OBXY
上级 28df6989
......@@ -64,16 +64,18 @@ void PathCacheDump(void)
void PathCacheMemoryDump(void)
{
int pathCacheNum = 0;
int nameSum = 0;
for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) {
LIST_HEAD *dhead = &g_pathCacheHashEntrys[i];
struct PathCache *dent = NULL;
LOS_DL_LIST_FOR_EACH_ENTRY(dent, dhead, struct PathCache, hashEntry) {
pathCacheNum++;
nameSum += dent->nameLen;
}
}
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册