Index: nanovis/branches/1.1/Command.cpp
===================================================================
--- nanovis/branches/1.1/Command.cpp	(revision 4617)
+++ nanovis/branches/1.1/Command.cpp	(revision 4802)
@@ -769,9 +769,7 @@
     }
 #ifdef KEEPSTATS
-    int f;
-
     /* Use the initial client key value pairs as the parts for a generating
      * a unique file name. */
-    f = NanoVis::getStatsFile(objv[1]);
+    int f = NanoVis::getStatsFile(objv[1]);
     if (f < 0) {
         Tcl_AppendResult(interp, "can't open stats file: ", 
@@ -787,5 +785,5 @@
         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
         /* server */
-        objPtr = Tcl_NewStringObj("server", 6);
+        objPtr = Tcl_NewStringObj("renderer", 8);
         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
         objPtr = Tcl_NewStringObj("nanovis", 7);
@@ -794,7 +792,7 @@
         objPtr = Tcl_NewStringObj("pid", 3);
         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
-        Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(getpid()));
+        Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewLongObj((long)NanoVis::stats.pid));
         /* machine */
-        objPtr = Tcl_NewStringObj("machine", 7);
+        objPtr = Tcl_NewStringObj("host", 4);
         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
         gethostname(buf, BUFSIZ-1);
@@ -809,12 +807,12 @@
     /* date */
     Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj("date", 4));
-    strcpy(buf, ctime(&NanoVis::startTime.tv_sec));
+    strcpy(buf, ctime(&NanoVis::stats.start.tv_sec));
     buf[strlen(buf) - 1] = '\0';
     Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj(buf, -1));
     /* date_secs */
     Tcl_ListObjAppendElement(interp, listObjPtr, 
-                Tcl_NewStringObj("date_secs", 9));
+                             Tcl_NewStringObj("date_secs", 9));
     Tcl_ListObjAppendElement(interp, listObjPtr, 
-                Tcl_NewLongObj(NanoVis::startTime.tv_sec));
+                             Tcl_NewLongObj(NanoVis::stats.start.tv_sec));
     /* Client arguments. */
     if (Tcl_ListObjGetElements(interp, objv[1], &numItems, &items) != TCL_OK) {
Index: nanovis/branches/1.1/nanovis.cpp
===================================================================
--- nanovis/branches/1.1/nanovis.cpp	(revision 4617)
+++ nanovis/branches/1.1/nanovis.cpp	(revision 4802)
@@ -91,16 +91,4 @@
 #define FALSE	0
 
-typedef struct {
-    pid_t pid;
-    size_t nFrames;            /**< # of frames sent to client. */
-    size_t nBytes;             /**< # of bytes for all frames. */
-    size_t nCommands;          /**< # of commands executed */
-    double cmdTime;            /**< Elasped time spend executing
-                                * commands. */
-    struct timeval start;      /**< Start of elapsed time. */
-} Stats;
-
-static Stats stats;
-
 // STATIC MEMBER DATA
 
@@ -109,4 +97,5 @@
 FILE *NanoVis::recfile = NULL;
 
+NanoVis::Stats NanoVis::stats;
 int NanoVis::statsFile = -1;
 
@@ -114,5 +103,4 @@
 bool NanoVis::debugFlag = false;
 bool NanoVis::axisOn = true;
-struct timeval NanoVis::startTime;
 
 int NanoVis::winWidth = NPIX;
@@ -253,8 +241,6 @@
 {
     Tcl_DString ds;
-    Tcl_Obj **objv;
-    int objc;
-    int i;
     char fileName[33];
+    char pidstr[200];
     const char *path;
     md5_state_t state;
@@ -266,15 +252,15 @@
         return statsFile;
     }
-    if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
-        return -1;
-    }
-    Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("pid", 3));
-    Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewIntObj(getpid()));
+    /* By itself the client's key/value pairs aren't unique.  Add in the
+     * process id of this render server. */
+    sprintf(pidstr, "%ld", (long)stats.pid);
+
+    /* Create an md5 hash of the key/value pairs and use it as the file name. */
     string = Tcl_GetStringFromObj(objPtr, &length);
-
     md5_init(&state);
-    md5_append(&state, (const md5_byte_t *)string, length);
+    md5_append(&state, (const md5_byte_t *)string, strlen(string));
+    md5_append(&state, (const md5_byte_t *)pidstr, strlen(pidstr));
     md5_finish(&state, digest);
