VirtualBox

Changeset 2931 in kBuild


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.

Location:
trunk/src/kmk
Files:
3 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
  • trunk/src/kmk/dir.c

    r2850 r2931  
    13401340
    13411341
     1342#ifdef CONFIG_WITH_PRINT_STATS_SWITCH
     1343/* Print stats */
     1344
     1345void print_dir_stats (void)
     1346{
     1347  /** @todo normal dir stats.  */
     1348}
     1349#endif
     1350
     1351
    13421352/* Hooks for globbing.  */
    13431353
  • trunk/src/kmk/main.c

    r2916 r2931  
    9090#ifdef CONFIG_WITH_PRINT_STATS_SWITCH
    9191void print_variable_stats (void);
     92void print_dir_stats (void);
    9293void print_file_stats (void);
    9394#endif
     
    38703871  print_variable_stats ();
    38713872  print_file_stats ();
     3873  print_dir_stats ();
    38723874# ifdef KMK
    38733875  print_kbuild_define_stats ();
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