PennMUSH Community

Changeset 1211

Show
Ignore:
Timestamp:
01/27/08 13:45:08 (10 months ago)
Author:
shawnw
Message:

Include basic intmap stats in @stats/tables

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/hdrs/intmap.h

    r1208 r1211  
    2121bool im_delete(intmap*, uint32_t); 
    2222void im_dump_graph(intmap*, const char *); 
    23  
     23void im_stats_header(dbref); 
     24void im_stats(dbref, intmap*, const char *); 
    2425#endif /* INTMAP_H */ 
  • 1.8.3/branches/devel/src/cque.c

    r1209 r1211  
    6969slab *bque_slab = NULL; /**< slab for 'struct bque' allocations */ 
    7070 
    71 static intmap *queue_map = NULL; /**< Intmap for looking up queue entries by pid */ 
     71intmap *queue_map = NULL; /**< Intmap for looking up queue entries by pid */ 
    7272static uint32_t top_pid = 0; 
     73#define MAX_PID (1U << 15) 
    7374 
    7475static BQUE *qfirst = NULL, *qlast = NULL, *qwait = NULL; 
     
    265266 
    266267  while (1) { 
    267     if (pid > (1U << 16)
     268    if (pid > MAX_PID
    268269      pid = 0; 
    269270    if (im_exists(queue_map, pid)) 
  • 1.8.3/branches/devel/src/game.c

    r1143 r1211  
    6161#include "htab.h" 
    6262#include "ptab.h" 
     63#include "intmap.h" 
    6364#include "log.h" 
    6465#include "lock.h" 
     
    23412342extern PTAB ptab_attrib; 
    23422343extern PTAB ptab_flag; 
     2344extern intmap *queue_map, *descs_by_fd; 
    23432345 
    23442346/** Reports stats on various in-memory data structures. 
     
    23692371  st_stats(player, &object_names, "ObjNames"); 
    23702372  st_stats(player, &lock_names, "LockNames"); 
     2373  notify(player, "Integer Maps:"); 
     2374  im_stats_header(player); 
     2375  im_stats(player, queue_map, "Queue IDs"); 
     2376  im_stats(player, descs_by_fd, "Connections"); 
     2377 
    23712378#if (COMPRESSION_TYPE >= 3) && defined(COMP_STATS) 
    23722379  if (Wizard(player)) { 
  • 1.8.3/branches/devel/src/intmap.c

    r1210 r1211  
    2222 * 
    2323 * There are various properties of patricia trees that aren't used at 
    24  * all in this (Like finding all keys that have a particular prefix). 
     24 * all in this (Like finding all keys that have a particular 
     25 * prefix). However, consider using them in a rewrite of the prefix 
     26 * table code... 
    2527 * 
    2628 * Normally patricia trees use the leftmost bit as position 0. I've 
     
    458460  fclose(fp); 
    459461} 
     462 
     463/** Header line for @stats/tables for intmaps */ 
     464void 
     465im_stats_header(dbref player) 
     466{ 
     467  notify(player, "Map         Entries ~Memory"); 
     468} 
     469 
     470/** @stats/tables line */ 
     471void 
     472im_stats(dbref player, intmap *im, const char *name) 
     473{ 
     474  notify_format(player, "%-11s %7d %7u", name, im->count, 
     475                (unsigned int)(sizeof(*im) + (sizeof(patricia) * im->count))); 
     476}