Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: aa008fa95ed329ecd01e6425587bf0f048ba32b0
Ticket: 219068ffffffffffffffffffffffffffffffffff
Expose Tcl_HashStats at the Tcl level
User & Date: nobody on 2000-10-26 01:10:10
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4557 RFE
    Version: 8.3
    SubmitDate: '2000-03-24'
    LastModified: '2000-05-08'
    Severity: MED
    Status: Released
    Submitter: ericm
    ChangedBy: ericm
    OS: All
    FixedDate: '2000-05-08'
    FixedInVersion: 8.4a1
    ClosedDate: '2000-10-25'
    
    
    Sometimes when I'm trying to do performance tuning on my code it's helpful to see how the hash tables I'm using are populated.  Plus, this is kind of a neat, gee-whiz function.  So, it'd be nice if Tcl_HashStats was accessible from Tcl, via "array statistics":
    
    
    *** tclVar.c    2000/01/21 03:29:14     1.16
    
    --- tclVar.c    2000/03/28 21:44:21
    
    ***************
    
    *** 2861,2870 ****
    
    
          enum {ARRAY_ANYMORE, ARRAY_DONESEARCH,  ARRAY_EXISTS, ARRAY_GET,
    
              ARRAY_NAMES, ARRAY_NEXTELEMENT, ARRAY_SET, ARRAY_SIZE,
    
    !         ARRAY_STARTSEARCH, ARRAY_UNSET}; 
    
          static char *arrayOptions[] = {
    
            "anymore", "donesearch", "exists", "get", "names", "nextelement",
    
    !       "set", "size", "startsearch", "unset", (char *) NULL
    
          };
    
    
          Interp *iPtr = (Interp *) interp;
    
    --- 2861,2870 ----
    
    
          enum {ARRAY_ANYMORE, ARRAY_DONESEARCH,  ARRAY_EXISTS, ARRAY_GET,
    
              ARRAY_NAMES, ARRAY_NEXTELEMENT, ARRAY_SET, ARRAY_SIZE,
    
    !         ARRAY_STARTSEARCH, ARRAY_STATISTICS, ARRAY_UNSET}; 
    
          static char *arrayOptions[] = {
    
            "anymore", "donesearch", "exists", "get", "names", "nextelement",
    
    !       "set", "size", "startsearch", "statistics", "unset", (char *) NULL
    
          };
    
    
          Interp *iPtr = (Interp *) interp;
    
    ***************
    
    *** 3178,3183 ****
    
    --- 3178,3198 ----
    
                varPtr->searchPtr = searchPtr;
    
                break;
    
            }
    
    + 
    
    +       case ARRAY_STATISTICS: {
    
    +           char *stats;
    
    +           stats = Tcl_HashStats(varPtr->value.tablePtr);
    
    +           if (stats != NULL) {
    
    +               Tcl_SetResult(interp, stats, TCL_VOLATILE);
    
    +               ckfree((void *)stats);
    
    +           } else {
    
    +               Tcl_SetResult(interp, "error reading array statistics",
    
    +                       TCL_STATIC);
    
    +               return TCL_ERROR;
    
    +           }
    
    +           break;
    
    +         }
    
    + 
    
            case ARRAY_UNSET: {
    
                Tcl_HashSearch search;
    
                Var *varPtr2;
    
    
    - eric
    
    
    
    
    Good thing for 8.4, but the patch is not fully correct (half missing). 
    -- 03/27/2000 hobbs
    
    Whoops -- darn cut-n'-paste.  The above patch is now complete (as far as the C source goes anyway).
    
    - eric
    
    -- 03/28/2000 ericm
    
    Done.
    
    - eric
    
    -- 05/08/2000 ericm
    
    
    
  4. foundin changed to: "obsolete: 8.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "07. Variables"
  10. title changed to: "Expose Tcl_HashStats at the Tcl level"
  11. type changed to: "Bug"