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
This commit is contained in:
Far 2021-04-28 14:31:31 +08:00
parent 28df6989f9
commit 87da7c794c
1 changed files with 3 additions and 1 deletions

View File

@ -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)