-    for (i = 0; i < 16; i++) {
+    for (int i = 0; i < 16; i++) {
         sprintf(fileName + i * 2, "%02x", digest[i]);
     }
@@ -315,5 +301,4 @@
     Tcl_DString ds;
     int result;
-    int f;
 
     {
@@ -323,5 +308,5 @@
         gettimeofday(&tv, NULL);
         finish = CVT2SECS(tv);
-        tv = stats.start;
+        tv = NanoVis::stats.start;
         start = CVT2SECS(tv);
     }
@@ -353,5 +338,5 @@
     /* pid */
     Tcl_DStringAppendElement(&ds, "pid");
-    sprintf(buf, "%d", getpid());
+    sprintf(buf, "%d", NanoVis::stats.pid);
     Tcl_DStringAppendElement(&ds, buf);
     /* host */
@@ -362,26 +347,26 @@
     /* date */
     Tcl_DStringAppendElement(&ds, "date");
-    strcpy(buf, ctime(&stats.start.tv_sec));
+    strcpy(buf, ctime(&NanoVis::stats.start.tv_sec));
     buf[strlen(buf) - 1] = '\0';
     Tcl_DStringAppendElement(&ds, buf);
     /* date_secs */
     Tcl_DStringAppendElement(&ds, "date_secs");
-    sprintf(buf, "%ld", stats.start.tv_sec);
+    sprintf(buf, "%ld", NanoVis::stats.start.tv_sec);
     Tcl_DStringAppendElement(&ds, buf);
     /* num_frames */
     Tcl_DStringAppendElement(&ds, "num_frames");
-    sprintf(buf, "%lu", (unsigned long int)stats.nFrames);
+    sprintf(buf, "%lu", (unsigned long int)NanoVis::stats.nFrames);
     Tcl_DStringAppendElement(&ds, buf);
     /* frame_bytes */
     Tcl_DStringAppendElement(&ds, "frame_bytes");
-    sprintf(buf, "%lu", (unsigned long int)stats.nBytes);
+    sprintf(buf, "%lu", (unsigned long int)NanoVis::stats.nBytes);
     Tcl_DStringAppendElement(&ds, buf);
     /* num_commands */
     Tcl_DStringAppendElement(&ds, "num_commands");
-    sprintf(buf, "%lu", (unsigned long int)stats.nCommands);
+    sprintf(buf, "%lu", (unsigned long int)NanoVis::stats.nCommands);
     Tcl_DStringAppendElement(&ds, buf);
     /* cmd_time */
     Tcl_DStringAppendElement(&ds, "cmd_time");
-    sprintf(buf, "%g", stats.cmdTime);
+    sprintf(buf, "%g", NanoVis::stats.cmdTime);
     Tcl_DStringAppendElement(&ds, buf);
     /* session_time */
@@ -418,5 +403,5 @@
     }
     Tcl_DStringAppend(&ds, "\n", -1);
-    f = NanoVis::getStatsFile(NULL);
+    int f = NanoVis::getStatsFile(NULL);
     result = NanoVis::writeToStatsFile(f, Tcl_DStringValue(&ds), 
                                        Tcl_DStringLength(&ds));
@@ -495,5 +480,5 @@
     std::string cmd(str);
     cmd.erase(cmd.find_last_not_of(" \n\r\t")+1);
-    TRACE("command %lu: '%s'", stats.nCommands+1, cmd.c_str());
+    TRACE("command %lu: '%s'", NanoVis::stats.nCommands+1, cmd.c_str());
 #endif
 
@@ -511,6 +496,6 @@
     finish = CVT2SECS(tv);
 
-    stats.cmdTime += finish - start;
-    stats.nCommands++;
+    NanoVis::stats.cmdTime += finish - start;
+    NanoVis::stats.nCommands++;
     TRACE("Leave status=%d", result);
     return result;
@@ -1981,6 +1966,7 @@
 
     openlog("nanovis", LOG_CONS | LOG_PERROR | LOG_PID, LOG_USER);
-    gettimeofday(&NanoVis::startTime, NULL);
-    stats.start = NanoVis::startTime;
+    memset(&NanoVis::stats, 0, sizeof(NanoVis::Stats));
+    NanoVis::stats.pid = getpid(); 
+    gettimeofday(&NanoVis::stats.start, NULL);
 
     /* Initialize GLUT here so it can parse and remove GLUT-specific 
Index: nanovis/branches/1.1/nanovis.h
===================================================================
--- nanovis/branches/1.1/nanovis.h	(revision 4617)
+++ nanovis/branches/1.1/nanovis.h	(revision 4802)
@@ -20,4 +20,6 @@
 #include <md5.h>
 #include <GL/glew.h>
+#include <sys/types.h> // For pid_t
+#include <sys/time.h>  // For struct timeval
 
 #include <math.h>
@@ -33,5 +35,5 @@
 #include "config.h"
 
-#define NANOVIS_VERSION		"1.1.1"
+#define NANOVIS_VERSION		"1.1.2"
 
 //defines for the image based flow visualization
@@ -80,4 +82,14 @@
     };
 
+    typedef struct {
+        pid_t pid;
+        size_t nFrames;            /**< # of frames sent to client. */
+        size_t nBytes;             /**< # of bytes for all frames. */
+        size_t nCommands;          /**< # of commands executed */
+        double cmdTime;            /**< Elasped time spend executing
+                                    * commands. */
+        struct timeval start;      /**< Start of elapsed time. */
+    } Stats;
+
     typedef std::string TransferFunctionId;
     typedef std::string VolumeId;
@@ -161,9 +173,9 @@
 
     static FILE *stdin, *logfile, *recfile;
+    static Stats stats;
     static int statsFile;
     static unsigned int flags;
     static bool debugFlag;
     static bool axisOn;
-    static struct timeval startTime;       ///< Start of elapsed time.
 
     static int winWidth;	///< Width of the render window
