VirtualBox

Changeset 2931 in kBuild for trunk/src/kmk/dir-nt-bird.c


Ignore:
Timestamp:
Sep 18, 2016 3:57:48 PM (9 years ago)
Author:
bird
Message:

kmk: Added print_dir_stats and implemented it for the NT directory cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/dir-nt-bird.c

    r2912 r2931  
    413413
    414414
     415/**
     416 * Print statitstics.
     417 */
     418void print_dir_stats(void)
     419{
     420    FILE *pOut = stdout;
     421    KU32 cMisses;
     422
     423    fputs("\n"
     424          "# NT dir cache stats:\n", pOut);
     425    fprintf(pOut, "#  %u objects, taking up %u (%#x) bytes, avg %u bytes\n",
     426            g_pFsCache->cObjects, g_pFsCache->cbObjects, g_pFsCache->cbObjects, g_pFsCache->cbObjects / g_pFsCache->cObjects);
     427    fprintf(pOut, "#  %u A path hashes, taking up %u (%#x) bytes, avg %u bytes, %u collision\n",
     428            g_pFsCache->cAnsiPaths, g_pFsCache->cbAnsiPaths, g_pFsCache->cbAnsiPaths,
     429            g_pFsCache->cbAnsiPaths / K_MAX(g_pFsCache->cAnsiPaths, 1), g_pFsCache->cAnsiPathCollisions);
     430#ifdef KFSCACHE_CFG_UTF16
     431    fprintf(pOut, "#  %u W path hashes, taking up %u (%#x) bytes, avg %u bytes, %u collisions\n",
     432            g_pFsCache->cUtf16Paths, g_pFsCache->cbUtf16Paths, g_pFsCache->cbUtf16Paths,
     433            g_pFsCache->cbUtf16Paths / K_MAX(g_pFsCache->cUtf16Paths, 1), g_pFsCache->cUtf16PathCollisions);
     434#endif
     435    fprintf(pOut, "#  %u child hash tables, total of %u entries, %u children inserted, %u collisions\n",
     436            g_pFsCache->cChildHashTabs, g_pFsCache->cChildHashEntriesTotal,
     437            g_pFsCache->cChildHashed, g_pFsCache->cChildHashCollisions);
     438
     439    cMisses = g_pFsCache->cLookups - g_pFsCache->cPathHashHits - g_pFsCache->cWalkHits;
     440    fprintf(pOut, "#  %u lookups: %u (%" KU64_PRI " %%) path hash hits, %u (%" KU64_PRI "%%) walks hits, %u (%" KU64_PRI "%%) misses\n",
     441            g_pFsCache->cLookups,
     442            g_pFsCache->cPathHashHits, g_pFsCache->cPathHashHits * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1),
     443            g_pFsCache->cWalkHits, g_pFsCache->cWalkHits * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1),
     444            cMisses, cMisses * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1));
     445    fprintf(pOut, "#  %u child searches, %u (%" KU64_PRI "%%) hash hits\n",
     446            g_pFsCache->cChildSearches,
     447            g_pFsCache->cChildHashHits, g_pFsCache->cChildHashHits * (KU64)100 / K_MAX(g_pFsCache->cChildSearches, 1));
     448}
     449
     450
    415451void print_dir_data_base(void)
    416452{
    417453    /** @todo. */
     454
    418455}
    419456
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette