Changeset 1925 for trunk/src/kmk/misc.c


Ignore:
Timestamp:
Oct 24, 2008, 5:32:21 AM (17 years ago)
Author:
bird
Message:

kmk: some stats adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/misc.c

    r1918 r1925  
    12241224  cache->free_head   = NULL;
    12251225  cache->size        = act_size;
     1226  cache->total_count = 0;
    12261227  cache->alloc_count = 0;
    1227   cache->total_count = 0;
     1228  cache->free_count = 0;
    12281229  cache->name        = name;
    12291230  cache->grow_arg    = grow_arg;
     
    12571258  if (eat->free_head)
    12581259    {
     1260     unsigned int eat_in_use = eat->alloc_count - eat->free_count;
     1261     unsigned int dst_in_use = cache->alloc_count - cache->free_count;
    12591262     if (!cache->free_head)
    12601263       cache->free_head = eat->free_head;
    1261      else if (eat->total_count - eat->alloc_count < cache->total_count - cache->alloc_count)
     1264     else if (eat->total_count - eat_in_use < cache->total_count - dst_ins_use)
    12621265       {
    12631266         struct alloccache_free_ent *last = eat->free_head;
     
    12871290  /* and statistics */
    12881291  cache->alloc_count += eat->alloc_count;
    1289   cache->total_count += eat->total_count;
     1292  cache->free_count  += eat->free_count;
    12901293#else
    12911294  /* and statistics */
    12921295  cache->alloc_count += eat->alloc_count;
    1293   cache->total_count += eat->alloc_count;
    1294 #endif
     1296  cache->free_count  += eat->free_count;
     1297#endif
     1298  cache->total_count += eat->total_count;
    12951299
    12961300  /* unlink and disable the eat cache */
     
    13161320{
    13171321  printf (_("\n# Alloc Cache: %s\n"
    1318               "#  Items: size = %-3u  in-use = %-6d  total = %-6u\n"),
    1319           cache->name, cache->size, (int)cache->alloc_count, cache->total_count);
     1322              "#  Items: size = %-3u  total = %-6u"),
     1323          cache->name, cache->size, cache->total_count);
     1324  MAKE_STATS(printf (_("  in-use = %-6lu"),
     1325                     cache->alloc_count - cache->free_count););
     1326  MAKE_STATS(printf (_("\n#         alloc calls = %-7lu  free calls = %-7lu"),
     1327                     cache->alloc_count, cache->free_count););
     1328  printf ("\n");
    13201329}
    13211330
Note: See TracChangeset for help on using the changeset viewer.