[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2-84-g2f6ca53

Service Account noreply at mpich.org
Tue Jan 5 19:31:43 CST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  2f6ca53d2130aef0a8382f4eba0f02e2743f4910 (commit)
       via  7d3d9baf4f72202b70ea7da6d94da3c6bd86c20d (commit)
       via  19cd0e45a6fea15319390f2224431469942282bc (commit)
       via  fe1e46f5f0ad0def2a3782059d546e30adef5104 (commit)
       via  3912dd811ed3ba45b1b6034349e9ef661abdf880 (commit)
       via  ac711cb64a32e4f2d4a3457c9fd4cf8486bdec6b (commit)
       via  1b2d67c96c9eefa9502ffc7d1169f3318f67b800 (commit)
       via  3b413c115c34dc5efb739d18e6fc204212629eae (commit)
       via  a5a1ee2e84fbcf39ab9294597a873cfb0cf51d6a (commit)
       via  bfa97a383f3765a6d5b0cc28a7aecb1c094e6d1f (commit)
       via  d7d397e98064ee65f217dcb448cb659decbec94c (commit)
       via  40ccf0b980854dcb21cde42bf8797f29e1640cc8 (commit)
       via  ea4b1e4a57e912b9810f34fe7c89f5c8dd0c23be (commit)
       via  6134a3e04f9ad9fe608767e790945bbff5fa523c (commit)
       via  dc2c98be9d640dcf28ecfdcbc6ad4742d4d17134 (commit)
       via  0cd7e1c04e835a8c39f4c3e0512bc5eb7acbe0d0 (commit)
       via  2c49fa2057827762b7a67b83da22829dfe9b830a (commit)
       via  397516099080f61282221cf5d22bf68451987d58 (commit)
       via  8f7f8770cd59a120815dd67251b92a3fca943aca (commit)
       via  fba6815857d0a05fc4b48370ea5206b5eac11f6d (commit)
       via  37f967c93e2016e096e653a8de2f22a53a365f78 (commit)
       via  e7ca9b82e0cf5b3ffbed46984c8dbe513177e459 (commit)
       via  90d7f8848bbebe20e8219b61d69d1385e313f791 (commit)
       via  173b39f23c2fbadd3c24f1172f56c0ae51915268 (commit)
       via  104dde567acc45d7d070e059adf34b1bebf6fa67 (commit)
       via  59f54e37435a6512721cd618a907c2eee9678fbb (commit)
       via  9057dd75ef0690642b4b6704130fa6c2c2d7e216 (commit)
       via  d195e8fed40d68dbe5162ad4add4e986b508ab0e (commit)
       via  64d8f81d254382cbf7842b040854009066dee268 (commit)
       via  9a6ec66b2cd6c271a45a9c022dddcebb6f37875c (commit)
       via  58c78800485d40f94c34a88195f130c04f1ee774 (commit)
       via  a37dd821d80ad900b5758e8a01bb86304dceb1b8 (commit)
       via  fb8fefd26d516b978c3cfe1e2d3d562a69515c69 (commit)
       via  844d364c8d4ff0704ba5b765a12e15c3ead84bc3 (commit)
       via  3090f0c6478d2fee42c28762f3fea0992bb93c66 (commit)
       via  06dc24dcea1318edabd2f0b25e70604abf3a9a8f (commit)
       via  43b2945e53fa8fc0d8be487a96164d77a0632660 (commit)
       via  980cf8a0862ce4dc6aa57272e0ad9407ea6b802f (commit)
       via  626e541120b16ee581e4a7bda879d1308cbfd80a (commit)
       via  12c912ec6372b241891cf41754faf04f2dc23136 (commit)
       via  ecdaac2c9163747f73c5793a9e21432bdf80f9e0 (commit)
      from  255242bd720c45eb3073f60966bed755e4cbac66 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/2f6ca53d2130aef0a8382f4eba0f02e2743f4910

commit 2f6ca53d2130aef0a8382f4eba0f02e2743f4910
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 23:38:50 2015 -0600

    mpidbg: cleanup debug class usage.
    
    1. Remove unused classes.
    
    2. Update usage of "combination classes".  CH3 and ALL are not real
    classes.  They are combinations of multiple classes.  These are meant
    to be for convenience for the user to specify multiple classes, and
    not meant for the debug messages themselves.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c
index 735a47a..ff93a94 100644
--- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c
+++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c
@@ -18,11 +18,11 @@ void MPID_nem_dbg_dump_cell (volatile struct MPID_nem_cell *cell)
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_DBG_DUMP_CELL);
 
-    MPIU_DBG_MSG_D (ALL, TERSE, "  src = %6d", cell->pkt.mpich.source);
-    MPIU_DBG_MSG_D (ALL, TERSE, "  dst = %6d", cell->pkt.mpich.dest);
-    MPIU_DBG_MSG_D (ALL, TERSE, "  len = %6d", (int)cell->pkt.mpich.datalen);
-    MPIU_DBG_MSG_D (ALL, TERSE, "  sqn = %6d", cell->pkt.mpich.seqno);
-    MPIU_DBG_MSG_D (ALL, TERSE, "  typ = %6d", cell->pkt.mpich.type);
+    MPIU_DBG_MSG_D (OTHER, TERSE, "  src = %6d", cell->pkt.mpich.source);
+    MPIU_DBG_MSG_D (OTHER, TERSE, "  dst = %6d", cell->pkt.mpich.dest);
+    MPIU_DBG_MSG_D (OTHER, TERSE, "  len = %6d", (int)cell->pkt.mpich.datalen);
+    MPIU_DBG_MSG_D (OTHER, TERSE, "  sqn = %6d", cell->pkt.mpich.seqno);
+    MPIU_DBG_MSG_D (OTHER, TERSE, "  typ = %6d", cell->pkt.mpich.type);
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_DBG_DUMP_CELL);
 }
diff --git a/src/mpid/ch3/src/mpid_port.c b/src/mpid/ch3/src/mpid_port.c
index ecac7f2..8ba0546 100644
--- a/src/mpid/ch3/src/mpid_port.c
+++ b/src/mpid/ch3/src/mpid_port.c
@@ -310,7 +310,7 @@ static int MPIDI_Open_port(MPID_Info *info_ptr, char *port_name)
        may not use shared memory).  We may need a channel-specific 
        function to create an exportable connection string.  */
     mpi_errno = MPIDI_CH3_Get_business_card(myRank, port_name, len);
-    MPIU_DBG_MSG_FMT(CH3, VERBOSE, (MPIU_DBG_FDEST, "port_name = %s", port_name));
+    MPIU_DBG_MSG_FMT(CH3_OTHER, VERBOSE, (MPIU_DBG_FDEST, "port_name = %s", port_name));
 
 fn_exit:
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_OPEN_PORT);
diff --git a/src/util/assert/assert.c b/src/util/assert/assert.c
index 0439fed..0fd9cca 100644
--- a/src/util/assert/assert.c
+++ b/src/util/assert/assert.c
@@ -23,7 +23,7 @@ int MPIR_Assert_fail(const char *cond, const char *file_name, int line_num)
                             file_name, line_num, cond);
     MPL_internal_error_printf("Assertion failed in file %s at line %d: %s\n",
                                file_name, line_num, cond);
-    MPIU_DBG_MSG_FMT(ALL, TERSE,
+    MPIU_DBG_MSG_FMT(OTHER, TERSE,
                      (MPIU_DBG_FDEST,
                       "Assertion failed in file %s at line %d: %s",
                       file_name, line_num, cond));
@@ -48,11 +48,11 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num,
                                file_name, line_num, cond);
     MPL_internal_error_printf("%s\n", msg);
 
-    MPIU_DBG_MSG_FMT(ALL, TERSE,
+    MPIU_DBG_MSG_FMT(OTHER, TERSE,
                      (MPIU_DBG_FDEST,
                       "Assertion failed in file %s at line %d: %s",
                       file_name, line_num, cond));
-    MPIU_DBG_MSG_FMT(ALL, TERSE, (MPIU_DBG_FDEST,"%s",msg));
+    MPIU_DBG_MSG_FMT(OTHER, TERSE, (MPIU_DBG_FDEST,"%s",msg));
 
     MPID_Abort(NULL, MPI_SUCCESS, 1, NULL);
     return MPI_ERR_INTERN; /* never get here, abort should kill us */
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 23c8d63..6f4a458 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -132,7 +132,6 @@ static void set_fp(FILE *fp)
     dbg_static_fp = fp;
 }
 
-
 int MPIU_DBG_Outevent( const char *file, int line, int class, int kind, 
 		       const char *fmat, ... )
 {
@@ -234,14 +233,11 @@ typedef struct dbg_classname {
 
 static const dbg_classname classnames[] = {
     { MPIU_DBG_PT2PT,         "PT2PT",         "pt2pt" },
-    { MPIU_DBG_RMA,           "RMA",           "rma"   },
     { MPIU_DBG_THREAD,        "THREAD",        "thread" },
-    { MPIU_DBG_PM,            "PM",            "pm" },
     { MPIU_DBG_ROUTINE_ENTER, "ROUTINE_ENTER", "routine_enter" },
     { MPIU_DBG_ROUTINE_EXIT,  "ROUTINE_EXIT",  "routine_exit" },
     { MPIU_DBG_ROUTINE_ENTER |
       MPIU_DBG_ROUTINE_EXIT,  "ROUTINE",       "routine" },
-    { MPIU_DBG_SYSCALL,       "SYSCALL",       "syscall" },
     { MPIU_DBG_DATATYPE,      "DATATYPE",      "datatype" },
     { MPIU_DBG_HANDLE,        "HANDLE",        "handle" },
     { MPIU_DBG_COMM,          "COMM",          "comm" },
@@ -253,8 +249,6 @@ static const dbg_classname classnames[] = {
     { MPIU_DBG_CH3_CHANNEL,   "CH3_CHANNEL",   "ch3_channel" },
     { MPIU_DBG_CH3_MSG,       "CH3_MSG",       "ch3_msg" },
     { MPIU_DBG_CH3_OTHER,     "CH3_OTHER",     "ch3_other" },
-    { MPIU_DBG_CH3,           "CH3",           "ch3" },
-    { MPIU_DBG_NEM_SOCK_FUNC, "NEM_SOCK_FUNC", "nem_sock_func"},
     { MPIU_DBG_NEM_SOCK_DET,  "NEM_SOCK_DET",  "nem_sock_det"},
     { MPIU_DBG_VC,            "VC",            "vc"},
     { MPIU_DBG_REFCOUNT,      "REFCOUNT",      "refcount"},
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 10416cb..a62b878 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -89,30 +89,26 @@ enum MPIU_DBG_LEVEL { MPIU_DBG_TERSE   = 0,
 /* Any change in MPIU_DBG_CLASS must be matched by changes in 
    "classnames" in src/util/dbg/dbg_printf.c */
 enum MPIU_DBG_CLASS { MPIU_DBG_PT2PT         = 0x1,
-		      MPIU_DBG_RMA           = 0x2,
-		      MPIU_DBG_THREAD        = 0x4,
-		      MPIU_DBG_PM            = 0x8,
-		      MPIU_DBG_ROUTINE_ENTER = 0x10,
-		      MPIU_DBG_ROUTINE_EXIT  = 0x20,
-		      MPIU_DBG_SYSCALL       = 0x40,
-		      MPIU_DBG_DATATYPE      = 0x80,
-		      MPIU_DBG_HANDLE        = 0x100,
-		      MPIU_DBG_COMM          = 0x200,
-		      MPIU_DBG_BSEND         = 0x400,
-		      MPIU_DBG_OTHER         = 0x800,
-		      MPIU_DBG_CH3_CONNECT   = 0x1000,
-		      MPIU_DBG_CH3_DISCONNECT= 0x2000,
-		      MPIU_DBG_CH3_PROGRESS  = 0x4000,
-		      MPIU_DBG_CH3_CHANNEL   = 0x8000,
-		      MPIU_DBG_CH3_OTHER     = 0x10000,
-		      MPIU_DBG_CH3_MSG       = 0x20000,
-		      MPIU_DBG_CH3           = 0x3f000, /* alias for all Ch3*/
-                      MPIU_DBG_NEM_SOCK_FUNC = 0x40000,
-                      MPIU_DBG_NEM_SOCK_DET  = 0x80000,
-		      MPIU_DBG_VC            = 0x100000,
-		      MPIU_DBG_REFCOUNT      = 0x200000,
-		      MPIU_DBG_ROMIO         = 0x400000,
-                      MPIU_DBG_ERRHAND       = 0x800000,
+		      MPIU_DBG_THREAD        = 0x2,
+		      MPIU_DBG_ROUTINE_ENTER = 0x4,
+		      MPIU_DBG_ROUTINE_EXIT  = 0x8,
+		      MPIU_DBG_DATATYPE      = 0x10,
+		      MPIU_DBG_HANDLE        = 0x20,
+		      MPIU_DBG_COMM          = 0x40,
+		      MPIU_DBG_BSEND         = 0x80,
+		      MPIU_DBG_OTHER         = 0x100,
+		      MPIU_DBG_CH3_CONNECT   = 0x200,
+		      MPIU_DBG_CH3_DISCONNECT= 0x400,
+		      MPIU_DBG_CH3_PROGRESS  = 0x800,
+		      MPIU_DBG_CH3_CHANNEL   = 0x1000,
+		      MPIU_DBG_CH3_OTHER     = 0x2000,
+		      MPIU_DBG_CH3_MSG       = 0x4000,
+		      MPIU_DBG_CH3           = 0x7e00, /* alias for all CH3 */
+		      MPIU_DBG_NEM_SOCK_DET  = 0x8000,
+		      MPIU_DBG_VC            = 0x10000,
+		      MPIU_DBG_REFCOUNT      = 0x20000,
+		      MPIU_DBG_ROMIO         = 0x40000,
+		      MPIU_DBG_ERRHAND       = 0x80000,
 		      MPIU_DBG_ALL           = (~0) };   /* alias for all */
 
 extern int MPIU_DBG_ActiveClasses;

http://git.mpich.org/mpich.git/commitdiff/7d3d9baf4f72202b70ea7da6d94da3c6bd86c20d

commit 7d3d9baf4f72202b70ea7da6d94da3c6bd86c20d
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 22:34:59 2015 -0600

    mpidbg: rename functions and variables to make them consistent.
    
    Remove camel-case naming, and start name with "dbg" where possible.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 64cffb4..23c8d63 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -47,27 +47,27 @@ int MPIU_DBG_ActiveClasses = 0;
 int MPIU_DBG_MaxLevel      = MPIU_DBG_TYPICAL;
 static enum {DBG_UNINIT, DBG_PREINIT, DBG_INITIALIZED, DBG_ERROR}
     dbg_initialized = DBG_UNINIT;
-static char filePatternBuf[MAXPATHLEN] = "";
-static const char *filePattern = "-stdout-"; /* "log%d.log"; */
-static const char *defaultFilePattern = "dbg at W%w-@%d at T-%t at .log";
+static char file_pattern_buf[MAXPATHLEN] = "";
+static const char *file_pattern = "-stdout-"; /* "log%d.log"; */
+static const char *default_file_pattern = "dbg at W%w-@%d at T-%t at .log";
 static char temp_filename[MAXPATHLEN] = "";
-static int worldNum  = 0;
-static int worldRank = -1;
-static int whichRank = -1;             /* all ranks */
-static int    resetTimeOrigin = 1;
-static double timeOrigin = 0.0;
+static int world_num  = 0;
+static int world_rank = -1;
+static int which_rank = -1;             /* all ranks */
+static int    reset_time_origin = 1;
+static double time_origin = 0.0;
 
 static int dbg_usage( const char *, const char * );
 static int dbg_openfile(FILE **dbg_fp);
-static int setDBGClass( const char * );
-static int SetDBGLevel( const char *, const char *(names[]) );
+static int dbg_set_class( const char * );
+static int dbg_set_level( const char *, const char *(names[]) );
 static int dbg_get_filename(char *filename, int len);
 
 #ifdef MPICH_IS_THREADED
 static MPID_Thread_tls_t dbg_tls_key;
 #endif
 
-static FILE *static_dbg_fp = 0;
+static FILE *dbg_static_fp = 0;
 
 /*
    This function finds the basename in a path (ala "man 1 basename").
@@ -112,7 +112,7 @@ static FILE *get_fp(void)
     MPIU_THREAD_CHECK_END;
 #endif
 
-    return static_dbg_fp;
+    return dbg_static_fp;
 }
 
 static void set_fp(FILE *fp)
@@ -129,7 +129,7 @@ static void set_fp(FILE *fp)
     MPIU_THREAD_CHECK_END;
 #endif
 
-    static_dbg_fp = fp;
+    dbg_static_fp = fp;
 }
 
 
@@ -173,7 +173,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 
     MPL_Wtime( &t );
     MPL_Wtime_todouble( &t, &curtime );
-    curtime = curtime - timeOrigin;
+    curtime = curtime - time_origin;
 
     /* The kind values are used with the macros to simplify these cases */
     switch (kind) {
@@ -181,7 +181,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 	    va_start(list,fmat);
 	    str = va_arg(list,char *);
 	    fprintf( dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n",
-		     worldNum, worldRank, threadID, pid, class, curtime, 
+		     world_num, world_rank, threadID, pid, class, curtime, 
 		     file, line, str );
 	    break;
 	case 1:
@@ -190,7 +190,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 	    MPL_snprintf( stmp, sizeof(stmp), fmat, str );
 	    va_end(list);
 	    fprintf( dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n",
-		     worldNum, worldRank, threadID, pid, class, curtime, 
+		     world_num, world_rank, threadID, pid, class, curtime, 
 		     file, line, stmp );
 	    break;
 	case 2: 
@@ -199,7 +199,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 	    MPL_snprintf( stmp, sizeof(stmp), fmat, i);
 	    va_end(list);
 	    fprintf( dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n",
-		     worldNum, worldRank, threadID, pid, class, curtime, 
+		     world_num, world_rank, threadID, pid, class, curtime, 
 		     file, line, stmp );
 	    break;
 	case 3: 
@@ -208,7 +208,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 	    MPL_snprintf( stmp, sizeof(stmp), fmat, p);
 	    va_end(list);
 	    fprintf( dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n",
-		     worldNum, worldRank, threadID, pid, class, curtime, 
+		     world_num, world_rank, threadID, pid, class, curtime, 
 		     file, line, stmp );
 	    break;
         default:
@@ -222,17 +222,17 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 }
 
 /* These are used to simplify the handling of options.  
-   To add a new name, add an DBG_ClassName element to the array
+   To add a new name, add an dbg_classname element to the array
    classnames.  The "classbits" values are defined by MPIU_DBG_CLASS
    in src/include/mpidbg.h 
  */
 
-typedef struct DBG_ClassName {
+typedef struct dbg_classname {
     int        classbits;
-    const char *UCName, *LCName; 
-} DBG_ClassName;
+    const char *ucname, *lcname; 
+} dbg_classname;
 
-static const DBG_ClassName classnames[] = {
+static const dbg_classname classnames[] = {
     { MPIU_DBG_PT2PT,         "PT2PT",         "pt2pt" },
     { MPIU_DBG_RMA,           "RMA",           "rma"   },
     { MPIU_DBG_THREAD,        "THREAD",        "thread" },
@@ -280,7 +280,7 @@ static const char *lc_level_name[] = { "terse", "typical", "verbose", 0 };
  * MPID_Init, where a significant amount of the initialization takes place.
  */
 
-static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
+static int dbg_process_args( int *argc_p, char ***argv_p )
 {
     int i, rc;
 
@@ -301,14 +301,14 @@ static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
 		    MPIU_DBG_ActiveClasses = MPIU_DBG_ALL;
 		    s++;
 		    if (strncmp( s, "file", 4 ) == 0) {
-			filePattern = defaultFilePattern;
+			file_pattern = default_file_pattern;
 		    }
 		}
 		else if (strncmp(s,"-level",6) == 0) {
 		    char *p = s + 6;
 		    if (*p == '=') {
 			p++;
-			rc = SetDBGLevel( p, lc_level_name );
+			rc = dbg_set_level( p, lc_level_name );
 			if (rc) 
 			    dbg_usage( "-mpich-dbg-level", "terse, typical, verbose" );
 		    }
@@ -317,7 +317,7 @@ static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
 		    char *p = s + 6;
 		    if (*p == '=') {
 			p++;
-			rc = setDBGClass( p );
+			rc = dbg_set_class( p );
 			if (rc)
 			    dbg_usage( "-mpich-dbg-class", 0 );
 		    }
@@ -329,11 +329,11 @@ static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
 			/* A special case for a filepattern of "-default",
 			   use the predefined default pattern */
 			if (strcmp( p, "-default" ) == 0) {
-			    filePattern = defaultFilePattern;
+			    file_pattern = default_file_pattern;
 			}
 			else {
-                            strncpy(filePatternBuf, p, sizeof(filePatternBuf));
-			    filePattern = filePatternBuf;
+                            strncpy(file_pattern_buf, p, sizeof(file_pattern_buf));
+			    file_pattern = file_pattern_buf;
 			}
 		    }
 		}
@@ -342,10 +342,10 @@ static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
 		    if (*p == '=' && p[1] != 0) {
 			char *sOut;
 			p++;
-			whichRank = (int)strtol( p, &sOut, 10 );
+			which_rank = (int)strtol( p, &sOut, 10 );
 			if (p == sOut) {
 			    dbg_usage( "-mpich-dbg-rank", 0 );
-			    whichRank = -1;
+			    which_rank = -1;
 			}
 		    }
 		}
@@ -360,7 +360,7 @@ static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
     return MPI_SUCCESS;
 }
 
-static int DBG_ProcessEnv( void )
+static int dbg_process_env( void )
 {
     char *s;
     int rc;
@@ -371,34 +371,34 @@ static int DBG_ProcessEnv( void )
 	MPIU_DBG_MaxLevel = MPIU_DBG_TYPICAL;
 	MPIU_DBG_ActiveClasses = MPIU_DBG_ALL;
 	if (strncmp(s,"FILE",4) == 0) {
-	    filePattern = defaultFilePattern;
+	    file_pattern = default_file_pattern;
 	}
     }
     s = getenv( "MPICH_DBG_LEVEL" );
     if (s) {
-	rc = SetDBGLevel( s, level_name );
+	rc = dbg_set_level( s, level_name );
 	if (rc) 
 	    dbg_usage( "MPICH_DBG_LEVEL", "TERSE, TYPICAL, VERBOSE" );
     }
 
     s = getenv( "MPICH_DBG_CLASS" );
-    rc = setDBGClass( s );
+    rc = dbg_set_class( s );
     if (rc) 
 	dbg_usage( "MPICH_DBG_CLASS", 0 );
 
     s = getenv( "MPICH_DBG_FILENAME" );
     if (s) {
-        strncpy(filePatternBuf, s, sizeof(filePatternBuf));
-        filePattern = filePatternBuf;
+        strncpy(file_pattern_buf, s, sizeof(file_pattern_buf));
+        file_pattern = file_pattern_buf;
     }
 
     s = getenv( "MPICH_DBG_RANK" );
     if (s) {
 	char *sOut;
-	whichRank = (int)strtol( s, &sOut, 10 );
+	which_rank = (int)strtol( s, &sOut, 10 );
 	if (s == sOut) {
 	    dbg_usage( "MPICH_DBG_RANK", 0 );
-	    whichRank = -1;
+	    which_rank = -1;
 	}
     }
     return MPI_SUCCESS;
@@ -423,14 +423,14 @@ int MPIU_DBG_PreInit( int *argc_p, char ***argv_p, int wtimeNotReady )
        tests is important, as they allow general defaults to be set,
        followed by more specific modifications */
     /* First, the environment variables */
-    DBG_ProcessEnv();
+    dbg_process_env();
 
-    DBG_ProcessArgs( argc_p, argv_p );
+    dbg_process_args( argc_p, argv_p );
 
     if (wtimeNotReady == 0) {
 	MPL_Wtime( &t );
-	MPL_Wtime_todouble( &t, &timeOrigin );
-	resetTimeOrigin = 0;
+	MPL_Wtime_todouble( &t, &time_origin );
+	reset_time_origin = 0;
     }
 
     dbg_initialized = DBG_PREINIT;
@@ -456,11 +456,11 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
     dbg_fp = get_fp();
 
     /* We may need to wait until the device is set up to initialize the timer */
-    if (resetTimeOrigin) {
+    if (reset_time_origin) {
 	MPL_Time_t t;
 	MPL_Wtime( &t );
-	MPL_Wtime_todouble( &t, &timeOrigin );
-	resetTimeOrigin = 0;
+	MPL_Wtime_todouble( &t, &time_origin );
+	reset_time_origin = 0;
     }
     /* Check to see if any debugging was selected.  The order of these
        tests is important, as they allow general defaults to be set,
@@ -471,14 +471,14 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
        (as they were already handled in DBG_PreInit) */
     /* First, the environment variables */
     if (!has_env) 
-	DBG_ProcessEnv();
+	dbg_process_env();
     /* Now the command-line arguments */
     if (!has_args) 
-	DBG_ProcessArgs( argc_p, argv_p );
+	dbg_process_args( argc_p, argv_p );
 
-    worldRank = wrank;
+    world_rank = wrank;
 
-    if (whichRank >= 0 && whichRank != wrank) {
+    if (which_rank >= 0 && which_rank != wrank) {
 	/* Turn off logging on this process */
 	MPIU_DBG_ActiveClasses = 0;
     }
@@ -541,7 +541,7 @@ Environment variables\n\
     MPICH_DBG_LEVEL=NAME\n\
     MPICH_DBG_FILENAME=pattern\n\
     MPICH_DBG_RANK=val\n\
-    MPICH_DBG=YES or FILE\n", defaultFilePattern );
+    MPICH_DBG=YES or FILE\n", default_file_pattern );
 
     fflush(stderr);
 
@@ -552,10 +552,10 @@ Environment variables\n\
 /* creates a temporary file in the same directory the
    user specified for the log file */
 #undef FUNCNAME
-#define FUNCNAME DBG_Open_temp_file
+#define FUNCNAME dbg_open_tmpfile
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-static int DBG_Open_temp_file(FILE **dbg_fp)
+static int dbg_open_tmpfile(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     const char temp_pattern[] = "templogXXXXXX";
@@ -563,7 +563,7 @@ static int DBG_Open_temp_file(FILE **dbg_fp)
     char *basename;
     int ret;
     
-    ret = MPL_strncpy(temp_filename, filePattern, MAXPATHLEN);
+    ret = MPL_strncpy(temp_filename, file_pattern, MAXPATHLEN);
     if (ret) goto fn_fail;
     
     find_basename(temp_filename, &basename);
@@ -591,10 +591,10 @@ static int DBG_Open_temp_file(FILE **dbg_fp)
 /* creates a temporary file in the same directory the
    user specified for the log file */
 #undef FUNCNAME
-#define FUNCNAME DBG_Open_temp_file
+#define FUNCNAME dbg_open_tmpfile
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-static int DBG_Open_temp_file(FILE **dbg_fp)
+static int dbg_open_tmpfile(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     const char temp_pattern[] = "templogXXXXXX";
@@ -603,7 +603,7 @@ static int DBG_Open_temp_file(FILE **dbg_fp)
     int ret;
     errno_t ret_errno;
     
-    ret = MPL_strncpy(temp_filename, filePattern, MAXPATHLEN);
+    ret = MPL_strncpy(temp_filename, file_pattern, MAXPATHLEN);
     if (ret) goto fn_fail;
 
     find_basename(temp_filename, &basename);
@@ -636,10 +636,10 @@ static int DBG_Open_temp_file(FILE **dbg_fp)
    file with the same name may exist.  That file would get clobbered.
 */
 #undef FUNCNAME
-#define FUNCNAME DBG_Open_temp_file
+#define FUNCNAME dbg_open_tmpfile
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-static int DBG_Open_temp_file(FILE **dbg_fp)
+static int dbg_open_tmpfile(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     const char temp_pattern[] = "templogXXXXXX";
@@ -679,18 +679,18 @@ static int dbg_get_filename(char *filename, int len)
 #else
     int nThread = 1;
 #endif
-    static char worldNumAsChar[10] = "0";
+    static char world_numAsChar[10] = "0";
     char *pDest;
     const char *p;
 
     /* FIXME: This is a hack to handle the common case of two worlds */
     if (MPIR_Process.comm_parent != NULL) {
 	nWorld = 2;
-	worldNumAsChar[0] = '1';
-	worldNumAsChar[1] = '\0';
+	world_numAsChar[0] = '1';
+	world_numAsChar[1] = '\0';
     }
 
-    p     = filePattern;
+    p     = file_pattern;
     pDest = filename;
     *filename = 0;
     while (*p && (pDest-filename) < len-1) {
@@ -742,7 +742,7 @@ static int dbg_get_filename(char *filename, int len)
             if (*p == 'd') {
                 char rankAsChar[20];
                 MPL_snprintf( rankAsChar, sizeof(rankAsChar), "%d", 
-                               worldRank );
+                               world_rank );
                 *pDest = 0;
                 MPL_strnapp( filename, rankAsChar, len );
                 pDest += strlen(rankAsChar);
@@ -767,8 +767,8 @@ static int dbg_get_filename(char *filename, int len)
                 /* FIXME: Get world number */
                 /* *pDest++ = '0'; */
                 *pDest = 0;
-                MPL_strnapp( filename, worldNumAsChar, len );
-                pDest += strlen(worldNumAsChar);
+                MPL_strnapp( filename, world_numAsChar, len );
+                pDest += strlen(world_numAsChar);
             }
             else if (*p == 'p') {
                 /* Appends the pid of the proceess to the file name. */
@@ -803,11 +803,11 @@ static int dbg_get_filename(char *filename, int len)
 static int dbg_openfile(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
-    if (!filePattern || *filePattern == 0 ||
-	strcmp(filePattern, "-stdout-" ) == 0) {
+    if (!file_pattern || *file_pattern == 0 ||
+	strcmp(file_pattern, "-stdout-" ) == 0) {
 	*dbg_fp = stdout;
     }
-    else if (strcmp( filePattern, "-stderr-" ) == 0) {
+    else if (strcmp( file_pattern, "-stderr-" ) == 0) {
 	*dbg_fp = stderr;
     }
     else {
@@ -817,7 +817,7 @@ static int dbg_openfile(FILE **dbg_fp)
            rank yet, so we create a temp file, to be renamed later */
         if (dbg_initialized != DBG_INITIALIZED) 
         {
-            mpi_errno = DBG_Open_temp_file(dbg_fp);
+            mpi_errno = dbg_open_tmpfile(dbg_fp);
             if (mpi_errno) goto fn_fail;
         }
         else 
@@ -843,7 +843,7 @@ static int dbg_openfile(FILE **dbg_fp)
 /* Support routines for processing mpich-dbg values */
 /* Update the GLOBAL variable MPIU_DBG_ActiveClasses with
    the bits corresponding to this name */
-static int setDBGClass( const char *s )
+static int dbg_set_class( const char *s )
 {
     int i;
     size_t slen = 0;
@@ -852,22 +852,22 @@ static int setDBGClass( const char *s )
     if (s && *s) slen = strlen(s);
 
     while (s && *s) {
-	for (i=0; classnames[i].LCName; i++) {
+	for (i=0; classnames[i].lcname; i++) {
 	    /* The LCLen and UCLen *should* be the same, but
 	       just in case, we separate them */
-	    size_t LClen = strlen(classnames[i].LCName);
-	    size_t UClen = strlen(classnames[i].UCName);
+	    size_t LClen = strlen(classnames[i].lcname);
+	    size_t UClen = strlen(classnames[i].ucname);
 	    int matchClass = 0;
 
 	    /* Allow the upper case and lower case in all cases */
 	    if (slen >= LClen && 
-		strncmp(s,classnames[i].LCName, LClen) == 0 &&
+		strncmp(s,classnames[i].lcname, LClen) == 0 &&
 		(s[LClen] == ',' || s[LClen] == 0) ) {
 		matchClass = 1;
 		len = LClen;
 	    }
 	    else if (slen >= UClen && 
-		strncmp(s,classnames[i].UCName, UClen) == 0 &&
+		strncmp(s,classnames[i].ucname, UClen) == 0 &&
 		(s[UClen] == ',' || s[UClen] == 0) ) {
 		matchClass = 1;
 		len = UClen;
@@ -881,7 +881,7 @@ static int setDBGClass( const char *s )
 		break;
 	    }
 	}
-	if (!classnames[i].LCName) {
+	if (!classnames[i].lcname) {
 	    return 1;
 	}
     }
@@ -891,7 +891,7 @@ static int setDBGClass( const char *s )
 /* Set the global MPIU_DBG_MaxLevel if there is a match with the known level
    names 
 */
-static int SetDBGLevel( const char *s, const char *(names[]) )
+static int dbg_set_level( const char *s, const char *(names[]) )
 {
     int i;
 

http://git.mpich.org/mpich.git/commitdiff/19cd0e45a6fea15319390f2224431469942282bc

commit 19cd0e45a6fea15319390f2224431469942282bc
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 22:29:27 2015 -0600

    mpidbg: remove unnecessary comments.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index d693143..64cffb4 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -37,16 +37,8 @@ extern int mkstemp(char *t);
 extern FILE *fdopen(int fd, const char *mode);
 #endif
 
-/* Temporary.  sig values will change */
-/* style: allow:vprintf:3 sig:0 */
-/* style: allow:fputs:1 sig:0 */
-/* style: allow:printf:2 sig:0 */
-/* style: allow:fprintf:7 sig:0 */
-
 #ifdef USE_DBG_LOGGING
-/* 
- * NEW ROUTINES FOR DEBUGGING
- */
+
 #ifndef MAXPATHLEN
 #define MAXPATHLEN 1024
 #endif

http://git.mpich.org/mpich.git/commitdiff/fe1e46f5f0ad0def2a3782059d546e30adef5104

commit fe1e46f5f0ad0def2a3782059d546e30adef5104
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 22:28:45 2015 -0600

    mpidbg: ensure function is only defined when used.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 1a63b27..d693143 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -43,24 +43,6 @@ extern FILE *fdopen(int fd, const char *mode);
 /* style: allow:printf:2 sig:0 */
 /* style: allow:fprintf:7 sig:0 */
 
-/*
-   This function finds the basename in a path (ala "man 1 basename").
-   *basename will point to an element in path.
-   More formally: This function sets basename to the character just after the last '/' in path.
-*/
-static void find_basename(char *path, char **basename)
-{
-    char *c;
-
-    c = *basename = path;
-    while (*c)
-    {
-        if (*c == '/')
-            *basename = c+1;
-        ++c;
-    } 
-}
-
 #ifdef USE_DBG_LOGGING
 /* 
  * NEW ROUTINES FOR DEBUGGING
@@ -95,6 +77,24 @@ static MPID_Thread_tls_t dbg_tls_key;
 
 static FILE *static_dbg_fp = 0;
 
+/*
+   This function finds the basename in a path (ala "man 1 basename").
+   *basename will point to an element in path.
+   More formally: This function sets basename to the character just after the last '/' in path.
+*/
+static void find_basename(char *path, char **basename)
+{
+    char *c;
+
+    c = *basename = path;
+    while (*c)
+    {
+        if (*c == '/')
+            *basename = c+1;
+        ++c;
+    } 
+}
+
 static void dbg_init_tls(void)
 {
 #ifdef MPICH_IS_THREADED

http://git.mpich.org/mpich.git/commitdiff/3912dd811ed3ba45b1b6034349e9ef661abdf880

commit 3912dd811ed3ba45b1b6034349e9ef661abdf880
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 22:09:24 2015 -0600

    mpidbg: remove MPIU_dbg_init which has no purpose now
    
    MPICH has been moved to the new debug logging format, which means that
    we no longer need to initialize the old format.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/init/initthread.c b/src/mpi/init/initthread.c
index 343b914..19447b7 100644
--- a/src/mpi/init/initthread.c
+++ b/src/mpi/init/initthread.c
@@ -493,7 +493,6 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
 #endif /* MPICH_IS_THREADED */
 
     /* FIXME: Define these in the interface.  Does Timer init belong here? */
-    MPIU_dbg_init(MPIR_Process.comm_world->rank);
     MPIU_Timer_init(MPIR_Process.comm_world->rank,
 		    MPIR_Process.comm_world->local_size);
 #ifdef USE_MEMORY_TRACING
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index d098b22..1a63b27 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -43,39 +43,6 @@ extern FILE *fdopen(int fd, const char *mode);
 /* style: allow:printf:2 sig:0 */
 /* style: allow:fprintf:7 sig:0 */
 
-#ifdef HAVE_VA_COPY
-# define va_copy_end(a) va_end(a)
-#else
-# ifdef HAVE___VA_COPY
-#  define va_copy(a,b) __va_copy(a,b)
-#  define va_copy_end(a) 
-# else
-#  define va_copy(a,b) ((a) = (b))
-/* Some writers recommend define va_copy(a,b) memcpy(&a,&b,sizeof(va_list)) */
-#  define va_copy_end(a)
-# endif
-#endif
-
-#define DBG_MEMLOG_NUM_LINES 1024
-#define DBG_MEMLOG_LINE_SIZE 256
-
-static FILE * global_dbg_fp = NULL;
-static char **dbg_memlog = NULL;
-static int dbg_memlog_next = 0;
-static int dbg_memlog_count = 0;
-static int dbg_rank = -1;
-
-typedef enum {
-    DBG_STATE_NONE = 0,
-    DBG_STATE_UNINIT = 1,
-    DBG_STATE_STDOUT = 2,
-    DBG_STATE_MEMLOG = 4,
-    DBG_STATE_FILE = 8
-} dbg_state_t;
-dbg_state_t dbg_state = DBG_STATE_UNINIT;
-
-static void dbg_init(void);
-
 /*
    This function finds the basename in a path (ala "man 1 basename").
    *basename will point to an element in path.
@@ -94,95 +61,6 @@ static void find_basename(char *path, char **basename)
     } 
 }
 
-int MPIU_dbg_init(int rank)
-{
-    dbg_rank = rank;
-
-    if (dbg_state == DBG_STATE_UNINIT)
-    {
-	dbg_init();
-    }
-
-    /* If file logging is enable, we need to open a file */
-    if (dbg_state & DBG_STATE_FILE)
-    {
-	char fn[128];
-
-	/* Only open the file only once in case MPIU_dbg_init is called more 
-	   than once */
-	if (global_dbg_fp == NULL)
-	{
-	    MPL_snprintf(fn, 128, "mpich-dbg-%d.log", dbg_rank);
-	    global_dbg_fp = fopen(fn, "w");
-	    setvbuf(global_dbg_fp, NULL, _IONBF, 0);
-	}
-    }
-    
-    return 0;
-}
-
-static void dbg_init(void)
-{
-    char * envstr;
-    
-    dbg_state = DBG_STATE_NONE;
-
-    /* FIXME: This should use MPIU_Param_get_string */
-    envstr = getenv("MPICH_DBG_OUTPUT");
-    if (envstr == NULL)
-    {
-	return;
-    }
-
-    /*
-     * TODO:
-     *
-     * - parse environment variable to determine number of log lines, etc.
-     *
-     * - add support for writing to a (per-process or global?) file
-     *
-     * - add support for sending to a log server, perhaps with global time
-     *   sequencing information ???
-     */
-    if (strstr(envstr, "stdout"))
-    {
-	dbg_state = (dbg_state_t)( DBG_STATE_STDOUT |
-					      dbg_state );
-    }
-    if (strstr(envstr, "memlog"))
-    {
-	dbg_state = (dbg_state_t)( DBG_STATE_MEMLOG |
-					      dbg_state );
-    }
-    if (strstr(envstr, "file"))
-    {
-	dbg_state = (dbg_state_t) ( DBG_STATE_FILE |
-					       dbg_state );
-    }
-
-    /* If memlog is enabled, the we need to allocate some memory for it */
-    if (dbg_state & DBG_STATE_MEMLOG)
-    {
-	dbg_memlog = MPIU_Malloc(DBG_MEMLOG_NUM_LINES * sizeof(char *) +
-				 DBG_MEMLOG_NUM_LINES * DBG_MEMLOG_LINE_SIZE);
-	if (dbg_memlog != NULL)
-	{
-	    int i;
-	    
-	    for (i = 0; i < DBG_MEMLOG_NUM_LINES ; i++)
-	    {
-		dbg_memlog[i] = ((char *) &dbg_memlog[DBG_MEMLOG_NUM_LINES]) + 
-		    i * DBG_MEMLOG_LINE_SIZE;
-	    }
-	}
-	else
-	{
-	    dbg_state = (dbg_state_t)( dbg_state &
-						  ~DBG_STATE_MEMLOG );
-	}
-    }
-}
-
 #ifdef USE_DBG_LOGGING
 /* 
  * NEW ROUTINES FOR DEBUGGING
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 0df250d..10416cb 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -118,8 +118,6 @@ enum MPIU_DBG_CLASS { MPIU_DBG_PT2PT         = 0x1,
 extern int MPIU_DBG_ActiveClasses;
 extern int MPIU_DBG_MaxLevel;
 
-int MPIU_dbg_init(int rank);
-
 int MPIU_DBG_Outevent(const char *, int, int, int, const char *, ...) 
                                         ATTRIBUTE((format(printf,5,6)));
 int MPIU_DBG_Init( int *, char ***, int, int, int );

http://git.mpich.org/mpich.git/commitdiff/ac711cb64a32e4f2d4a3457c9fd4cf8486bdec6b

commit ac711cb64a32e4f2d4a3457c9fd4cf8486bdec6b
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 21:50:19 2015 -0600

    mpidbg: remove MPIU_dbglog_printf/vprintf which are now unused.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index f04bdfc..d098b22 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -183,122 +183,6 @@ static void dbg_init(void)
     }
 }
 
-int MPIU_dbglog_printf(const char *str, ...)
-{
-    int n = 0;
-    va_list list;
-
-    if (dbg_state == DBG_STATE_UNINIT)
-    {
-	dbg_init();
-    }
-
-    if (dbg_state & DBG_STATE_MEMLOG)
-    {
-	/* FIXME: put everything on one line until a \n is found */
-	
-	dbg_memlog[dbg_memlog_next][0] = '\0';
-	va_start(list, str);
-	n = vsnprintf(dbg_memlog[dbg_memlog_next], DBG_MEMLOG_LINE_SIZE, str, 
-		      list);
-	va_end(list);
-
-	/* if the output was truncated, we null terminate the end of the
-	   string, on the off chance that vsnprintf() didn't do that.  we also
-	   check to see if any data has been written over the null we set at
-	   the beginning of the string.  this is mostly paranoia, but the man
-	   page does not clearly state what happens when truncation occurs.  if
-	   data was written to the string, we would like to output it, but we
-	   want to avoid reading past the end of the array or outputing garbage
-	   data. */
-
-	if (n < 0 || n >= DBG_MEMLOG_LINE_SIZE)
-	{
-	    dbg_memlog[dbg_memlog_next][DBG_MEMLOG_LINE_SIZE - 1] = '\0';
-	    n = (int)strlen(dbg_memlog[dbg_memlog_next]);
-	}
-
-	if (dbg_memlog[dbg_memlog_next][0] != '\0')
-	{
-	    dbg_memlog_next = (dbg_memlog_next + 1) % DBG_MEMLOG_NUM_LINES;
-	    dbg_memlog_count++;
-	}
-    }
-
-    if (dbg_state & DBG_STATE_STDOUT)
-    {
-	va_start(list, str);
-	n = vprintf(str, list);
-	va_end(list);
-    }
-
-    if ((dbg_state & DBG_STATE_FILE) && global_dbg_fp != NULL)
-    {
-	va_start(list, str);
-	n = vfprintf(global_dbg_fp, str, list);
-	va_end(list);
-    }
-
-    return n;
-}
-
-int MPIU_dbglog_vprintf(const char *str, va_list ap)
-{
-    int n = 0;
-    va_list list;
-
-    if (dbg_state == DBG_STATE_UNINIT)
-    {
-	dbg_init();
-    }
-
-    if (dbg_state & DBG_STATE_MEMLOG)
-    {
-	va_copy(list,ap);
-	dbg_memlog[dbg_memlog_next][0] = '\0';
-	n = vsnprintf(dbg_memlog[dbg_memlog_next], DBG_MEMLOG_LINE_SIZE, str, 
-		      list);
-        va_copy_end(list);
-
-	/* if the output was truncated, we null terminate the end of the
-	   string, on the off chance that vsnprintf() didn't do that.  we also
-	   check to see if any data has been written over the null we set at
-	   the beginning of the string.  this is mostly paranoia, but the man
-	   page does not clearly state what happens when truncation occurs.  if
-	   data was written to the string, we would like to output it, but we
-	   want to avoid reading past the end of the array or outputing garbage
-	   data. */
-
-	if (n < 0 || n >= DBG_MEMLOG_LINE_SIZE)
-	{
-	    dbg_memlog[dbg_memlog_next][DBG_MEMLOG_LINE_SIZE - 1] = '\0';
-	    n = (int)strlen(dbg_memlog[dbg_memlog_next]);
-	}
-
-	if (dbg_memlog[dbg_memlog_next][0] != '\0')
-	{
-	    dbg_memlog_next = (dbg_memlog_next + 1) % DBG_MEMLOG_NUM_LINES;
-	    dbg_memlog_count++;
-	}
-    }
-
-    if (dbg_state & DBG_STATE_STDOUT)
-    {
-	va_copy(list, ap);
-	n = vprintf(str, list);
-	va_copy_end(list);
-    }
-
-    if ((dbg_state & DBG_STATE_FILE) && global_dbg_fp != NULL)
-    {
-	va_copy(list, ap);
-	n = vfprintf(global_dbg_fp, str, list);
-	va_end(list);
-    }
-
-    return n;
-}
-
 #ifdef USE_DBG_LOGGING
 /* 
  * NEW ROUTINES FOR DEBUGGING
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 168888a..0df250d 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -119,8 +119,6 @@ extern int MPIU_DBG_ActiveClasses;
 extern int MPIU_DBG_MaxLevel;
 
 int MPIU_dbg_init(int rank);
-int MPIU_dbglog_printf(const char *str, ...) ATTRIBUTE((format(printf,1,2)));
-int MPIU_dbglog_vprintf(const char *str, va_list ap);
 
 int MPIU_DBG_Outevent(const char *, int, int, int, const char *, ...) 
                                         ATTRIBUTE((format(printf,5,6)));

http://git.mpich.org/mpich.git/commitdiff/1b2d67c96c9eefa9502ffc7d1169f3318f67b800

commit 1b2d67c96c9eefa9502ffc7d1169f3318f67b800
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 21:49:24 2015 -0600

    mpidbg: replace MPIDI_DBG_PRINTF with the new format.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_pre.h b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_pre.h
index dbce2dd..5603587 100644
--- a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_pre.h
+++ b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_pre.h
@@ -190,21 +190,21 @@ struct MPIDI_CH3I_Request
 
 
 #if 0
-#define DUMP_REQUEST(req) do {                                                          \
-        int i;                                                                          \
-        MPIDI_DBG_PRINTF((55, FCNAME, "request %p\n", (req)));                          \
-        MPIDI_DBG_PRINTF((55, FCNAME, "  handle = %d\n", (req)->handle));		\
-        MPIDI_DBG_PRINTF((55, FCNAME, "  ref_count = %d\n", (req)->ref_count));         \
-        MPIDI_DBG_PRINTF((55, FCNAME, "  cc = %d\n", (req)->cc));			\
-        for (i = 0; i < (req)->iov_count; ++i)                                          \
-            MPIDI_DBG_PRINTF((55, FCNAME, "  dev.iov[%d] = (%p, %d)\n", i,		\
-                              (req)->dev.iov[i+(req)->dev.iov_offset].MPL_IOV_BUF,     \
-                              (req)->dev.iov[i+(req)->dev.iov_offset].MPL_IOV_LEN));  \
-    MPIDI_DBG_PRINTF((55, FCNAME, "  dev.iov_count = %d\n",                             \
-                      (req)->dev.iov_count));                                           \
-    MPIDI_DBG_PRINTF((55, FCNAME, "  dev.state = 0x%x\n", (req)->dev.state));           \
-    MPIDI_DBG_PRINTF((55, FCNAME, "    type = %d\n",                                    \
-		      MPIDI_Request_get_type(req)));                                    \
+#define DUMP_REQUEST(req) do {                                          \
+        int i;                                                          \
+        MPIU_DBG_MSG_P(CH3_OTHER, TERSE, "request %p\n", (req));        \
+        MPIU_DBG_MSG_D(CH3_OTHER, TERSE, "  handle = %d\n", (req)->handle); \
+        MPIU_DBG_MSG_D(CH3_OTHER, TERSE, "  ref_count = %d\n", (req)->ref_count); \
+        MPIU_DBG_MSG_D(CH3_OTHER, TERSE, "  cc = %d\n", (req)->cc);     \
+        for (i = 0; i < (req)->iov_count; ++i)                          \
+            MPIU_DBG_MSG_FMT(CH3_OTHER, TERSE, (MPIU_DBG_FDEST, "  dev.iov[%d] = (%p, %d)\n", i, \
+                                                (req)->dev.iov[i+(req)->dev.iov_offset].MPL_IOV_BUF, \
+                                                (req)->dev.iov[i+(req)->dev.iov_offset].MPL_IOV_LEN)); \
+        MPIU_DBG_MSG_D(CH3_OTHER, TERSE, "  dev.iov_count = %d\n",      \
+                       (req)->dev.iov_count);                           \
+        MPIU_DBG_MSG_FMT(CH3_OTHER, TERSE, (MPIU_DBG_FDEST, "  dev.state = 0x%x\n", (req)->dev.state)); \
+        MPIU_DBG_MSG_D(CH3_OTHER, TERSE, "    type = %d\n",             \
+                       MPIDI_Request_get_type(req));                    \
     } while (0)
 #else
 #define DUMP_REQUEST(req) do { } while (0)
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_isend.c b/src/mpid/ch3/channels/nemesis/src/ch3_isend.c
index 168f96f..c9dbd1a 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_isend.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_isend.c
@@ -97,7 +97,7 @@ int MPIDI_CH3_iSend (MPIDI_VC_t *vc, MPID_Request *sreq, void * hdr, MPIDI_msg_s
     goto fn_exit;
 
  enqueue_it:
-    MPIDI_DBG_PRINTF((55, FCNAME, "enqueuing"));
+    MPIU_DBG_MSG(CH3_OTHER, TERSE, "enqueuing");
 
     sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *) hdr;
     sreq->dev.iov[0].MPL_IOV_BUF = (char *) &sreq->dev.pending_pkt;
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c b/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c
index 71bf343..746d0e2 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c
@@ -160,7 +160,7 @@ int MPIDI_CH3_iSendv (MPIDI_VC_t *vc, MPID_Request *sreq, MPL_IOV *iov, int n_io
     {
 	int i;
 	
-	MPIDI_DBG_PRINTF((55, FCNAME, "enqueuing"));
+	MPIU_DBG_MSG(CH3_OTHER, TERSE, "enqueuing");
 	
 	sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *) iov[0].MPL_IOV_BUF;
 	sreq->dev.iov[0].MPL_IOV_BUF = (char *) &sreq->dev.pending_pkt;
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c
index 65d94af..f951f67 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c
@@ -86,7 +86,7 @@ int MPIDI_CH3_iStartMsg (MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz, MPID_
     {
 	MPID_Request * sreq = NULL;
 	
-	MPIDI_DBG_PRINTF((55, FCNAME, "enqueuing"));
+	MPIU_DBG_MSG(CH3_OTHER, TERSE, "enqueuing");
 
 	/* create a request */
 	sreq = MPID_Request_create();
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c
index 71168ae..14a3a3d 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c
@@ -146,7 +146,7 @@ int MPIDI_CH3_iStartMsgv (MPIDI_VC_t *vc, MPL_IOV *iov, int n_iov, MPID_Request
     {
 	int i;
 	
-	MPIDI_DBG_PRINTF((55, FCNAME, "request enqueued"));
+	MPIU_DBG_MSG(CH3_OTHER, TERSE, "request enqueued");
 	/* create a request */
 	sreq = MPID_Request_create();
 	MPIU_Assert(sreq != NULL);
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c b/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c
index e1de8a0..532e05d 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c
@@ -36,7 +36,7 @@ int MPIDI_CH3I_SendNoncontig( MPIDI_VC_t *vc, MPID_Request *sreq, void *header,
         /* send queue is not empty, enqueue the request then check to
            see if we can send any now */
 
-        MPIDI_DBG_PRINTF((55, FCNAME, "enqueuing"));
+        MPIU_DBG_MSG(CH3_OTHER, TERSE, "enqueuing");
 
 	sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)header;
         sreq->ch.noncontig    = TRUE;
diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h
index f8348cb..3b04c34 100644
--- a/src/mpid/ch3/include/mpidimpl.h
+++ b/src/mpid/ch3/include/mpidimpl.h
@@ -169,7 +169,7 @@ extern MPIDI_Process_t MPIDI_Process;
 	(dt_contig_out_) = TRUE;					\
         (dt_true_lb_)    = 0;                                           \
 	(data_sz_out_) = (MPIDI_msg_sz_t) (count_) * MPID_Datatype_get_basic_size(datatype_); \
-	MPIDI_DBG_PRINTF((15, FCNAME, "basic datatype: dt_contig=%d, dt_sz=%d, data_sz=" MPIDI_MSG_SZ_FMT,\
+	MPIU_DBG_MSG_FMT(CH3_OTHER, TERSE, (MPIU_DBG_FDEST,"basic datatype: dt_contig=%d, dt_sz=%d, data_sz=" MPIDI_MSG_SZ_FMT, \
 			  (dt_contig_out_), MPID_Datatype_get_basic_size(datatype_), (data_sz_out_)));\
     }									\
     else								\
@@ -178,7 +178,7 @@ extern MPIDI_Process_t MPIDI_Process;
 	(dt_contig_out_) = (dt_ptr_)->is_contig;			\
 	(data_sz_out_) = (MPIDI_msg_sz_t) (count_) * (dt_ptr_)->size;	\
         (dt_true_lb_)    = (dt_ptr_)->true_lb;                          \
-	MPIDI_DBG_PRINTF((15, FCNAME, "user defined datatype: dt_contig=%d, dt_sz=%d, data_sz=" MPIDI_MSG_SZ_FMT,\
+	MPIU_DBG_MSG_FMT(CH3_OTHER, TERSE, (MPIU_DBG_FDEST, "user defined datatype: dt_contig=%d, dt_sz=" MPI_AINT_FMT_DEC_SPEC ", data_sz=" MPIDI_MSG_SZ_FMT, \
 			  (dt_contig_out_), (dt_ptr_)->size, (data_sz_out_)));\
     }									\
 }
@@ -987,7 +987,6 @@ const char *MPIDI_Pkt_GetDescString( MPIDI_CH3_Pkt_t *pkt );
 		      _kind,_vc,_tag,_contextid,_dest,_size) )
 
 /* FIXME: Switch this to use the common debug code */
-void MPIDI_dbg_printf(int, char *, char *, ...);
 void MPIDI_err_printf(char *, char *, ...);
 
 /* FIXME: This does not belong here */
@@ -995,22 +994,9 @@ void MPIDI_err_printf(char *, char *, ...);
 extern char *MPIDI_DBG_parent_str;
 #endif
 
-#if defined(MPICH_DBG_OUTPUT)
-#define MPIDI_DBG_PRINTF(e_)				\
-{                                               	\
-    MPIDI_dbg_printf e_;				\
-}
-#else
-#   define MPIDI_DBG_PRINTF(e)
-#endif
-
 #define MPIDI_ERR_PRINTF(e) MPIDI_err_printf e
 
 #if defined(HAVE_MACRO_VA_ARGS)
-#   define MPIDI_dbg_printf(level, func, fmt, ...)			\
-    {									\
-        MPIU_dbglog_printf("[%d] %s(): " fmt "\n", MPIR_Process.comm_world->rank, func, __VA_ARGS__);   \
-    }
 #   define MPIDI_err_printf(func, fmt, ...)				\
     {									\
         MPL_error_printf("[%d] ERROR - %s(): " fmt "\n", MPIR_Process.comm_world->rank, func, __VA_ARGS__);    \
diff --git a/src/mpid/ch3/src/mpidi_printf.c b/src/mpid/ch3/src/mpidi_printf.c
index 2f2eced..0d4371a 100644
--- a/src/mpid/ch3/src/mpidi_printf.c
+++ b/src/mpid/ch3/src/mpidi_printf.c
@@ -24,32 +24,6 @@
  */
 
 /* --BEGIN DEBUG-- */
-#undef MPIDI_dbg_printf
-void MPIDI_dbg_printf(int level, char *func, char *fmt, ...)
-{
-    /* FIXME: This "unreferenced_arg" is an example of a problem with the
-     * API (unneeded level argument) or the code (failure to check the
-     * level argument).  Inserting these "unreference_arg" macros erroneously
-     * suggests that the code is correct with this ununsed argument, and thus
-     * commits the grave harm of obscuring a real problem */
-    MPIU_UNREFERENCED_ARG(level);
-    {
-        va_list list;
-
-        if (MPIR_Process.comm_world) {
-            MPIU_dbglog_printf("[%d] %s(): ", MPIR_Process.comm_world->rank, func);
-        }
-        else {
-            MPIU_dbglog_printf("[-1] %s(): ", func);
-        }
-        va_start(list, fmt);
-        MPIU_dbglog_vprintf(fmt, list);
-        va_end(list);
-        MPIU_dbglog_printf("\n");
-        fflush(stdout);
-    }
-}
-
 #undef MPIDI_err_printf
 void MPIDI_err_printf(char *func, char *fmt, ...)
 {

http://git.mpich.org/mpich.git/commitdiff/3b413c115c34dc5efb739d18e6fc204212629eae

commit 3b413c115c34dc5efb739d18e6fc204212629eae
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 20:55:02 2015 -0600

    mpidbg: remove MPIU_dbg_printf which is now unused.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index a911c32..f04bdfc 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -299,29 +299,6 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
     return n;
 }
 
-/* FIXME: */
-int MPIU_dbg_printf(const char * str, ...)
-{
-    int n = 0;
-    
-    /* MPID_Common_thread_lock(); */
-    if (dbg_state != DBG_STATE_NONE)
-    {
-	va_list list;
-
-	MPIU_dbglog_printf("[%d]", dbg_rank);
-	va_start(list, str);
-	n = MPIU_dbglog_vprintf(str, list);
-	va_end(list);
-
-        if (dbg_state & DBG_STATE_STDOUT)
-            fflush(stdout);
-    }
-    /* MPID_Common_thread_unlock(); */
-    
-    return n;
-}
-
 #ifdef USE_DBG_LOGGING
 /* 
  * NEW ROUTINES FOR DEBUGGING
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index aec2981..168888a 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -119,7 +119,6 @@ extern int MPIU_DBG_ActiveClasses;
 extern int MPIU_DBG_MaxLevel;
 
 int MPIU_dbg_init(int rank);
-int MPIU_dbg_printf(const char *str, ...) ATTRIBUTE((format(printf,1,2)));
 int MPIU_dbglog_printf(const char *str, ...) ATTRIBUTE((format(printf,1,2)));
 int MPIU_dbglog_vprintf(const char *str, va_list ap);
 

http://git.mpich.org/mpich.git/commitdiff/a5a1ee2e84fbcf39ab9294597a873cfb0cf51d6a

commit a5a1ee2e84fbcf39ab9294597a873cfb0cf51d6a
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 19:46:53 2015 -0600

    mpidbg: replace MPIU_DBG_PRINTF with new format.
    
    This is not exactly a one-to-one translation, since MPIU_DBG_PRINTF is
    active only when MPICH_DBG_OUTPUT is true.  But MPIU_DBG_MSG_* are
    active when USE_DBG_LOGGING is true.  However, there is no configure
    option to enable MPICH_DBG_OUTPUT, so these debug messages would be
    useless in the old format anyway.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index 7e9f30b..4907e9c 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -156,15 +156,6 @@ int usleep(useconds_t usec);
 */
 #include "mpidbg.h"
 
-#if defined(MPICH_DBG_OUTPUT)
-#define MPIU_DBG_PRINTF(e)			\
-{						\
-    MPIU_dbg_printf e;                          \
-}
-#else
-#define MPIU_DBG_PRINTF(e)
-#endif
-
 /* ------------------------------------------------------------------------- */
 /* end of mpidebug.h */
 /* ------------------------------------------------------------------------- */
diff --git a/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c b/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c
index 78c864d..5a4fc17 100644
--- a/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c
+++ b/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c
@@ -65,7 +65,7 @@ static int  mpi_to_pmi_keyvals( MPID_Info *info_ptr, PMI_keyval_t **kv_ptr,
 	}
 	MPIR_Info_get_impl( info_ptr, key, vallen+1, kv[i].val, &flag );
         MPIR_ERR_CHKANDJUMP1(!flag, mpi_errno, MPI_ERR_OTHER,"**infonokey", "**infonokey %s", key);
-	MPIU_DBG_PRINTF(("key: <%s>, value: <%s>\n", kv[i].key, kv[i].val));
+	MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"key: <%s>, value: <%s>\n", kv[i].key, kv[i].val));
     }
 
  fn_fail:
diff --git a/src/mpid/ch3/src/ch3u_eager.c b/src/mpid/ch3/src/ch3u_eager.c
index 1a81c5a..13e200d 100644
--- a/src/mpid/ch3/src/ch3u_eager.c
+++ b/src/mpid/ch3/src/ch3u_eager.c
@@ -824,14 +824,14 @@ int MPIDI_CH3_PktHandler_ReadySend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
 #ifdef MPICH_DBG_OUTPUT
 int MPIDI_CH3_PktPrint_EagerSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... EAGER_SEND\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->eager_send.sender_req_id));
-    MPIU_DBG_PRINTF((" context_id ... %d\n", pkt->eager_send.match.parts.context_id));
-    MPIU_DBG_PRINTF((" tag .......... %d\n", pkt->eager_send.match.parts.tag));
-    MPIU_DBG_PRINTF((" rank ......... %d\n", pkt->eager_send.match.parts.rank));
-    MPIU_DBG_PRINTF((" data_sz ...... %d\n", pkt->eager_send.data_sz));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... EAGER_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->eager_send.sender_req_id));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," context_id ... %d\n", pkt->eager_send.match.parts.context_id);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," tag .......... %d\n", pkt->eager_send.match.parts.tag);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," rank ......... %d\n", pkt->eager_send.match.parts.rank);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," data_sz ...... %d\n", pkt->eager_send.data_sz);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-    MPIU_DBG_PRINTF((" seqnum ....... %d\n", pkt->eager_send.seqnum));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," seqnum ....... %d\n", pkt->eager_send.seqnum);
 #endif
 }
 
@@ -840,13 +840,13 @@ int MPIDI_CH3_PktPrint_EagerShortSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
     int datalen;
     unsigned char *p = (unsigned char *)pkt->eagershort_send.data;
-    MPIU_DBG_PRINTF((" type ......... EAGERSHORT_SEND\n"));
-    MPIU_DBG_PRINTF((" context_id ... %d\n", pkt->eagershort_send.match.parts.context_id));
-    MPIU_DBG_PRINTF((" tag .......... %d\n", pkt->eagershort_send.match.parts.tag));
-    MPIU_DBG_PRINTF((" rank ......... %d\n", pkt->eagershort_send.match.parts.rank));
-    MPIU_DBG_PRINTF((" data_sz ...... %d\n", pkt->eagershort_send.data_sz));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... EAGERSHORT_SEND\n");
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," context_id ... %d\n", pkt->eagershort_send.match.parts.context_id);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," tag .......... %d\n", pkt->eagershort_send.match.parts.tag);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," rank ......... %d\n", pkt->eagershort_send.match.parts.rank);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," data_sz ...... %d\n", pkt->eagershort_send.data_sz);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-    MPIU_DBG_PRINTF((" seqnum ....... %d\n", pkt->eagershort_send.seqnum));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," seqnum ....... %d\n", pkt->eagershort_send.seqnum);
 #endif
     datalen = pkt->eagershort_send.data_sz;
     if (datalen > 0) {
@@ -856,21 +856,21 @@ int MPIDI_CH3_PktPrint_EagerShortSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 	for (i=0; i<datalen; i++) {
 	    MPL_snprintf( &databytes[2*i], 64 - 2*i, "%2x", p[i] );
 	}
-	MPIU_DBG_PRINTF((" data ......... %s\n", databytes));
+	MPIU_DBG_MSG_S(CH3_OTHER,TERSE," data ......... %s\n", databytes);
     }
 }
 #endif /* defined(USE_EAGER_SHORT) */
 
 int MPIDI_CH3_PktPrint_ReadySend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... READY_SEND\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->ready_send.sender_req_id));
-    MPIU_DBG_PRINTF((" context_id ... %d\n", pkt->ready_send.match.parts.context_id));
-    MPIU_DBG_PRINTF((" tag .......... %d\n", pkt->ready_send.match.parts.tag));
-    MPIU_DBG_PRINTF((" rank ......... %d\n", pkt->ready_send.match.parts.rank));
-    MPIU_DBG_PRINTF((" data_sz ...... %d\n", pkt->ready_send.data_sz));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... READY_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->ready_send.sender_req_id));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," context_id ... %d\n", pkt->ready_send.match.parts.context_id);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," tag .......... %d\n", pkt->ready_send.match.parts.tag);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," rank ......... %d\n", pkt->ready_send.match.parts.rank);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," data_sz ...... %d\n", pkt->ready_send.data_sz);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-    MPIU_DBG_PRINTF((" seqnum ....... %d\n", pkt->ready_send.seqnum));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," seqnum ....... %d\n", pkt->ready_send.seqnum);
 #endif
 }
 
diff --git a/src/mpid/ch3/src/ch3u_eagersync.c b/src/mpid/ch3/src/ch3u_eagersync.c
index 3e57955..cd967ce 100644
--- a/src/mpid/ch3/src/ch3u_eagersync.c
+++ b/src/mpid/ch3/src/ch3u_eagersync.c
@@ -377,22 +377,22 @@ int MPIDI_CH3_PktHandler_EagerSyncAck( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
 #ifdef MPICH_DBG_OUTPUT
 int MPIDI_CH3_PktPrint_EagerSyncSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... EAGER_SYNC_SEND\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->eager_sync_send.sender_req_id));
-    MPIU_DBG_PRINTF((" context_id ... %d\n", pkt->eager_sync_send.match.parts.context_id));
-    MPIU_DBG_PRINTF((" tag .......... %d\n", pkt->eager_sync_send.match.parts.tag));
-    MPIU_DBG_PRINTF((" rank ......... %d\n", pkt->eager_sync_send.match.parts.rank));
-    MPIU_DBG_PRINTF((" data_sz ...... %d\n", pkt->eager_sync_send.data_sz));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... EAGER_SYNC_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->eager_sync_send.sender_req_id));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," context_id ... %d\n", pkt->eager_sync_send.match.parts.context_id);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," tag .......... %d\n", pkt->eager_sync_send.match.parts.tag);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," rank ......... %d\n", pkt->eager_sync_send.match.parts.rank);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," data_sz ...... %d\n", pkt->eager_sync_send.data_sz);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-    MPIU_DBG_PRINTF((" seqnum ....... %d\n", pkt->eager_sync_send.seqnum));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," seqnum ....... %d\n", pkt->eager_sync_send.seqnum);
 #endif
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_EagerSyncAck( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... EAGER_SYNC_ACK\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->eager_sync_ack.sender_req_id));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... EAGER_SYNC_ACK\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->eager_sync_ack.sender_req_id));
     return MPI_SUCCESS;
 }
 #endif
diff --git a/src/mpid/ch3/src/ch3u_handle_connection.c b/src/mpid/ch3/src/ch3u_handle_connection.c
index fa0b569..81a3ef8 100644
--- a/src/mpid/ch3/src/ch3u_handle_connection.c
+++ b/src/mpid/ch3/src/ch3u_handle_connection.c
@@ -349,8 +349,8 @@ int MPIDI_CH3_PktHandler_Close( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
 #ifdef MPICH_DBG_OUTPUT
 int MPIDI_CH3_PktPrint_Close( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_CLOSE\n"));
-    MPIU_DBG_PRINTF((" ack ......... %s\n", pkt->close.ack ? "TRUE" : "FALSE"));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_CLOSE\n");
+    MPIU_DBG_MSG_S(CH3_OTHER,TERSE," ack ......... %s\n", pkt->close.ack ? "TRUE" : "FALSE");
     return MPI_SUCCESS;
 }
 #endif
diff --git a/src/mpid/ch3/src/ch3u_port.c b/src/mpid/ch3/src/ch3u_port.c
index 1be77da..dd4b313 100644
--- a/src/mpid/ch3/src/ch3u_port.c
+++ b/src/mpid/ch3/src/ch3u_port.c
@@ -445,10 +445,10 @@ int MPIDI_Comm_connect(const char *port_name, MPID_Info *info, int root,
 	}
 
 #ifdef MPICH_DBG_OUTPUT
-	MPIU_DBG_PRINTF(("[%d]connect:Received remote_translation:\n", rank));
+	MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"[%d]connect:Received remote_translation:\n", rank);
 	for (i=0; i<remote_comm_size; i++)
 	{
-	    MPIU_DBG_PRINTF((" remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
+	    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
 		i, remote_translation[i].pg_index, i, remote_translation[i].pg_rank));
 	}
 #endif
@@ -467,10 +467,10 @@ int MPIDI_Comm_connect(const char *port_name, MPID_Info *info, int root,
     MPIR_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
 
 #ifdef MPICH_DBG_OUTPUT
-    MPIU_DBG_PRINTF(("[%d]connect:Received remote_translation after broadcast:\n", rank));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"[%d]connect:Received remote_translation after broadcast:\n", rank);
     for (i=0; i<remote_comm_size; i++)
     {
-	MPIU_DBG_PRINTF((" remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
+	MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
 	    i, remote_translation[i].pg_index, i, remote_translation[i].pg_rank));
     }
 #endif
@@ -658,7 +658,7 @@ static int ExtractLocalPGInfo( MPID_Comm *comm_p,
 #ifdef MPICH_DBG_OUTPUT
     pg_iter = pg_list;
     while (pg_iter != NULL) {
-	MPIU_DBG_PRINTF(("connect:PG: '%s'\n<%s>\n", pg_iter->pg_id, pg_iter->str));
+	MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"connect:PG: '%s'\n<%s>\n", pg_iter->pg_id, pg_iter->str));
 	pg_iter = pg_iter->next;
     }
 #endif
@@ -1015,7 +1015,7 @@ int MPIDI_Comm_accept(const char *port_name, MPID_Info *info, int root,
     MPIU_CHKLMEM_MALLOC(remote_translation,pg_translation*,
 			remote_comm_size * sizeof(pg_translation),
 			mpi_errno, "remote_translation");
-    MPIU_DBG_PRINTF(("[%d]accept:remote process groups: %d\nremote comm size: %d\n", rank, n_remote_pgs, remote_comm_size));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"[%d]accept:remote process groups: %d\nremote comm size: %d\n", rank, n_remote_pgs, remote_comm_size));
 
     /* Exchange the process groups and their corresponding KVSes */
     if (rank == root)
@@ -1035,10 +1035,10 @@ int MPIDI_Comm_accept(const char *port_name, MPID_Info *info, int root,
 				  MPI_INT, 0, recvtag++, tmp_comm,
 				  MPI_STATUS_IGNORE, &errflag);
 #ifdef MPICH_DBG_OUTPUT
-	MPIU_DBG_PRINTF(("[%d]accept:Received remote_translation:\n", rank));
+	MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"[%d]accept:Received remote_translation:\n", rank);
 	for (i=0; i<remote_comm_size; i++)
 	{
-	    MPIU_DBG_PRINTF((" remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
+	    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
 		i, remote_translation[i].pg_index, i, remote_translation[i].pg_rank));
 	}
 #endif
@@ -1057,10 +1057,10 @@ int MPIDI_Comm_accept(const char *port_name, MPID_Info *info, int root,
     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPIR_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
 #ifdef MPICH_DBG_OUTPUT
-    MPIU_DBG_PRINTF(("[%d]accept:Received remote_translation after broadcast:\n", rank));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"[%d]accept:Received remote_translation after broadcast:\n", rank);
     for (i=0; i<remote_comm_size; i++)
     {
-	MPIU_DBG_PRINTF((" remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
+	MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," remote_translation[%d].pg_index = %d\n remote_translation[%d].pg_rank = %d\n",
 	    i, remote_translation[i].pg_index, i, remote_translation[i].pg_rank));
     }
 #endif
diff --git a/src/mpid/ch3/src/ch3u_rma_pkthandler.c b/src/mpid/ch3/src/ch3u_rma_pkthandler.c
index c6821b4..bd5e94d 100644
--- a/src/mpid/ch3/src/ch3u_rma_pkthandler.c
+++ b/src/mpid/ch3/src/ch3u_rma_pkthandler.c
@@ -2147,76 +2147,76 @@ int MPIDI_CH3_PktHandler_Flush(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
 #ifdef MPICH_DBG_OUTPUT
 int MPIDI_CH3_PktPrint_Put(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_PUT\n"));
-    MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->put.addr));
-    MPIU_DBG_PRINTF((" count ........ %d\n", pkt->put.count));
-    MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->put.datatype));
-    MPIU_DBG_PRINTF((" dataloop_size. 0x%08X\n", pkt->put.info.dataloop_size));
-    MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->put.target_win_handle));
-    MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->put.source_win_handle));
-    /*MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->put.win_ptr)); */
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_PUT\n");
+    MPIU_DBG_MSG_P(CH3_OTHER,TERSE," addr ......... %p\n", pkt->put.addr);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," count ........ %d\n", pkt->put.count);
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," datatype ..... 0x%08X\n", pkt->put.datatype));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," dataloop_size. 0x%08X\n", pkt->put.info.dataloop_size));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," target ....... 0x%08X\n", pkt->put.target_win_handle));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->put.source_win_handle));
+    /*MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," win_ptr ...... 0x%08X\n", pkt->put.win_ptr)); */
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_Get(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_GET\n"));
-    MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->get.addr));
-    MPIU_DBG_PRINTF((" count ........ %d\n", pkt->get.count));
-    MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->get.datatype));
-    MPIU_DBG_PRINTF((" dataloop_size. %d\n", pkt->get.info.dataloop_size));
-    MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get.request_handle));
-    MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->get.target_win_handle));
-    MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->get.source_win_handle));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_GET\n");
+    MPIU_DBG_MSG_P(CH3_OTHER,TERSE," addr ......... %p\n", pkt->get.addr);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," count ........ %d\n", pkt->get.count);
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," datatype ..... 0x%08X\n", pkt->get.datatype));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," dataloop_size. %d\n", pkt->get.info.dataloop_size);
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," request ...... 0x%08X\n", pkt->get.request_handle));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," target ....... 0x%08X\n", pkt->get.target_win_handle));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->get.source_win_handle));
     /*
-     * MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get.request));
-     * MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->get.win_ptr));
+     * MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," request ...... 0x%08X\n", pkt->get.request));
+     * MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," win_ptr ...... 0x%08X\n", pkt->get.win_ptr));
      */
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_GetResp(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_GET_RESP\n"));
-    MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get_resp.request_handle));
-    /*MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get_resp.request)); */
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_GET_RESP\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," request ...... 0x%08X\n", pkt->get_resp.request_handle));
+    /*MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," request ...... 0x%08X\n", pkt->get_resp.request)); */
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_Accumulate(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_ACCUMULATE\n"));
-    MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->accum.addr));
-    MPIU_DBG_PRINTF((" count ........ %d\n", pkt->accum.count));
-    MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->accum.datatype));
-    MPIU_DBG_PRINTF((" dataloop_size. %d\n", pkt->accum.info.dataloop_size));
-    MPIU_DBG_PRINTF((" op ........... 0x%08X\n", pkt->accum.op));
-    MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->accum.target_win_handle));
-    MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->accum.source_win_handle));
-    /*MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->accum.win_ptr)); */
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_ACCUMULATE\n");
+    MPIU_DBG_MSG_P(CH3_OTHER,TERSE," addr ......... %p\n", pkt->accum.addr);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," count ........ %d\n", pkt->accum.count);
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," datatype ..... 0x%08X\n", pkt->accum.datatype));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," dataloop_size. %d\n", pkt->accum.info.dataloop_size);
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," op ........... 0x%08X\n", pkt->accum.op));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," target ....... 0x%08X\n", pkt->accum.target_win_handle));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->accum.source_win_handle));
+    /*MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," win_ptr ...... 0x%08X\n", pkt->accum.win_ptr)); */
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_Lock(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK\n"));
-    MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock.lock_type));
-    MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock.target_win_handle));
-    MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock.source_win_handle));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_LOCK\n");
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," lock_type .... %d\n", pkt->lock.lock_type);
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," target ....... 0x%08X\n", pkt->lock.target_win_handle));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->lock.source_win_handle));
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_Ack(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_ACK\n"));
-    MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->ack.source_win_handle));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_ACK\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->ack.source_win_handle));
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_LockAck(FILE * fp, MPIDI_CH3_Pkt_t * pkt)
 {
-    MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_ACK\n"));
-    MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_ack.source_win_handle));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_LOCK_ACK\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->lock_ack.source_win_handle));
     return MPI_SUCCESS;
 }
 #endif
diff --git a/src/mpid/ch3/src/ch3u_rndv.c b/src/mpid/ch3/src/ch3u_rndv.c
index f6bb567..d4360ae 100644
--- a/src/mpid/ch3/src/ch3u_rndv.c
+++ b/src/mpid/ch3/src/ch3u_rndv.c
@@ -212,7 +212,7 @@ int MPIDI_CH3_PktHandler_RndvClrToSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received rndv CTS pkt");
     
     MPID_Request_get_ptr(cts_pkt->sender_req_id, sreq);
-    MPIU_DBG_PRINTF(("received cts, count=%d\n", sreq->dev.user_count));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"received cts, count=" MPI_AINT_FMT_DEC_SPEC "\n", sreq->dev.user_count));
 
     sreq->dev.OnDataAvail = 0;
     sreq->dev.OnFinal = 0;
@@ -383,28 +383,28 @@ int MPIDI_CH3_RecvRndv( MPIDI_VC_t * vc, MPID_Request *rreq )
 #ifdef MPICH_DBG_OUTPUT
 int MPIDI_CH3_PktPrint_RndvReqToSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... REQ_TO_SEND\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->rndv_req_to_send.sender_req_id));
-    MPIU_DBG_PRINTF((" context_id ... %d\n", pkt->rndv_req_to_send.match.parts.context_id));
-    MPIU_DBG_PRINTF((" tag .......... %d\n", pkt->rndv_req_to_send.match.parts.tag));
-    MPIU_DBG_PRINTF((" rank ......... %d\n", pkt->rndv_req_to_send.match.parts.rank));
-    MPIU_DBG_PRINTF((" data_sz ...... %d\n", pkt->rndv_req_to_send.data_sz));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... REQ_TO_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->rndv_req_to_send.sender_req_id));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," context_id ... %d\n", pkt->rndv_req_to_send.match.parts.context_id);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," tag .......... %d\n", pkt->rndv_req_to_send.match.parts.tag);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," rank ......... %d\n", pkt->rndv_req_to_send.match.parts.rank);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," data_sz ...... %d\n", pkt->rndv_req_to_send.data_sz);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-    MPIU_DBG_PRINTF((" seqnum ....... %d\n", pkt->rndv_req_to_send.seqnum));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," seqnum ....... %d\n", pkt->rndv_req_to_send.seqnum);
 #endif
     return MPI_SUCCESS;
 }
 int MPIDI_CH3_PktPrint_RndvClrToSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... CLR_TO_SEND\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->rndv_clr_to_send.sender_req_id));
-    MPIU_DBG_PRINTF((" recvr_reqid .. 0x%08X\n", pkt->rndv_clr_to_send.receiver_req_id));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... CLR_TO_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->rndv_clr_to_send.sender_req_id));
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," recvr_reqid .. 0x%08X\n", pkt->rndv_clr_to_send.receiver_req_id));
     return MPI_SUCCESS;
 }
 int MPIDI_CH3_PktPrint_RndvSend( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... RNDV_SEND\n"));
-    MPIU_DBG_PRINTF((" recvr_reqid .. 0x%08X\n", pkt->rndv_send.receiver_req_id));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... RNDV_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," recvr_reqid .. 0x%08X\n", pkt->rndv_send.receiver_req_id));
     return MPI_SUCCESS;
 }
 #endif
diff --git a/src/mpid/ch3/src/mpid_cancel_send.c b/src/mpid/ch3/src/mpid_cancel_send.c
index 5f4b683..3aaef9b 100644
--- a/src/mpid/ch3/src/mpid_cancel_send.c
+++ b/src/mpid/ch3/src/mpid_cancel_send.c
@@ -347,20 +347,20 @@ int MPIDI_CH3_PktHandler_CancelSendResp( MPIDI_VC_t *vc ATTRIBUTE((unused)),
 #ifdef MPICH_DBG_OUTPUT
 int MPIDI_CH3_PktPrint_CancelSendReq( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... CANCEL_SEND\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->cancel_send_req.sender_req_id));
-    MPIU_DBG_PRINTF((" context_id ... %d\n", pkt->cancel_send_req.match.parts.context_id));
-    MPIU_DBG_PRINTF((" tag .......... %d\n", pkt->cancel_send_req.match.parts.tag));
-    MPIU_DBG_PRINTF((" rank ......... %d\n", pkt->cancel_send_req.match.parts.rank));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... CANCEL_SEND\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->cancel_send_req.sender_req_id));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," context_id ... %d\n", pkt->cancel_send_req.match.parts.context_id);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," tag .......... %d\n", pkt->cancel_send_req.match.parts.tag);
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," rank ......... %d\n", pkt->cancel_send_req.match.parts.rank);
 
     return MPI_SUCCESS;
 }
 
 int MPIDI_CH3_PktPrint_CancelSendResp( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
 {
-    MPIU_DBG_PRINTF((" type ......... CANCEL_SEND_RESP\n"));
-    MPIU_DBG_PRINTF((" sender_reqid . 0x%08X\n", pkt->cancel_send_resp.sender_req_id));
-    MPIU_DBG_PRINTF((" ack .......... %d\n", pkt->cancel_send_resp.ack));
+    MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... CANCEL_SEND_RESP\n");
+    MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," sender_reqid . 0x%08X\n", pkt->cancel_send_resp.sender_req_id));
+    MPIU_DBG_MSG_D(CH3_OTHER,TERSE," ack .......... %d\n", pkt->cancel_send_resp.ack);
     
     return MPI_SUCCESS;
 }
diff --git a/src/mpid/ch3/src/mpidi_printf.c b/src/mpid/ch3/src/mpidi_printf.c
index 031bef9..2f2eced 100644
--- a/src/mpid/ch3/src/mpidi_printf.c
+++ b/src/mpid/ch3/src/mpidi_printf.c
@@ -75,7 +75,7 @@ void MPIDI_err_printf(char *func, char *fmt, ...)
    of packet types (and allowing channels to customize the printing
    of packets). For example, an array of function pointers, indexed by
    packet type, could be used.
-   Also, these routines should not use MPIU_DBG_PRINTF, instead they should
+   Also, these routines should not use MPIU_DBG_MSG_* functions, instead they should
    us a simple fprintf with a style allowance (so that the style checker
    won't flag the use as a possible problem).
 
@@ -89,7 +89,7 @@ void MPIDI_err_printf(char *func, char *fmt, ...)
 void MPIDI_DBG_Print_packet(MPIDI_CH3_Pkt_t * pkt)
 {
     {
-        MPIU_DBG_PRINTF(("MPIDI_CH3_Pkt_t:\n"));
+        MPIU_DBG_MSG(CH3_OTHER,TERSE,"MPIDI_CH3_Pkt_t:\n");
         switch (pkt->type) {
         case MPIDI_CH3_PKT_EAGER_SEND:
             MPIDI_CH3_PktPrint_EagerSend(stdout, pkt);
@@ -146,12 +146,12 @@ void MPIDI_DBG_Print_packet(MPIDI_CH3_Pkt_t * pkt)
             break;
             /*
              * case MPIDI_CH3_PKT_SHARED_LOCK_OPS_DONE:
-             * MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_SHARED_LOCK_OPS_DONE\n"));
-             * MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->shared_lock_ops_done.source_win_handle));
+             * MPIU_DBG_MSG(CH3_OTHER,TERSE," type ......... MPIDI_CH3_PKT_SHARED_LOCK_OPS_DONE\n");
+             * MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST," source ....... 0x%08X\n", pkt->shared_lock_ops_done.source_win_handle));
              * break;
              */
         case MPIDI_CH3_PKT_FLOW_CNTL_UPDATE:
-            MPIU_DBG_PRINTF((" FLOW_CNTRL_UPDATE\n"));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE," FLOW_CNTRL_UPDATE\n");
             break;
 
         case MPIDI_CH3_PKT_CLOSE:
@@ -159,41 +159,41 @@ void MPIDI_DBG_Print_packet(MPIDI_CH3_Pkt_t * pkt)
             break;
 
         default:
-            MPIU_DBG_PRINTF((" INVALID PACKET\n"));
-            MPIU_DBG_PRINTF((" unknown type ... %d\n", pkt->type));
-            MPIU_DBG_PRINTF(("  type .......... EAGER_SEND\n"));
-            MPIU_DBG_PRINTF(("   sender_reqid . 0x%08X\n", pkt->eager_send.sender_req_id));
-            MPIU_DBG_PRINTF(("   context_id ... %d\n", pkt->eager_send.match.parts.context_id));
-            MPIU_DBG_PRINTF(("   data_sz ...... %d\n", pkt->eager_send.data_sz));
-            MPIU_DBG_PRINTF(("   tag .......... %d\n", pkt->eager_send.match.parts.tag));
-            MPIU_DBG_PRINTF(("   rank ......... %d\n", pkt->eager_send.match.parts.rank));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE," INVALID PACKET\n");
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE," unknown type ... %d\n", pkt->type);
+            MPIU_DBG_MSG(CH3_OTHER,TERSE,"  type .......... EAGER_SEND\n");
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   sender_reqid . 0x%08X\n", pkt->eager_send.sender_req_id));
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   context_id ... %d\n", pkt->eager_send.match.parts.context_id);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   data_sz ...... %d\n", pkt->eager_send.data_sz);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   tag .......... %d\n", pkt->eager_send.match.parts.tag);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   rank ......... %d\n", pkt->eager_send.match.parts.rank);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-            MPIU_DBG_PRINTF(("   seqnum ....... %d\n", pkt->eager_send.seqnum));
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   seqnum ....... %d\n", pkt->eager_send.seqnum);
 #endif
-            MPIU_DBG_PRINTF(("  type .......... REQ_TO_SEND\n"));
-            MPIU_DBG_PRINTF(("   sender_reqid . 0x%08X\n", pkt->rndv_req_to_send.sender_req_id));
-            MPIU_DBG_PRINTF(("   context_id ... %d\n",
-                             pkt->rndv_req_to_send.match.parts.context_id));
-            MPIU_DBG_PRINTF(("   data_sz ...... %d\n", pkt->rndv_req_to_send.data_sz));
-            MPIU_DBG_PRINTF(("   tag .......... %d\n", pkt->rndv_req_to_send.match.parts.tag));
-            MPIU_DBG_PRINTF(("   rank ......... %d\n", pkt->rndv_req_to_send.match.parts.rank));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE,"  type .......... REQ_TO_SEND\n");
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   sender_reqid . 0x%08X\n", pkt->rndv_req_to_send.sender_req_id));
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   context_id ... %d\n",
+                           pkt->rndv_req_to_send.match.parts.context_id);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   data_sz ...... %d\n", pkt->rndv_req_to_send.data_sz);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   tag .......... %d\n", pkt->rndv_req_to_send.match.parts.tag);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   rank ......... %d\n", pkt->rndv_req_to_send.match.parts.rank);
 #ifdef MPID_USE_SEQUENCE_NUMBERS
-            MPIU_DBG_PRINTF(("   seqnum ....... %d\n", pkt->rndv_req_to_send.seqnum));
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   seqnum ....... %d\n", pkt->rndv_req_to_send.seqnum);
 #endif
-            MPIU_DBG_PRINTF(("  type .......... CLR_TO_SEND\n"));
-            MPIU_DBG_PRINTF(("   sender_reqid . 0x%08X\n", pkt->rndv_clr_to_send.sender_req_id));
-            MPIU_DBG_PRINTF(("   recvr_reqid .. 0x%08X\n", pkt->rndv_clr_to_send.receiver_req_id));
-            MPIU_DBG_PRINTF(("  type .......... RNDV_SEND\n"));
-            MPIU_DBG_PRINTF(("   recvr_reqid .. 0x%08X\n", pkt->rndv_send.receiver_req_id));
-            MPIU_DBG_PRINTF(("  type .......... CANCEL_SEND\n"));
-            MPIU_DBG_PRINTF(("   context_id ... %d\n",
-                             pkt->cancel_send_req.match.parts.context_id));
-            MPIU_DBG_PRINTF(("   tag .......... %d\n", pkt->cancel_send_req.match.parts.tag));
-            MPIU_DBG_PRINTF(("   rank ......... %d\n", pkt->cancel_send_req.match.parts.rank));
-            MPIU_DBG_PRINTF(("   sender_reqid . 0x%08X\n", pkt->cancel_send_req.sender_req_id));
-            MPIU_DBG_PRINTF(("  type .......... CANCEL_SEND_RESP\n"));
-            MPIU_DBG_PRINTF(("   sender_reqid . 0x%08X\n", pkt->cancel_send_resp.sender_req_id));
-            MPIU_DBG_PRINTF(("   ack .......... %d\n", pkt->cancel_send_resp.ack));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE,"  type .......... CLR_TO_SEND\n");
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   sender_reqid . 0x%08X\n", pkt->rndv_clr_to_send.sender_req_id));
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   recvr_reqid .. 0x%08X\n", pkt->rndv_clr_to_send.receiver_req_id));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE,"  type .......... RNDV_SEND\n");
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   recvr_reqid .. 0x%08X\n", pkt->rndv_send.receiver_req_id));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE,"  type .......... CANCEL_SEND\n");
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   context_id ... %d\n",
+                           pkt->cancel_send_req.match.parts.context_id);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   tag .......... %d\n", pkt->cancel_send_req.match.parts.tag);
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   rank ......... %d\n", pkt->cancel_send_req.match.parts.rank);
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   sender_reqid . 0x%08X\n", pkt->cancel_send_req.sender_req_id));
+            MPIU_DBG_MSG(CH3_OTHER,TERSE,"  type .......... CANCEL_SEND_RESP\n");
+            MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"   sender_reqid . 0x%08X\n", pkt->cancel_send_resp.sender_req_id));
+            MPIU_DBG_MSG_D(CH3_OTHER,TERSE,"   ack .......... %d\n", pkt->cancel_send_resp.ack);
             break;
         }
     }
diff --git a/src/mpid/ch3/util/sock/findinterfaces.c b/src/mpid/ch3/util/sock/findinterfaces.c
index aeaf09e..cd00c5b 100644
--- a/src/mpid/ch3/util/sock/findinterfaces.c
+++ b/src/mpid/ch3/util/sock/findinterfaces.c
@@ -37,7 +37,7 @@ static int GetLocalIPs(int32_t *pIP, int max)
 	b = ((unsigned char *)(&pIP[n]))[1];
 	c = ((unsigned char *)(&pIP[n]))[2];
 	d = ((unsigned char *)(&pIP[n]))[3];
-	MPIU_DBG_PRINTF(("ip: %u.%u.%u.%u\n", a, b, c, d));
+	MPIU_DBG_MSG_FMT(CH3_OTHER,TERSE,(MPIU_DBG_FDEST,"ip: %u.%u.%u.%u\n", a, b, c, d));
 	}*/
 
 	hlist++;
diff --git a/src/mpid/common/datatype/mpid_type_commit.c b/src/mpid/common/datatype/mpid_type_commit.c
index 28be988..de4580c 100644
--- a/src/mpid/common/datatype/mpid_type_commit.c
+++ b/src/mpid/common/datatype/mpid_type_commit.c
@@ -55,8 +55,8 @@ int MPID_Type_commit(MPI_Datatype *datatype_p)
 			     &datatype_ptr->hetero_dloop_depth,
 			     MPID_DATALOOP_HETEROGENEOUS);
 
-	MPIU_DBG_PRINTF(("# contig blocks = %d\n",
-			 (int) datatype_ptr->max_contig_blocks));
+	MPIU_DBG_MSG_D(DATATYPE,TERSE,"# contig blocks = %d\n",
+                       (int) datatype_ptr->max_contig_blocks);
 
 #if 0
         MPIDI_Dataloop_dot_printf(datatype_ptr->dataloop, 0, 1);
diff --git a/src/mpid/common/sock/iocp/sock.c b/src/mpid/common/sock/iocp/sock.c
index 754ba7f..7836448 100644
--- a/src/mpid/common/sock/iocp/sock.c
+++ b/src/mpid/common/sock/iocp/sock.c
@@ -692,7 +692,7 @@ int MPIDU_Sock_hostname_to_host_description(char *hostname, char *host_descripti
     iter = list;
     while (iter)
     {
-        MPIU_DBG_PRINTF(("adding host: %s\n", iter->host));
+        MPIU_DBG_MSG_S(OTHER,TERSE,"adding host: %s\n", iter->host);
         str_errno = MPIU_Str_add_string(&host_description, &len, iter->host);
         MPIR_ERR_CHKANDJUMP(str_errno, mpi_errno, MPIDU_SOCK_ERR_NOMEM, "**desc_len");
 
@@ -1412,13 +1412,13 @@ int MPIDU_Sock_post_close(MPIDU_Sock_t sock)
 	/*MPIU_Assert(sock->state != 0);*/ /* The state can be 0 if the operation was aborted */
 #ifdef MPICH_DBG_OUTPUT
 	if (sock->state & SOCKI_CONNECTING)
-	    MPIU_DBG_PRINTF(("sock_post_close(%d) called while sock is connecting.\n", MPIDU_Sock_get_sock_id(sock)));
+	    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_post_close(%d) called while sock is connecting.\n", MPIDU_Sock_get_sock_id(sock));
 	if (sock->state & SOCKI_READING)
 	{
 	    int i, n = 0;
 	    for (i=0; i<sock->read.iovlen; i++)
 		n += sock->read.iov[i].MPL_IOV_LEN;
-	    MPIU_DBG_PRINTF(("sock_post_close(%d) called while sock is reading: %d bytes out of %d, index %d, iovlen %d.\n",
+	    MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_post_close(%d) called while sock is reading: %d bytes out of %d, index %d, iovlen %d.\n",
 		MPIDU_Sock_get_sock_id(sock), sock->read.total, n, sock->read.index, sock->read.iovlen));
 	}
 	if (sock->state & SOCKI_WRITING)
@@ -1426,7 +1426,7 @@ int MPIDU_Sock_post_close(MPIDU_Sock_t sock)
 	    int i, n = 0;
 	    for (i=0; i<sock->write.iovlen; i++)
 		n += sock->write.iov[i].MPL_IOV_LEN;
-	    MPIU_DBG_PRINTF(("sock_post_close(%d) called while sock is writing: %d bytes out of %d, index %d, iovlen %d.\n",
+	    MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_post_close(%d) called while sock is writing: %d bytes out of %d, index %d, iovlen %d.\n",
 		MPIDU_Sock_get_sock_id(sock), sock->write.total, n, sock->write.index, sock->write.iovlen));
 	}
 	fflush(stdout);
@@ -1584,7 +1584,7 @@ int MPIDU_Sock_post_readv(MPIDU_Sock_t sock, MPL_IOV * iov, int iov_n, MPIDU_Soc
 #ifdef MPICH_DBG_OUTPUT
     for (i=0; i<iov_n; i++)
     {
-	MPIU_DBG_PRINTF(("sock_post_readv - iov[%d].len = %d\n", i, iov[i].MPL_IOV_LEN));
+	MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_post_readv - iov[%d].len = %d\n", i, iov[i].MPL_IOV_LEN));
     }
 #endif
     for (iter=0; iter<10; iter++)
@@ -1698,7 +1698,7 @@ int MPIDU_Sock_post_writev(MPIDU_Sock_t sock, MPL_IOV * iov, int iov_n, MPIDU_So
 #ifdef MPICH_DBG_OUTPUT
     for (i=0; i<iov_n; i++)
     {
-	MPIU_DBG_PRINTF(("sock_post_writev - iov[%d].len = %d\n", i, iov[i].MPL_IOV_LEN));
+	MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_post_writev - iov[%d].len = %d\n", i, iov[i].MPL_IOV_LEN));
     }
 #endif
     for (iter=0; iter<10; iter++)
@@ -1855,7 +1855,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			/*sock->rt2 = PMPI_Wtime();*/
 			/*printf("[%d] time from post_read  to op_read : %.3f - sock %d\n", getpid(), sock->rt2 - sock->rt1, sock->sock);*/
 			/* socket closed */
-			MPIU_DBG_PRINTF(("sock_wait readv returning %d bytes and EOF\n", sock->read.total));
+			MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait readv returning %d bytes and EOF\n", sock->read.total);
 			/*printf("sock_wait readv returning %d bytes and EOF\n", sock->read.total);*/
 			out->op_type = MPIDU_SOCK_OP_READ;
 			out->num_bytes = sock->read.total;
@@ -1865,7 +1865,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			sock->state &= ~SOCKI_READING; /* remove the SOCKI_READING bit */
 			if (sock->closing && sock->pending_operations == 0)
 			{
-			    MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock)));
+			    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock));
 			    FlushFileBuffers((HANDLE)sock->sock);
 			    if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 			    {
@@ -1887,7 +1887,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_WAIT);
 			return MPI_SUCCESS;
 		    }
-		    MPIU_DBG_PRINTF(("sock_wait readv update: %d bytes\n", num_bytes));
+		    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait readv update: %d bytes\n", num_bytes);
 		    sock->read.total += num_bytes;
 		    while (num_bytes)
 		    {
@@ -1909,7 +1909,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 		    {
 			/*sock->rt2 = PMPI_Wtime();*/
 			/*printf("[%d] time from post_read  to op_read : %.3f - sock %d\n", getpid(), sock->rt2 - sock->rt1, sock->sock);*/
-			MPIU_DBG_PRINTF(("sock_wait readv %d bytes\n", sock->read.total));
+			MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait readv %d bytes\n", sock->read.total);
 			out->op_type = MPIDU_SOCK_OP_READ;
 			out->num_bytes = sock->read.total;
 			out->error = MPI_SUCCESS;
@@ -1918,7 +1918,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			sock->state &= ~SOCKI_READING; /* remove the SOCKI_READING bit */
 			if (sock->closing && sock->pending_operations == 0)
 			{
-			    MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock)));
+			    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock));
 			    FlushFileBuffers((HANDLE)sock->sock);
 			    if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 			    {
@@ -1961,7 +1961,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    sock->state &= ~SOCKI_READING;
 			    if (sock->closing && sock->pending_operations == 0)
 			    {
-				MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock)));
+				MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock));
 				FlushFileBuffers((HANDLE)sock->sock);
 				if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 				{
@@ -2021,7 +2021,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    sock->state &= ~SOCKI_READING;
 			    if (sock->closing && sock->pending_operations == 0)
 			    {
-				MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock)));
+				MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock));
 				FlushFileBuffers((HANDLE)sock->sock);
 				if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 				{
@@ -2059,7 +2059,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			sock->state ^= SOCKI_CONNECTING; /* remove the SOCKI_CONNECTING bit */
 			if (sock->closing && sock->pending_operations == 0)
 			{
-			    MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after connect completed.\n", MPIDU_Sock_get_sock_id(sock)));
+			    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after connect completed.\n", MPIDU_Sock_get_sock_id(sock));
 			    FlushFileBuffers((HANDLE)sock->sock);
 			    if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 			    {
@@ -2088,7 +2088,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    /*sock->wt2 = PMPI_Wtime();*/
 			    /*printf("[%d] time from post_write to op_write: %.3f - sock %d\n", getpid(), sock->wt2 - sock->wt1, sock->sock);*/
 			    /* socket closed */
-			    MPIU_DBG_PRINTF(("sock_wait writev returning %d bytes and EOF\n", sock->write.total));
+			    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait writev returning %d bytes and EOF\n", sock->write.total);
 			    out->op_type = MPIDU_SOCK_OP_WRITE;
 			    out->num_bytes = sock->write.total;
 			    /*printf("sock_wait writev returning %d bytes and EOF\n", sock->write.total);*/
@@ -2098,7 +2098,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    sock->state &= ~SOCKI_WRITING; /* remove the SOCKI_WRITING bit */
 			    if (sock->closing && sock->pending_operations == 0)
 			    {
-				MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov write completed.\n", MPIDU_Sock_get_sock_id(sock)));
+				MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov write completed.\n", MPIDU_Sock_get_sock_id(sock));
 				FlushFileBuffers((HANDLE)sock->sock);
 				if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 				{
@@ -2120,13 +2120,13 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_WAIT);
 			    return MPI_SUCCESS;
 			}
-			MPIU_DBG_PRINTF(("sock_wait: write update, total = %d + %d = %d\n", sock->write.total, num_bytes, sock->write.total + num_bytes));
+			MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_wait: write update, total = %d + %d = %d\n", sock->write.total, num_bytes, sock->write.total + num_bytes));
 			sock->write.total += num_bytes;
 			while (num_bytes)
 			{
 			    if (sock->write.iov[sock->write.index].MPL_IOV_LEN <= num_bytes)
 			    {
-				/*MPIU_DBG_PRINTF(("sock_wait: write.index %d, len %d\n", sock->write.index, 
+				/*MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_wait: write.index %d, len %d\n", sock->write.index, 
 				sock->write.iov[sock->write.index].MPL_IOV_LEN));*/
 				num_bytes -= sock->write.iov[sock->write.index].MPL_IOV_LEN;
 				sock->write.index++;
@@ -2134,7 +2134,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    }
 			    else
 			    {
-				/*MPIU_DBG_PRINTF(("sock_wait: partial data written [%d].len = %d, num_bytes = %d\n", sock->write.index,
+				/*MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"sock_wait: partial data written [%d].len = %d, num_bytes = %d\n", sock->write.index,
 				sock->write.iov[sock->write.index].MPL_IOV_LEN, num_bytes));*/
 				sock->write.iov[sock->write.index].MPL_IOV_LEN -= num_bytes;
 				sock->write.iov[sock->write.index].MPL_IOV_BUF = (MPL_IOV_BUF_CAST)(
@@ -2148,7 +2148,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    /*printf("[%d] time from post_write to op_write: %.3f - sock %d\n", getpid(), sock->wt2 - sock->wt1, sock->sock);*/
 			    if (sock->write.total > 0)
 			    {
-				MPIU_DBG_PRINTF(("sock_wait wrotev %d bytes\n", sock->write.total));
+				MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait wrotev %d bytes\n", sock->write.total);
 			    }
 			    out->op_type = MPIDU_SOCK_OP_WRITE;
 			    out->num_bytes = sock->write.total;
@@ -2158,7 +2158,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    sock->state &= ~SOCKI_WRITING; /* remove the SOCKI_WRITING bit */
 			    if (sock->closing && sock->pending_operations == 0)
 			    {
-				MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov write completed.\n", MPIDU_Sock_get_sock_id(sock)));
+				MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov write completed.\n", MPIDU_Sock_get_sock_id(sock));
 				FlushFileBuffers((HANDLE)sock->sock);
 				if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 				{
@@ -2184,7 +2184,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			if (sock->write.progress_update != NULL)
 			    sock->write.progress_update(num_bytes, sock->user_ptr);
 			/* post a write of the remaining data */
-			MPIU_DBG_PRINTF(("sock_wait: posting write of the remaining data, vec size %d\n", sock->write.iovlen));
+			MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: posting write of the remaining data, vec size %d\n", sock->write.iovlen);
 			if (WSASend(sock->sock, sock->write.iov, sock->write.iovlen, &sock->write.num_bytes, 0, &sock->write.ovl, NULL) == SOCKET_ERROR)
 			{
 			    mpi_errno = WSAGetLastError();
@@ -2201,7 +2201,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 				sock->state &= ~SOCKI_WRITING;
 				if (sock->closing && sock->pending_operations == 0)
 				{
-				    MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock)));
+				    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock));
 				    FlushFileBuffers((HANDLE)sock->sock);
 				    if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 				    {
@@ -2258,7 +2258,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 				sock->state &= ~SOCKI_WRITING;
 				if (sock->closing && sock->pending_operations == 0)
 				{
-				    MPIU_DBG_PRINTF(("sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock)));
+				    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_wait: closing socket(%d) after iov read completed.\n", MPIDU_Sock_get_sock_id(sock));
 				    FlushFileBuffers((HANDLE)sock->sock);
 				    if (shutdown(sock->sock, SD_BOTH) == SOCKET_ERROR)
 				    {
@@ -2291,7 +2291,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			{
 			    /*sock->rt2 = PMPI_Wtime();*/
 			    /*printf("[%d] time from post_read  to op_read : %.3f - sock %d\n", getpid(), sock->rt2 - sock->rt1, sock->sock);*/
-			    MPIU_DBG_PRINTF(("EOF with posted read on sock %d\n", sock->sock));
+			    MPIU_DBG_MSG_D(OTHER,TERSE,"EOF with posted read on sock %d\n", sock->sock);
 			    out->op_type = MPIDU_SOCK_OP_READ;
 			    out->num_bytes = sock->read.total;
 			    /*printf("sock_wait returning %d bytes and EOF\n", sock->read.total);*/
@@ -2306,7 +2306,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			{
 			    /*sock->wt2 = PMPI_Wtime();*/
 			    /*printf("[%d] time from post_write to op_write: %.3f - sock %d\n", getpid(), sock->wt2 - sock->wt1, sock->sock);*/
-			    MPIU_DBG_PRINTF(("EOF with posted write on sock %d\n", sock->sock));
+			    MPIU_DBG_MSG_D(OTHER,TERSE,"EOF with posted write on sock %d\n", sock->sock);
 			    out->op_type = MPIDU_SOCK_OP_WRITE;
 			    out->num_bytes = sock->write.total;
 			    /*printf("sock_wait returning %d bytes and EOF\n", sock->write.total);*/
@@ -2317,12 +2317,12 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 			    MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_WAIT);
 			    return MPI_SUCCESS;
 			}
-			MPIU_DBG_PRINTF(("ignoring EOF notification on unknown sock %d.\n", MPIDU_Sock_get_sock_id(sock)));
+			MPIU_DBG_MSG_D(OTHER,TERSE,"ignoring EOF notification on unknown sock %d.\n", MPIDU_Sock_get_sock_id(sock));
 		    }
 
 		    if (sock->sock != INVALID_SOCKET)
 		    {
-			MPIU_DBG_PRINTF(("unmatched ovl: pending: %d, state = %d\n", sock->pending_operations, sock->state));
+			MPIU_DBG_MSG_FMT(OTHER,TERSE,(MPIU_DBG_FDEST,"unmatched ovl: pending: %d, state = %d\n", sock->pending_operations, sock->state));
 			/*MPL_error_printf("In sock_wait(), returned overlapped structure does not match the current read or write ovl: 0x%x\n", ovl);*/
 			MPL_snprintf(error_msg, 1024, "In sock_wait(), returned overlapped structure does not match the current read or write ovl: 0x%p\n", ovl);
 			MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_WAIT);
@@ -2330,7 +2330,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 		    }
 		    else
 		    {
-			MPIU_DBG_PRINTF(("ignoring notification on invalid sock.\n"));
+			MPIU_DBG_MSG(OTHER,TERSE,"ignoring notification on invalid sock.\n");
 		    }
 		}
 	    }
@@ -2528,13 +2528,13 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 		    continue;
 		}
 	    }
-	    MPIU_DBG_PRINTF(("GetQueuedCompletionStatus failed, GetLastError: %d\n", mpi_errno));
+	    MPIU_DBG_MSG_D(OTHER,TERSE,"GetQueuedCompletionStatus failed, GetLastError: %d\n", mpi_errno);
 	    if (sock != NULL)
 	    {
-		MPIU_DBG_PRINTF(("GetQueuedCompletionStatus failed, sock != null\n"));
+		MPIU_DBG_MSG(OTHER,TERSE,"GetQueuedCompletionStatus failed, sock != null\n");
 		if (sock->type == SOCKI_SOCKET)
 		{
-		    MPIU_DBG_PRINTF(("GetQueuedCompletionStatus failed, sock == SOCKI_SOCKET \n"));
+		    MPIU_DBG_MSG(OTHER,TERSE,"GetQueuedCompletionStatus failed, sock == SOCKI_SOCKET \n");
 		    if (sock->closing)
 		    {
 			/*sock->ct2 = PMPI_Wtime();*/
@@ -2585,7 +2585,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 		}
 		if (sock->type == SOCKI_LISTENER)
 		{
-		    MPIU_DBG_PRINTF(("GetQueuedCompletionStatus failed, sock == SOCKI_LISTENER \n"));
+		    MPIU_DBG_MSG(OTHER,TERSE,"GetQueuedCompletionStatus failed, sock == SOCKI_LISTENER \n");
 		    /* this only works if the aborted operation is reported before the close is reported
 		       because the close will free the sock structure causing these dereferences bogus.
 		       I need to reference count the sock */
@@ -2730,7 +2730,7 @@ int MPIDU_Sock_readv(MPIDU_Sock_t sock, MPL_IOV * iov, int iov_n, MPIU_Size_t *
     {
 	*num_read = num_read_local;
     }
-    MPIU_DBG_PRINTF(("sock_readv %d bytes\n", *num_read));
+    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_readv %d bytes\n", *num_read);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_READV);
     return mpi_errno;
 }
@@ -2794,7 +2794,7 @@ int MPIDU_Sock_writev(MPIDU_Sock_t sock, MPL_IOV * iov, int iov_n, MPIU_Size_t *
 	}
 	if (mpi_errno && (mpi_errno != WSAEWOULDBLOCK))
 	{
-	    MPIU_DBG_PRINTF(("WSASend failed: error %d\n", mpi_errno));
+	    MPIU_DBG_MSG_D(OTHER,TERSE,"WSASend failed: error %d\n", mpi_errno);
 	    mpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPIDU_SOCK_ERR_FAIL, "**fail", "**fail %s %d", get_error_string(mpi_errno), mpi_errno);
 	    MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_WRITEV);
 	    return mpi_errno;
@@ -2804,7 +2804,7 @@ int MPIDU_Sock_writev(MPIDU_Sock_t sock, MPL_IOV * iov, int iov_n, MPIU_Size_t *
     {
 	*num_written = num_written_local;
     }
-    MPIU_DBG_PRINTF(("sock_writev %d bytes\n", *num_written));
+    MPIU_DBG_MSG_D(OTHER,TERSE,"sock_writev %d bytes\n", *num_written);
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_SOCK_WRITEV);
     return MPI_SUCCESS;

http://git.mpich.org/mpich.git/commitdiff/bfa97a383f3765a6d5b0cc28a7aecb1c094e6d1f

commit bfa97a383f3765a6d5b0cc28a7aecb1c094e6d1f
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 18:49:50 2015 -0600

    mpidbg: move from the old debug format to the new format.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpid/common/datatype/dataloop/dataloop.c b/src/mpid/common/datatype/dataloop/dataloop.c
index 2cca5b9..6cb0841 100644
--- a/src/mpid/common/datatype/dataloop/dataloop.c
+++ b/src/mpid/common/datatype/dataloop/dataloop.c
@@ -63,8 +63,8 @@ void PREPEND_PREFIX(Dataloop_free)(DLOOP_Dataloop **dataloop)
     if (*dataloop == NULL) return;
 
 #ifdef DLOOP_DEBUG_MEMORY
-    DLOOP_dbg_printf("DLOOP_Dataloop_free: freeing loop @ %x.\n",
-		     (int) *dataloop);
+    MPIU_DBG_MSG_D(DATATYPE,VERBOSE,"DLOOP_Dataloop_free: freeing loop @ %x.\n",
+                   (int) *dataloop);
 #endif
 
     memset(*dataloop, 0, sizeof(DLOOP_Dataloop_common));
@@ -102,8 +102,8 @@ void PREPEND_PREFIX(Dataloop_copy)(void *dest,
     DLOOP_Offset ptrdiff;
 
 #ifdef DLOOP_DEBUG_MEMORY
-    DLOOP_dbg_printf("DLOOP_Dataloop_copy: copying from %x to %x (%z bytes).\n",
-		     (int) src, (int) dest, (size_t)size);
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"DLOOP_Dataloop_copy: copying from %x to %x (%z bytes).\n",
+                                       (int) src, (int) dest, (size_t)size));
 #endif
 
     /* copy region first */
@@ -386,7 +386,7 @@ void PREPEND_PREFIX(Dataloop_alloc_and_copy)(int kind,
     }
 
 #ifdef DLOOP_DEBUG_MEMORY
-    DLOOP_dbg_printf("DLOOP_Dataloop_alloc_and_copy: new loop @ %x (tot sz = %z, loop = %z, off = %z, blk = %z, ptr = %z, extent = %z, old = %z)\n",
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"DLOOP_Dataloop_alloc_and_copy: new loop @ %x (tot sz = %z, loop = %z, off = %z, blk = %z, ptr = %z, extent = %z, old = %z)\n",
 		     (int) new_loop,
 		     new_loop_sz,
 		     loop_sz,
@@ -394,7 +394,7 @@ void PREPEND_PREFIX(Dataloop_alloc_and_copy)(int kind,
 		     blk_sz,
 		     ptr_sz,
 		     extent_sz,
-		     old_loop_sz);
+                     old_loop_sz));
 #endif
 
     /* set all the pointers in the new dataloop structure */
@@ -567,7 +567,7 @@ void PREPEND_PREFIX(Dataloop_struct_alloc)(DLOOP_Count count,
     }
 
 #ifdef DLOOP_DEBUG_MEMORY
-    DLOOP_dbg_printf("DLOOP_Dataloop_struct_alloc: new loop @ %x (tot sz = %z, loop = %z, off = %z, blk = %z, ptr = %z, extent = %z, basics = %z, old = %z)\n",
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"DLOOP_Dataloop_struct_alloc: new loop @ %x (tot sz = %z, loop = %z, off = %z, blk = %z, ptr = %z, extent = %z, basics = %z, old = %z)\n",
 		     (int) new_loop,
 		     new_loop_sz,
 		     loop_sz,
@@ -576,7 +576,7 @@ void PREPEND_PREFIX(Dataloop_struct_alloc)(DLOOP_Count count,
 		     ptr_sz,
 		     extent_sz,
 		     basic_sz,
-		     old_loop_sz);
+                     old_loop_sz));
 #endif
 
     /* set all the pointers in the new dataloop structure */
@@ -656,36 +656,36 @@ PREPEND_PREFIX(Dataloop_stream_size)(struct DLOOP_Dataloop *dl_p,
         case DLOOP_KIND_CONTIG:
             tmp_ct *= (DLOOP_Offset)(dl_p->loop_params.c_t.count);
 #ifdef DLOOP_DEBUG_SIZE
-            DLOOP_dbg_printf("stream_size: contig: ct = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
-                             (int) dl_p->loop_params.c_t.count, (DLOOP_Offset) tmp_ct);
+            MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"stream_size: contig: ct = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+                                               (int) dl_p->loop_params.c_t.count, (DLOOP_Offset) tmp_ct));
 #endif
             break;
         case DLOOP_KIND_VECTOR:
             tmp_ct *= (DLOOP_Offset)(dl_p->loop_params.v_t.count) *
 		      (DLOOP_Offset)(dl_p->loop_params.v_t.blocksize);
 #ifdef DLOOP_DEBUG_SIZE
-            DLOOP_dbg_printf("stream_size: vector: ct = %d; blk = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+            MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"stream_size: vector: ct = %d; blk = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
                              (int) dl_p->loop_params.v_t.count,
                              (int) dl_p->loop_params.v_t.blocksize,
-                             (DLOOP_Offset) tmp_ct);
+                             (DLOOP_Offset) tmp_ct));
 #endif
             break;
         case DLOOP_KIND_BLOCKINDEXED:
             tmp_ct *= (DLOOP_Offset)(dl_p->loop_params.bi_t.count) *
 		      (DLOOP_Offset)(dl_p->loop_params.bi_t.blocksize);
 #ifdef DLOOP_DEBUG_SIZE
-            DLOOP_dbg_printf("stream_size: blkindexed: blks = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+            MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"stream_size: blkindexed: blks = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
                              (int) dl_p->loop_params.bi_t.count *
                              (int) dl_p->loop_params.bi_t.blocksize,
-                             (DLOOP_Offset) tmp_ct);
+                             (DLOOP_Offset) tmp_ct));
 #endif
             break;
         case DLOOP_KIND_INDEXED:
             tmp_ct *= (DLOOP_Offset)(dl_p->loop_params.i_t.total_blocks);
 #ifdef DLOOP_DEBUG_SIZE
-            DLOOP_dbg_printf("stream_size: contig: blks = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+            MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"stream_size: contig: blks = %d; new tot_ct = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
                              (int) dl_p->loop_params.i_t.total_blocks,
-                             (DLOOP_Offset) tmp_ct);
+                             (DLOOP_Offset) tmp_ct));
 #endif
             break;
         default:
@@ -724,57 +724,57 @@ void PREPEND_PREFIX(Dataloop_print)(struct DLOOP_Dataloop *dataloop,
 
     if (dataloop == NULL)
     {
-        DLOOP_dbg_printf("dataloop is NULL (probably basic type)\n");
+        MPIU_DBG_MSG(DATATYPE,VERBOSE,"dataloop is NULL (probably basic type)\n");
         return;
     }
 
-    DLOOP_dbg_printf("loc=%p, treedepth=%d, kind=%d, el_extent=" DLOOP_OFFSET_FMT_DEC_SPEC "\n",
-		     dataloop, (int) depth, (int) dataloop->kind, (DLOOP_Offset) dataloop->el_extent);
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"loc=%p, treedepth=%d, kind=%d, el_extent=" DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+                                       dataloop, (int) depth, (int) dataloop->kind, (DLOOP_Offset) dataloop->el_extent));
     switch(dataloop->kind & DLOOP_KIND_MASK) {
 	case DLOOP_KIND_CONTIG:
-	    DLOOP_dbg_printf("\tCONTIG: count=%d, datatype=%p\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tCONTIG: count=%d, datatype=%p\n",
 			     (int) dataloop->loop_params.c_t.count,
-			     dataloop->loop_params.c_t.dataloop);
+                             dataloop->loop_params.c_t.dataloop));
 	    if (!(dataloop->kind & DLOOP_FINAL_MASK))
 		PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.c_t.dataloop, depth+1);
 	    break;
 	case DLOOP_KIND_VECTOR:
-	    DLOOP_dbg_printf("\tVECTOR: count=%d, blksz=%d, stride=" DLOOP_OFFSET_FMT_DEC_SPEC ", datatype=%p\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tVECTOR: count=%d, blksz=%d, stride=" DLOOP_OFFSET_FMT_DEC_SPEC ", datatype=%p\n",
 			     (int) dataloop->loop_params.v_t.count,
 			     (int) dataloop->loop_params.v_t.blocksize,
 			     (DLOOP_Offset) dataloop->loop_params.v_t.stride,
-			     dataloop->loop_params.v_t.dataloop);
+                             dataloop->loop_params.v_t.dataloop));
 	    if (!(dataloop->kind & DLOOP_FINAL_MASK))
 		PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.v_t.dataloop, depth+1);
 	    break;
 	case DLOOP_KIND_BLOCKINDEXED:
-	    DLOOP_dbg_printf("\tBLOCKINDEXED: count=%d, blksz=%d, datatype=%p\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tBLOCKINDEXED: count=%d, blksz=%d, datatype=%p\n",
 			     (int) dataloop->loop_params.bi_t.count,
 			     (int) dataloop->loop_params.bi_t.blocksize,
-			     dataloop->loop_params.bi_t.dataloop);
+                             dataloop->loop_params.bi_t.dataloop));
 	    /* print out offsets later */
 	    if (!(dataloop->kind & DLOOP_FINAL_MASK))
 		PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.bi_t.dataloop, depth+1);
 	    break;
 	case DLOOP_KIND_INDEXED:
-	    DLOOP_dbg_printf("\tINDEXED: count=%d, datatype=%p\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tINDEXED: count=%d, datatype=%p\n",
 			     (int) dataloop->loop_params.i_t.count,
-			     dataloop->loop_params.i_t.dataloop);
+                             dataloop->loop_params.i_t.dataloop));
 	    /* print out blocksizes and offsets later */
 	    if (!(dataloop->kind & DLOOP_FINAL_MASK))
 		PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.i_t.dataloop, depth+1);
 	    break;
 	case DLOOP_KIND_STRUCT:
-	    DLOOP_dbg_printf("\tSTRUCT: count=%d\n", (int) dataloop->loop_params.s_t.count);
-	    DLOOP_dbg_printf("\tblocksizes:\n");
+	    MPIU_DBG_MSG_D(DATATYPE,VERBOSE,"\tSTRUCT: count=%d\n", (int) dataloop->loop_params.s_t.count);
+	    MPIU_DBG_MSG(DATATYPE,VERBOSE,"\tblocksizes:\n");
 	    for (i=0; i < dataloop->loop_params.s_t.count; i++)
-		DLOOP_dbg_printf("\t\t%d\n", (int) dataloop->loop_params.s_t.blocksize_array[i]);
-	    DLOOP_dbg_printf("\toffsets:\n");
+		MPIU_DBG_MSG_D(DATATYPE,VERBOSE,"\t\t%d\n", (int) dataloop->loop_params.s_t.blocksize_array[i]);
+	    MPIU_DBG_MSG(DATATYPE,VERBOSE,"\toffsets:\n");
 	    for (i=0; i < dataloop->loop_params.s_t.count; i++)
-		DLOOP_dbg_printf("\t\t" DLOOP_OFFSET_FMT_DEC_SPEC "\n", (DLOOP_Offset) dataloop->loop_params.s_t.offset_array[i]);
-	    DLOOP_dbg_printf("\tdatatypes:\n");
+		MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\t\t" DLOOP_OFFSET_FMT_DEC_SPEC "\n", (DLOOP_Offset) dataloop->loop_params.s_t.offset_array[i]));
+	    MPIU_DBG_MSG(DATATYPE,VERBOSE,"\tdatatypes:\n");
 	    for (i=0; i < dataloop->loop_params.s_t.count; i++)
-		DLOOP_dbg_printf("\t\t%p\n", dataloop->loop_params.s_t.dataloop_array[i]);
+		MPIU_DBG_MSG_P(DATATYPE,VERBOSE,"\t\t%p\n", dataloop->loop_params.s_t.dataloop_array[i]);
 	    if (dataloop->kind & DLOOP_FINAL_MASK) break;
 
 	    for (i=0; i < dataloop->loop_params.s_t.count; i++) {
diff --git a/src/mpid/common/datatype/dataloop/segment.c b/src/mpid/common/datatype/dataloop/segment.c
index 5408135..2c23c1c 100644
--- a/src/mpid/common/datatype/dataloop/segment.c
+++ b/src/mpid/common/datatype/dataloop/segment.c
@@ -64,9 +64,8 @@ int PREPEND_PREFIX(Segment_init)(const DLOOP_Buffer buf,
 		 flag == DLOOP_DATALOOP_ALL_BYTES);
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-    DLOOP_dbg_printf("DLOOP_Segment_init: count = %d, buf = %x\n",
-		    count,
-		    buf);
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"DLOOP_Segment_init: count = %d, buf = %x\n",
+		    count, buf));
 #endif
 
     if (!DLOOP_Handle_hasloop_macro(handle)) {
@@ -372,15 +371,14 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 
     if (first == *lastp) {
 	/* nothing to do */
-	DLOOP_dbg_printf("dloop_segment_manipulate: warning: first == last (" DLOOP_OFFSET_FMT_DEC_SPEC ")\n", first);
+	MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"dloop_segment_manipulate: warning: first == last (" DLOOP_OFFSET_FMT_DEC_SPEC ")\n", first));
 	return;
     }
 
     /* first we ensure that stream_off and first are in the same spot */
     if (first != stream_off) {
 #ifdef DLOOP_DEBUG_MANIPULATE
-	DLOOP_dbg_printf("first=" DLOOP_OFFSET_FMT_DEC_SPEC "; stream_off=" DLOOP_OFFSET_FMT_DEC_SPEC "; resetting.\n",
-			 first, stream_off);
+	MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"first=" DLOOP_OFFSET_FMT_DEC_SPEC "; stream_off=" DLOOP_OFFSET_FMT_DEC_SPEC "; resetting.\n", first, stream_off));
 #endif
 
 	if (first < stream_off) {
@@ -413,16 +411,16 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	DLOOP_SEGMENT_LOAD_LOCAL_VALUES;
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-	DLOOP_dbg_printf("done repositioning stream_off; first=" DLOOP_OFFSET_FMT_DEC_SPEC ", stream_off=" DLOOP_OFFSET_FMT_DEC_SPEC ", last=" DLOOP_OFFSET_FMT_DEC_SPEC "\n",
-		   first, stream_off, last);
+	MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"done repositioning stream_off; first=" DLOOP_OFFSET_FMT_DEC_SPEC ", stream_off=" DLOOP_OFFSET_FMT_DEC_SPEC ", last=" DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+                                           first, stream_off, last));
 #endif
     }
 
     for (;;) {
 #ifdef DLOOP_DEBUG_MANIPULATE
 #if 0
-        DLOOP_dbg_printf("looptop; cur_sp=%d, cur_elmp=%x\n",
-			 cur_sp, (unsigned) cur_elmp);
+        MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"looptop; cur_sp=%d, cur_elmp=%x\n",
+                                           cur_sp, (unsigned) cur_elmp));
 #endif
 #endif
 
@@ -498,9 +496,9 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	    }
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-	    DLOOP_dbg_printf("\thit leaf; cur_sp=%d, elmp=%x, piece_sz=" DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\thit leaf; cur_sp=%d, elmp=%x, piece_sz=" DLOOP_OFFSET_FMT_DEC_SPEC "\n",
 			     cur_sp,
-		             (unsigned) cur_elmp, myblocks * local_el_size);
+                             (unsigned) cur_elmp, myblocks * local_el_size));
 #endif
 
 	    /* enforce the last parameter if necessary by reducing myblocks */
@@ -509,9 +507,9 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	    {
 		myblocks = ((last - stream_off) / stream_el_size);
 #ifdef DLOOP_DEBUG_MANIPULATE
-		DLOOP_dbg_printf("\tpartial block count=" DLOOP_OFFSET_FMT_DEC_SPEC " (" DLOOP_OFFSET_FMT_DEC_SPEC " bytes)\n",
+		MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tpartial block count=" DLOOP_OFFSET_FMT_DEC_SPEC " (" DLOOP_OFFSET_FMT_DEC_SPEC " bytes)\n",
 				 myblocks,
-                                 myblocks * stream_el_size);
+                                 myblocks * stream_el_size));
 #endif
 		if (myblocks == 0) {
 		    DLOOP_SEGMENT_SAVE_LOCAL_VALUES;
@@ -524,7 +522,7 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 		case PF_NULL:
 		    piecefn_indicated_exit = 0;
 #ifdef DLOOP_DEBUG_MANIPULATE
-		    DLOOP_dbg_printf("\tNULL piecefn for this piece\n");
+		    MPIU_DBG_MSG("\tNULL piecefn for this piece\n");
 #endif
 		    break;
 		case PF_CONTIG:
@@ -697,8 +695,8 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	} /* end of if leaf */
 	else if (cur_elmp->curblock == 0) {
 #ifdef DLOOP_DEBUG_MANIPULATE
-	    DLOOP_dbg_printf("\thit end of block; elmp=%x [%d]\n",
-			    (unsigned) cur_elmp, cur_sp);
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\thit end of block; elmp=%x [%d]\n",
+                                               (unsigned) cur_elmp, cur_sp));
 #endif
 	    cur_elmp->curcount--;
 
@@ -728,8 +726,8 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 
 	    if (cur_elmp->curcount == 0) {
 #ifdef DLOOP_DEBUG_MANIPULATE
-		DLOOP_dbg_printf("\talso hit end of count; elmp=%x [%d]\n",
-				(unsigned) cur_elmp, cur_sp);
+		MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\talso hit end of count; elmp=%x [%d]\n",
+                                                   (unsigned) cur_elmp, cur_sp));
 #endif
 		DLOOP_SEGMENT_POP_AND_MAYBE_EXIT;
 	    }
@@ -764,10 +762,10 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 		}
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-		DLOOP_dbg_printf("\tloading dlp=%x, elmp=%x [%d]\n",
+		MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tloading dlp=%x, elmp=%x [%d]\n",
 				 (unsigned) load_dlp,
 				 (unsigned) next_elmp,
-				 cur_sp+1);
+                                 cur_sp+1));
 #endif
 
 		DLOOP_Stackelm_load(next_elmp,
@@ -776,9 +774,9 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	    }
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-	    DLOOP_dbg_printf("\tpushing type, elmp=%x [%d], count=%d, block=%d\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tpushing type, elmp=%x [%d], count=%d, block=%d\n",
 			    (unsigned) cur_elmp, cur_sp, count_index,
-			     block_index);
+                            block_index));
 #endif
 	    /* set orig_offset and all cur values for new stackelm.
 	     * this is done in two steps: first set orig_offset based on
@@ -819,9 +817,9 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	    }
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-	    DLOOP_dbg_printf("\tstep 1: next orig_offset = " DLOOP_OFFSET_FMT_DEC_SPEC " (0x" DLOOP_OFFSET_FMT_HEX_SPEC ")\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tstep 1: next orig_offset = " DLOOP_OFFSET_FMT_DEC_SPEC " (0x" DLOOP_OFFSET_FMT_HEX_SPEC ")\n",
 			     next_elmp->orig_offset,
-			     next_elmp->orig_offset);
+                             next_elmp->orig_offset));
 #endif
 
 	    switch (next_elmp->loop_p->kind & DLOOP_KIND_MASK) {
@@ -859,9 +857,9 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
 	    }
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-	    DLOOP_dbg_printf("\tstep 2: next curoffset = " DLOOP_OFFSET_FMT_DEC_SPEC " (0x" DLOOP_OFFSET_FMT_HEX_SPEC ")\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\tstep 2: next curoffset = " DLOOP_OFFSET_FMT_DEC_SPEC " (0x" DLOOP_OFFSET_FMT_HEX_SPEC ")\n",
 			     next_elmp->curoffset,
-			     next_elmp->curoffset);
+                             next_elmp->curoffset));
 #endif
 
 	    cur_elmp->curblock--;
@@ -870,7 +868,7 @@ void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp,
     } /* end of for (;;) */
 
 #ifdef DLOOP_DEBUG_MANIPULATE
-    DLOOP_dbg_printf("hit end of datatype\n");
+    MPIU_DBG_MSG("hit end of datatype\n");
 #endif
 
     DLOOP_SEGMENT_SAVE_LOCAL_VALUES;
diff --git a/src/mpid/common/datatype/dataloop/segment_count.c b/src/mpid/common/datatype/dataloop/segment_count.c
index ee8ea82..fd51d4b 100644
--- a/src/mpid/common/datatype/dataloop/segment_count.c
+++ b/src/mpid/common/datatype/dataloop/segment_count.c
@@ -103,10 +103,10 @@ static int DLOOP_Leaf_contig_count_block(DLOOP_Offset *blocks_p,
     size = *blocks_p * el_size;
 
 #ifdef MPID_SP_VERBOSE
-    MPIU_dbg_printf("contig count block: count = %d, buf+off = %d, lastloc = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"contig count block: count = %d, buf+off = %d, lastloc = " DLOOP_OFFSET_FMT_DEC_SPEC "\n",
 		    (int) paramp->count,
 		    (int) ((char *) bufp + rel_off),
-		    paramp->last_loc);
+                    paramp->last_loc));
 #endif
 
     if (paramp->count > 0 && rel_off == paramp->last_loc)
diff --git a/src/mpid/common/datatype/dataloop/segment_flatten.c b/src/mpid/common/datatype/dataloop/segment_flatten.c
index 0a035ec..dc1427e 100644
--- a/src/mpid/common/datatype/dataloop/segment_flatten.c
+++ b/src/mpid/common/datatype/dataloop/segment_flatten.c
@@ -236,9 +236,9 @@ static int DLOOP_Leaf_vector_mpi_flatten(DLOOP_Offset *blocks_p,
 	     */
 	    *blocks_p -= (blocks_left + (size / el_size));
 #ifdef MPID_SP_VERBOSE
-	    MPIU_dbg_printf("\t[vector to vec exiting (1): next ind = %d, " DLOOP_OFFSET_FMT_DEC_SPEC " blocks processed.\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\t[vector to vec exiting (1): next ind = %d, " DLOOP_OFFSET_FMT_DEC_SPEC " blocks processed.\n",
 			    paramp->u.pack_vector.index,
-			    *blocks_p);
+                            *blocks_p));
 #endif
 	    return 1;
 	}
@@ -261,9 +261,9 @@ static int DLOOP_Leaf_vector_mpi_flatten(DLOOP_Offset *blocks_p,
     }
 
 #ifdef MPID_SP_VERBOSE
-    MPIU_dbg_printf("\t[vector to vec exiting (2): next ind = %d, " DLOOP_OFFSET_FMT_DEC_SPEC " blocks processed.\n",
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\t[vector to vec exiting (2): next ind = %d, " DLOOP_OFFSET_FMT_DEC_SPEC " blocks processed.\n",
 		    paramp->u.pack_vector.index,
-		    *blocks_p);
+                    *blocks_p));
 #endif
 
     /* if we get here then we processed ALL the blocks; don't need to update
diff --git a/src/mpid/common/datatype/mpid_dataloop.h b/src/mpid/common/datatype/mpid_dataloop.h
index 7ff7c94..e2b150e 100644
--- a/src/mpid/common/datatype/mpid_dataloop.h
+++ b/src/mpid/common/datatype/mpid_dataloop.h
@@ -80,9 +80,6 @@
 #define DLOOP_Malloc MPIU_Malloc
 #define DLOOP_Free   MPIU_Free
 
-/* debugging output function */
-#define DLOOP_dbg_printf MPIU_dbg_printf
-
 /* assert function */
 #define DLOOP_Assert MPIU_Assert
 
diff --git a/src/mpid/common/datatype/mpid_segment.c b/src/mpid/common/datatype/mpid_segment.c
index 027f47d..62f6515 100644
--- a/src/mpid/common/datatype/mpid_segment.c
+++ b/src/mpid/common/datatype/mpid_segment.c
@@ -357,9 +357,9 @@ static int MPID_Segment_vector_pack_to_iov(DLOOP_Offset *blocks_p,
 	     */
 	    *blocks_p -= (blocks_left + (size / basic_size));
 #ifdef MPID_SP_VERBOSE
-	    MPIU_dbg_printf("\t[vector to vec exiting (1): next ind = %d, " MPI_AINT_FMT_DEC_SPEC " blocks processed.\n",
+	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\t[vector to vec exiting (1): next ind = %d, " MPI_AINT_FMT_DEC_SPEC " blocks processed.\n",
 			    paramp->u.pack_vector.index,
-			    (MPI_Aint) *blocks_p);
+                            (MPI_Aint) *blocks_p));
 #endif
 	    MPIDI_FUNC_EXIT(MPID_STATE_MPID_SEGMENT_VECTOR_PACK_TO_IOV);
 	    return 1;
@@ -381,9 +381,9 @@ static int MPID_Segment_vector_pack_to_iov(DLOOP_Offset *blocks_p,
     }
 
 #ifdef MPID_SP_VERBOSE
-    MPIU_dbg_printf("\t[vector to vec exiting (2): next ind = %d, " MPI_AINT_FMT_DEC_SPEC " blocks processed.\n",
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\t[vector to vec exiting (2): next ind = %d, " MPI_AINT_FMT_DEC_SPEC " blocks processed.\n",
 		    paramp->u.pack_vector.index,
-		    (MPI_Aint) *blocks_p);
+                    (MPI_Aint) *blocks_p));
 #endif
 
     /* if we get here then we processed ALL the blocks; don't need to update
@@ -420,12 +420,12 @@ static int MPID_Segment_contig_flatten(DLOOP_Offset *blocks_p,
     idx = paramp->u.flatten.index;
 
 #ifdef MPID_SP_VERBOSE
-    MPIU_dbg_printf("\t[contig flatten: idx = %d, loc = (" MPI_AINT_FMT_HEX_SPEC " + " MPI_AINT_FMT_HEX_SPEC ") = " MPI_AINT_FMT_HEX_SPEC ", size = " MPI_AINT_FMT_DEC_SPEC "]\n",
+    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,"\t[contig flatten: idx = %d, loc = (" MPI_AINT_FMT_HEX_SPEC " + " MPI_AINT_FMT_HEX_SPEC ") = " MPI_AINT_FMT_HEX_SPEC ", size = " MPI_AINT_FMT_DEC_SPEC "]\n",
 		    idx,
 		    MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp,
 		    (MPI_Aint) rel_off,
 		    MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off,
-		    (MPI_Aint) size);
+                    (MPI_Aint) size));
 #endif
 
     if (idx > 0 && ((DLOOP_Offset) MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off) ==

http://git.mpich.org/mpich.git/commitdiff/d7d397e98064ee65f217dcb448cb659decbec94c

commit d7d397e98064ee65f217dcb448cb659decbec94c
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 15:56:02 2015 -0600

    mpidbg: remove unused memlog functions.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index fc2cf60..a911c32 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -7,10 +7,7 @@
 /*
  * This file provides a set of routines that can be used to record debug
  * messages in a ring so that the may be dumped at a later time.  For example,
- * this can be used to record debug messages without printing them; when
- * a special event, such as an error occurs, a call to 
- * MPIU_dump_dbg_memlog( stderr ) will print the contents of the file ring
- * to stderr.
+ * this can be used to record debug messages without printing them.
  */
 
 #include "mpiimpl.h"
@@ -325,43 +322,6 @@ int MPIU_dbg_printf(const char * str, ...)
     return n;
 }
 
-void MPIU_dump_dbg_memlog_to_stdout(void)
-{
-    MPIU_dump_dbg_memlog(stdout);
-}
-
-void MPIU_dump_dbg_memlog_to_file(const char *filename)
-{
-    FILE *fout;
-    fout = fopen(filename, "wb");
-    if (fout != NULL)
-    {
-	MPIU_dump_dbg_memlog(fout);
-	fclose(fout);
-    }
-}
-
-void MPIU_dump_dbg_memlog(FILE * fp){
-    if (dbg_memlog_count != 0)
-    {
-	int ent;
-	int last_ent;
-
-	/* there is a small issue with counter rollover which will need to be
-	   fixed if more than 2^32 lines are going to be logged */
-	ent = (dbg_memlog_next == dbg_memlog_count) ? 0 : dbg_memlog_next;
-	last_ent = (ent + dbg_memlog_num_lines - 1) % dbg_memlog_num_lines;
-	
-	do
-	{
-	    fputs(dbg_memlog[ent], fp);
-	    ent = (ent + 1) % dbg_memlog_num_lines;
-	}
-	while(ent != last_ent);
-	fflush(fp);
-    }
-}
-
 #ifdef USE_DBG_LOGGING
 /* 
  * NEW ROUTINES FOR DEBUGGING
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 834ecf3..aec2981 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -122,9 +122,6 @@ int MPIU_dbg_init(int rank);
 int MPIU_dbg_printf(const char *str, ...) ATTRIBUTE((format(printf,1,2)));
 int MPIU_dbglog_printf(const char *str, ...) ATTRIBUTE((format(printf,1,2)));
 int MPIU_dbglog_vprintf(const char *str, va_list ap);
-void MPIU_dump_dbg_memlog_to_stdout(void);
-void MPIU_dump_dbg_memlog_to_file(const char *filename);
-void MPIU_dump_dbg_memlog(FILE * fp);
 
 int MPIU_DBG_Outevent(const char *, int, int, int, const char *, ...) 
                                         ATTRIBUTE((format(printf,5,6)));

http://git.mpich.org/mpich.git/commitdiff/40ccf0b980854dcb21cde42bf8797f29e1640cc8

commit 40ccf0b980854dcb21cde42bf8797f29e1640cc8
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 15:25:44 2015 -0600

    mpidbg: delete unused macros.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index dcad9ae..7e9f30b 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -161,19 +161,10 @@ int usleep(useconds_t usec);
 {						\
     MPIU_dbg_printf e;                          \
 }
-/* The first argument is a place holder to allow the selection of a subset
-   of debugging events.  The second is a placeholder to allow a numeric
-   level of debugging within that class.  The third is the debugging text */
-#define MPIU_DBG_PRINTF_CLASS(_c,_l,_e) MPIU_DBG_PRINTF(_e)
 #else
 #define MPIU_DBG_PRINTF(e)
-#define MPIU_DBG_PRINTF_CLASS(_c,_l,_e)
 #endif
 
-/* The follow is temporarily provided for backward compatibility.  Any code
-   using dbg_printf should be updated to use MPIU_DBG_PRINTF. */
-#define dbg_printf MPIU_dbg_printf
-
 /* ------------------------------------------------------------------------- */
 /* end of mpidebug.h */
 /* ------------------------------------------------------------------------- */

http://git.mpich.org/mpich.git/commitdiff/ea4b1e4a57e912b9810f34fe7c89f5c8dd0c23be

commit ea4b1e4a57e912b9810f34fe7c89f5c8dd0c23be
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 15:25:23 2015 -0600

    mpidbg: delete dbglog_flush macro.
    
    This is a very simple (2 line) macro, which is used in a single place.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 2c1304f..fc2cf60 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -316,7 +316,9 @@ int MPIU_dbg_printf(const char * str, ...)
 	va_start(list, str);
 	n = MPIU_dbglog_vprintf(str, list);
 	va_end(list);
-	MPIU_dbglog_flush();
+
+        if (dbg_state & DBG_STATE_STDOUT)
+            fflush(stdout);
     }
     /* MPID_Common_thread_unlock(); */
     
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index d58ef0e..834ecf3 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -126,13 +126,6 @@ void MPIU_dump_dbg_memlog_to_stdout(void);
 void MPIU_dump_dbg_memlog_to_file(const char *filename);
 void MPIU_dump_dbg_memlog(FILE * fp);
 
-#define MPIU_dbglog_flush()				\
-{							\
-    if (MPIU_dbg_state & MPIU_DBG_STATE_STDOUT)	\
-    {							\
-	fflush(stdout);					\
-    }							\
-}
 int MPIU_DBG_Outevent(const char *, int, int, int, const char *, ...) 
                                         ATTRIBUTE((format(printf,5,6)));
 int MPIU_DBG_Init( int *, char ***, int, int, int );

http://git.mpich.org/mpich.git/commitdiff/6134a3e04f9ad9fe608767e790945bbff5fa523c

commit 6134a3e04f9ad9fe608767e790945bbff5fa523c
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 15:02:35 2015 -0600

    mpidbg: cleanup debug state.
    
    The debug state was exposed outside of the mpidbg layer, only to check
    whether the state is "NONE" before calling it.  This is unnecessary
    and can be checked inside the mpidbg layer itself.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index 77610ed..dcad9ae 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -159,10 +159,7 @@ int usleep(useconds_t usec);
 #if defined(MPICH_DBG_OUTPUT)
 #define MPIU_DBG_PRINTF(e)			\
 {						\
-    if (MPIU_dbg_state != MPIU_DBG_STATE_NONE)	\
-    {						\
-	MPIU_dbg_printf e;			\
-    }						\
+    MPIU_dbg_printf e;                          \
 }
 /* The first argument is a place holder to allow the selection of a subset
    of debugging events.  The second is a placeholder to allow a numeric
diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h
index 51d1420..f8348cb 100644
--- a/src/mpid/ch3/include/mpidimpl.h
+++ b/src/mpid/ch3/include/mpidimpl.h
@@ -998,10 +998,7 @@ extern char *MPIDI_DBG_parent_str;
 #if defined(MPICH_DBG_OUTPUT)
 #define MPIDI_DBG_PRINTF(e_)				\
 {                                               	\
-    if (MPIU_dbg_state != MPIU_DBG_STATE_NONE)		\
-    {							\
-	MPIDI_dbg_printf e_;				\
-    }							\
+    MPIDI_dbg_printf e_;				\
 }
 #else
 #   define MPIDI_DBG_PRINTF(e)
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index f0bce9a..2c1304f 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -68,6 +68,15 @@ static int dbg_memlog_next = 0;
 static int dbg_memlog_count = 0;
 static int dbg_rank = -1;
 
+typedef enum {
+    DBG_STATE_NONE = 0,
+    DBG_STATE_UNINIT = 1,
+    DBG_STATE_STDOUT = 2,
+    DBG_STATE_MEMLOG = 4,
+    DBG_STATE_FILE = 8
+} dbg_state_t;
+dbg_state_t dbg_state = DBG_STATE_UNINIT;
+
 static void dbg_init(void);
 
 /*
@@ -92,13 +101,13 @@ int MPIU_dbg_init(int rank)
 {
     dbg_rank = rank;
 
-    if (MPIU_dbg_state == MPIU_DBG_STATE_UNINIT)
+    if (dbg_state == DBG_STATE_UNINIT)
     {
 	dbg_init();
     }
 
     /* If file logging is enable, we need to open a file */
-    if (MPIU_dbg_state & MPIU_DBG_STATE_FILE)
+    if (dbg_state & DBG_STATE_FILE)
     {
 	char fn[128];
 
@@ -119,7 +128,7 @@ static void dbg_init(void)
 {
     char * envstr;
     
-    MPIU_dbg_state = MPIU_DBG_STATE_NONE;
+    dbg_state = DBG_STATE_NONE;
 
     /* FIXME: This should use MPIU_Param_get_string */
     envstr = getenv("MPICH_DBG_OUTPUT");
@@ -140,22 +149,22 @@ static void dbg_init(void)
      */
     if (strstr(envstr, "stdout"))
     {
-	MPIU_dbg_state = (MPIU_dbg_state_t)( MPIU_DBG_STATE_STDOUT |
-					      MPIU_dbg_state );
+	dbg_state = (dbg_state_t)( DBG_STATE_STDOUT |
+					      dbg_state );
     }
     if (strstr(envstr, "memlog"))
     {
-	MPIU_dbg_state = (MPIU_dbg_state_t)( MPIU_DBG_STATE_MEMLOG |
-					      MPIU_dbg_state );
+	dbg_state = (dbg_state_t)( DBG_STATE_MEMLOG |
+					      dbg_state );
     }
     if (strstr(envstr, "file"))
     {
-	MPIU_dbg_state = (MPIU_dbg_state_t) ( MPIU_DBG_STATE_FILE |
-					       MPIU_dbg_state );
+	dbg_state = (dbg_state_t) ( DBG_STATE_FILE |
+					       dbg_state );
     }
 
     /* If memlog is enabled, the we need to allocate some memory for it */
-    if (MPIU_dbg_state & MPIU_DBG_STATE_MEMLOG)
+    if (dbg_state & DBG_STATE_MEMLOG)
     {
 	dbg_memlog = MPIU_Malloc(DBG_MEMLOG_NUM_LINES * sizeof(char *) +
 				 DBG_MEMLOG_NUM_LINES * DBG_MEMLOG_LINE_SIZE);
@@ -171,8 +180,8 @@ static void dbg_init(void)
 	}
 	else
 	{
-	    MPIU_dbg_state = (MPIU_dbg_state_t)( MPIU_dbg_state &
-						  ~MPIU_DBG_STATE_MEMLOG );
+	    dbg_state = (dbg_state_t)( dbg_state &
+						  ~DBG_STATE_MEMLOG );
 	}
     }
 }
@@ -182,12 +191,12 @@ int MPIU_dbglog_printf(const char *str, ...)
     int n = 0;
     va_list list;
 
-    if (MPIU_dbg_state == MPIU_DBG_STATE_UNINIT)
+    if (dbg_state == DBG_STATE_UNINIT)
     {
 	dbg_init();
     }
 
-    if (MPIU_dbg_state & MPIU_DBG_STATE_MEMLOG)
+    if (dbg_state & DBG_STATE_MEMLOG)
     {
 	/* FIXME: put everything on one line until a \n is found */
 	
@@ -219,14 +228,14 @@ int MPIU_dbglog_printf(const char *str, ...)
 	}
     }
 
-    if (MPIU_dbg_state & MPIU_DBG_STATE_STDOUT)
+    if (dbg_state & DBG_STATE_STDOUT)
     {
 	va_start(list, str);
 	n = vprintf(str, list);
 	va_end(list);
     }
 
-    if ((MPIU_dbg_state & MPIU_DBG_STATE_FILE) && global_dbg_fp != NULL)
+    if ((dbg_state & DBG_STATE_FILE) && global_dbg_fp != NULL)
     {
 	va_start(list, str);
 	n = vfprintf(global_dbg_fp, str, list);
@@ -241,12 +250,12 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
     int n = 0;
     va_list list;
 
-    if (MPIU_dbg_state == MPIU_DBG_STATE_UNINIT)
+    if (dbg_state == DBG_STATE_UNINIT)
     {
 	dbg_init();
     }
 
-    if (MPIU_dbg_state & MPIU_DBG_STATE_MEMLOG)
+    if (dbg_state & DBG_STATE_MEMLOG)
     {
 	va_copy(list,ap);
 	dbg_memlog[dbg_memlog_next][0] = '\0';
@@ -276,14 +285,14 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
 	}
     }
 
-    if (MPIU_dbg_state & MPIU_DBG_STATE_STDOUT)
+    if (dbg_state & DBG_STATE_STDOUT)
     {
 	va_copy(list, ap);
 	n = vprintf(str, list);
 	va_copy_end(list);
     }
 
-    if ((MPIU_dbg_state & MPIU_DBG_STATE_FILE) && dbg_global_fp != NULL)
+    if ((dbg_state & DBG_STATE_FILE) && global_dbg_fp != NULL)
     {
 	va_copy(list, ap);
 	n = vfprintf(global_dbg_fp, str, list);
@@ -296,9 +305,10 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
 /* FIXME: */
 int MPIU_dbg_printf(const char * str, ...)
 {
-    int n;
+    int n = 0;
     
     /* MPID_Common_thread_lock(); */
+    if (dbg_state != DBG_STATE_NONE)
     {
 	va_list list;
 
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 92a1ce9..d58ef0e 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -117,15 +117,6 @@ enum MPIU_DBG_CLASS { MPIU_DBG_PT2PT         = 0x1,
 
 extern int MPIU_DBG_ActiveClasses;
 extern int MPIU_DBG_MaxLevel;
-typedef enum MPIU_dbg_state_t
-{
-    MPIU_DBG_STATE_NONE = 0,
-    MPIU_DBG_STATE_UNINIT = 1,
-    MPIU_DBG_STATE_STDOUT = 2,
-    MPIU_DBG_STATE_MEMLOG = 4,
-    MPIU_DBG_STATE_FILE = 8
-}
-MPIU_dbg_state_t;
 
 int MPIU_dbg_init(int rank);
 int MPIU_dbg_printf(const char *str, ...) ATTRIBUTE((format(printf,1,2)));
@@ -135,7 +126,6 @@ void MPIU_dump_dbg_memlog_to_stdout(void);
 void MPIU_dump_dbg_memlog_to_file(const char *filename);
 void MPIU_dump_dbg_memlog(FILE * fp);
 
-extern MPIU_dbg_state_t MPIU_dbg_state;
 #define MPIU_dbglog_flush()				\
 {							\
     if (MPIU_dbg_state & MPIU_DBG_STATE_STDOUT)	\

http://git.mpich.org/mpich.git/commitdiff/dc2c98be9d640dcf28ecfdcbc6ad4742d4d17134

commit dc2c98be9d640dcf28ecfdcbc6ad4742d4d17134
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 15:03:40 2015 -0600

    mpidbg: cleanup the dbg_fp variable.
    
    This is not used anywhere outside the mpidbg layer.  Make it an
    internal variable.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 2c23d71..f0bce9a 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -62,7 +62,7 @@ extern FILE *fdopen(int fd, const char *mode);
 #define DBG_MEMLOG_NUM_LINES 1024
 #define DBG_MEMLOG_LINE_SIZE 256
 
-FILE * MPIU_dbg_fp = NULL;
+static FILE * global_dbg_fp = NULL;
 static char **dbg_memlog = NULL;
 static int dbg_memlog_next = 0;
 static int dbg_memlog_count = 0;
@@ -104,11 +104,11 @@ int MPIU_dbg_init(int rank)
 
 	/* Only open the file only once in case MPIU_dbg_init is called more 
 	   than once */
-	if (MPIU_dbg_fp == NULL)
+	if (global_dbg_fp == NULL)
 	{
 	    MPL_snprintf(fn, 128, "mpich-dbg-%d.log", dbg_rank);
-	    MPIU_dbg_fp = fopen(fn, "w");
-	    setvbuf(MPIU_dbg_fp, NULL, _IONBF, 0);
+	    global_dbg_fp = fopen(fn, "w");
+	    setvbuf(global_dbg_fp, NULL, _IONBF, 0);
 	}
     }
     
@@ -226,10 +226,10 @@ int MPIU_dbglog_printf(const char *str, ...)
 	va_end(list);
     }
 
-    if ((MPIU_dbg_state & MPIU_DBG_STATE_FILE) && MPIU_dbg_fp != NULL)
+    if ((MPIU_dbg_state & MPIU_DBG_STATE_FILE) && global_dbg_fp != NULL)
     {
 	va_start(list, str);
-	n = vfprintf(MPIU_dbg_fp, str, list);
+	n = vfprintf(global_dbg_fp, str, list);
 	va_end(list);
     }
 
@@ -283,10 +283,10 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
 	va_copy_end(list);
     }
 
-    if ((MPIU_dbg_state & MPIU_DBG_STATE_FILE) && MPIU_dbg_fp != NULL)
+    if ((MPIU_dbg_state & MPIU_DBG_STATE_FILE) && dbg_global_fp != NULL)
     {
 	va_copy(list, ap);
-	n = vfprintf(MPIU_dbg_fp, str, list);
+	n = vfprintf(global_dbg_fp, str, list);
 	va_end(list);
     }
 
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 342c025..92a1ce9 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -136,7 +136,6 @@ void MPIU_dump_dbg_memlog_to_file(const char *filename);
 void MPIU_dump_dbg_memlog(FILE * fp);
 
 extern MPIU_dbg_state_t MPIU_dbg_state;
-extern FILE * MPIU_dbg_fp;
 #define MPIU_dbglog_flush()				\
 {							\
     if (MPIU_dbg_state & MPIU_DBG_STATE_STDOUT)	\

http://git.mpich.org/mpich.git/commitdiff/0cd7e1c04e835a8c39f4c3e0512bc5eb7acbe0d0

commit 0cd7e1c04e835a8c39f4c3e0512bc5eb7acbe0d0
Author: Pavan Balaji <balaji at anl.gov>
Date:   Thu Dec 31 14:54:15 2015 -0600

    mpidbg: cleanup internal naming convention.
    
    Remove MPIU_ namespace for static functions/variables that are only
    used inside the debug implementation code.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/spawn/comm_get_parent.c b/src/mpi/spawn/comm_get_parent.c
index b851a96..23805a4 100644
--- a/src/mpi/spawn/comm_get_parent.c
+++ b/src/mpi/spawn/comm_get_parent.c
@@ -82,8 +82,6 @@ int MPI_Comm_get_parent(MPI_Comm *parent)
 
     /* ... body of routine ...  */
     
-    /* Note that MPIU_DBG_OpenFile also uses this code (so as to avoid
-       calling an MPI routine while logging it */
     *parent = (MPIR_Process.comm_parent == NULL) ? MPI_COMM_NULL :
                (MPIR_Process.comm_parent)->handle;  
 
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index ab84150..2c23d71 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -59,17 +59,10 @@ extern FILE *fdopen(int fd, const char *mode);
 # endif
 #endif
 
-#if !defined(MPICH_DBG_MEMLOG_NUM_LINES)
-#define MPICH_DBG_MEMLOG_NUM_LINES 1024
-#endif
-#if !defined(MPICH_DBG_MEMLOG_LINE_SIZE)
-#define MPICH_DBG_MEMLOG_LINE_SIZE 256
-#endif
+#define DBG_MEMLOG_NUM_LINES 1024
+#define DBG_MEMLOG_LINE_SIZE 256
 
-MPIU_dbg_state_t MPIU_dbg_state = MPIU_DBG_STATE_UNINIT;
 FILE * MPIU_dbg_fp = NULL;
-static int dbg_memlog_num_lines = MPICH_DBG_MEMLOG_NUM_LINES;
-static int dbg_memlog_line_size = MPICH_DBG_MEMLOG_LINE_SIZE;
 static char **dbg_memlog = NULL;
 static int dbg_memlog_next = 0;
 static int dbg_memlog_count = 0;
@@ -164,16 +157,16 @@ static void dbg_init(void)
     /* If memlog is enabled, the we need to allocate some memory for it */
     if (MPIU_dbg_state & MPIU_DBG_STATE_MEMLOG)
     {
-	dbg_memlog = MPIU_Malloc(dbg_memlog_num_lines * sizeof(char *) +
-				 dbg_memlog_num_lines * dbg_memlog_line_size);
+	dbg_memlog = MPIU_Malloc(DBG_MEMLOG_NUM_LINES * sizeof(char *) +
+				 DBG_MEMLOG_NUM_LINES * DBG_MEMLOG_LINE_SIZE);
 	if (dbg_memlog != NULL)
 	{
 	    int i;
 	    
-	    for (i = 0; i < dbg_memlog_num_lines ; i++)
+	    for (i = 0; i < DBG_MEMLOG_NUM_LINES ; i++)
 	    {
-		dbg_memlog[i] = ((char *) &dbg_memlog[dbg_memlog_num_lines]) + 
-		    i * dbg_memlog_line_size;
+		dbg_memlog[i] = ((char *) &dbg_memlog[DBG_MEMLOG_NUM_LINES]) + 
+		    i * DBG_MEMLOG_LINE_SIZE;
 	    }
 	}
 	else
@@ -200,7 +193,7 @@ int MPIU_dbglog_printf(const char *str, ...)
 	
 	dbg_memlog[dbg_memlog_next][0] = '\0';
 	va_start(list, str);
-	n = vsnprintf(dbg_memlog[dbg_memlog_next], dbg_memlog_line_size, str, 
+	n = vsnprintf(dbg_memlog[dbg_memlog_next], DBG_MEMLOG_LINE_SIZE, str, 
 		      list);
 	va_end(list);
 
@@ -213,15 +206,15 @@ int MPIU_dbglog_printf(const char *str, ...)
 	   want to avoid reading past the end of the array or outputing garbage
 	   data. */
 
-	if (n < 0 || n >= dbg_memlog_line_size)
+	if (n < 0 || n >= DBG_MEMLOG_LINE_SIZE)
 	{
-	    dbg_memlog[dbg_memlog_next][dbg_memlog_line_size - 1] = '\0';
+	    dbg_memlog[dbg_memlog_next][DBG_MEMLOG_LINE_SIZE - 1] = '\0';
 	    n = (int)strlen(dbg_memlog[dbg_memlog_next]);
 	}
 
 	if (dbg_memlog[dbg_memlog_next][0] != '\0')
 	{
-	    dbg_memlog_next = (dbg_memlog_next + 1) % dbg_memlog_num_lines;
+	    dbg_memlog_next = (dbg_memlog_next + 1) % DBG_MEMLOG_NUM_LINES;
 	    dbg_memlog_count++;
 	}
     }
@@ -257,7 +250,7 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
     {
 	va_copy(list,ap);
 	dbg_memlog[dbg_memlog_next][0] = '\0';
-	n = vsnprintf(dbg_memlog[dbg_memlog_next], dbg_memlog_line_size, str, 
+	n = vsnprintf(dbg_memlog[dbg_memlog_next], DBG_MEMLOG_LINE_SIZE, str, 
 		      list);
         va_copy_end(list);
 
@@ -270,15 +263,15 @@ int MPIU_dbglog_vprintf(const char *str, va_list ap)
 	   want to avoid reading past the end of the array or outputing garbage
 	   data. */
 
-	if (n < 0 || n >= dbg_memlog_line_size)
+	if (n < 0 || n >= DBG_MEMLOG_LINE_SIZE)
 	{
-	    dbg_memlog[dbg_memlog_next][dbg_memlog_line_size - 1] = '\0';
+	    dbg_memlog[dbg_memlog_next][DBG_MEMLOG_LINE_SIZE - 1] = '\0';
 	    n = (int)strlen(dbg_memlog[dbg_memlog_next]);
 	}
 
 	if (dbg_memlog[dbg_memlog_next][0] != '\0')
 	{
-	    dbg_memlog_next = (dbg_memlog_next + 1) % dbg_memlog_num_lines;
+	    dbg_memlog_next = (dbg_memlog_next + 1) % DBG_MEMLOG_NUM_LINES;
 	    dbg_memlog_count++;
 	}
     }
@@ -367,8 +360,8 @@ void MPIU_dump_dbg_memlog(FILE * fp){
 
 int MPIU_DBG_ActiveClasses = 0;
 int MPIU_DBG_MaxLevel      = MPIU_DBG_TYPICAL;
-static enum {MPIU_DBG_UNINIT, MPIU_DBG_PREINIT, MPIU_DBG_INITIALIZED, MPIU_DBG_ERROR}
-    mpiu_dbg_initialized = MPIU_DBG_UNINIT;
+static enum {DBG_UNINIT, DBG_PREINIT, DBG_INITIALIZED, DBG_ERROR}
+    dbg_initialized = DBG_UNINIT;
 static char filePatternBuf[MAXPATHLEN] = "";
 static const char *filePattern = "-stdout-"; /* "log%d.log"; */
 static const char *defaultFilePattern = "dbg at W%w-@%d at T-%t at .log";
@@ -379,11 +372,11 @@ static int whichRank = -1;             /* all ranks */
 static int    resetTimeOrigin = 1;
 static double timeOrigin = 0.0;
 
-static int MPIU_DBG_Usage( const char *, const char * );
-static int MPIU_DBG_OpenFile(FILE **dbg_fp);
+static int dbg_usage( const char *, const char * );
+static int dbg_openfile(FILE **dbg_fp);
 static int setDBGClass( const char * );
 static int SetDBGLevel( const char *, const char *(names[]) );
-static int MPIU_DBG_Get_filename(char *filename, int len);
+static int dbg_get_filename(char *filename, int len);
 
 #ifdef MPICH_IS_THREADED
 static MPID_Thread_tls_t dbg_tls_key;
@@ -408,7 +401,7 @@ static FILE *get_fp(void)
     /* if we're not initialized, use the static fp, since there should
      * only be one thread in here until then */
     MPIU_THREAD_CHECK_BEGIN;
-    if (mpiu_dbg_initialized == MPIU_DBG_INITIALIZED) {
+    if (dbg_initialized == DBG_INITIALIZED) {
         FILE *fp;
         MPID_Thread_tls_get(&dbg_tls_key, (void **) &fp, &err);
         return fp;
@@ -426,7 +419,7 @@ static void set_fp(FILE *fp)
     /* if we're not initialized, use the static fp, since there should
      * only be one thread in here until then */
     MPIU_THREAD_CHECK_BEGIN;
-    if (mpiu_dbg_initialized == MPIU_DBG_INITIALIZED) {
+    if (dbg_initialized == DBG_INITIALIZED) {
         MPID_Thread_tls_set(&dbg_tls_key, (void *)fp, &err);
         return;
     }
@@ -451,7 +444,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
     int pid = -1;
     FILE *dbg_fp = NULL;
 
-    if (mpiu_dbg_initialized == MPIU_DBG_UNINIT || mpiu_dbg_initialized == MPIU_DBG_ERROR) goto fn_exit;
+    if (dbg_initialized == DBG_UNINIT || dbg_initialized == DBG_ERROR) goto fn_exit;
 
     dbg_fp = get_fp();
 
@@ -470,7 +463,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 #endif /* HAVE_GETPID */
 
     if (!dbg_fp) {
-	mpi_errno = MPIU_DBG_OpenFile(&dbg_fp);
+	mpi_errno = dbg_openfile(&dbg_fp);
         if (mpi_errno) goto fn_fail;
         set_fp(dbg_fp);
     }
@@ -526,17 +519,17 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
 }
 
 /* These are used to simplify the handling of options.  
-   To add a new name, add an MPIU_DBG_ClassName element to the array
-   MPIU_Classnames.  The "classbits" values are defined by MPIU_DBG_CLASS
+   To add a new name, add an DBG_ClassName element to the array
+   classnames.  The "classbits" values are defined by MPIU_DBG_CLASS
    in src/include/mpidbg.h 
  */
 
-typedef struct MPIU_DBG_ClassName {
+typedef struct DBG_ClassName {
     int        classbits;
     const char *UCName, *LCName; 
-} MPIU_DBG_ClassName;
+} DBG_ClassName;
 
-static const MPIU_DBG_ClassName MPIU_Classnames[] = {
+static const DBG_ClassName classnames[] = {
     { MPIU_DBG_PT2PT,         "PT2PT",         "pt2pt" },
     { MPIU_DBG_RMA,           "RMA",           "rma"   },
     { MPIU_DBG_THREAD,        "THREAD",        "thread" },
@@ -570,11 +563,11 @@ static const MPIU_DBG_ClassName MPIU_Classnames[] = {
 
 /* Because the level values are simpler and are rarely changed, these
    use a simple set of parallel arrays */
-static const int  MPIU_Levelvalues[] = { MPIU_DBG_TERSE,
+static const int  level_values[] = { MPIU_DBG_TERSE,
 					 MPIU_DBG_TYPICAL,
 					 MPIU_DBG_VERBOSE, 100 };
-static const char *MPIU_Levelname[] = { "TERSE", "TYPICAL", "VERBOSE", 0 };
-static const char *MPIU_LCLevelname[] = { "terse", "typical", "verbose", 0 };
+static const char *level_name[] = { "TERSE", "TYPICAL", "VERBOSE", 0 };
+static const char *lc_level_name[] = { "terse", "typical", "verbose", 0 };
 
 /* 
  * Initialize the DBG_MSG system.  This is called during MPI_Init to process
@@ -584,7 +577,7 @@ static const char *MPIU_LCLevelname[] = { "terse", "typical", "verbose", 0 };
  * MPID_Init, where a significant amount of the initialization takes place.
  */
 
-static int MPIU_DBG_ProcessArgs( int *argc_p, char ***argv_p )
+static int DBG_ProcessArgs( int *argc_p, char ***argv_p )
 {
     int i, rc;
 
@@ -612,9 +605,9 @@ static int MPIU_DBG_ProcessArgs( int *argc_p, char ***argv_p )
 		    char *p = s + 6;
 		    if (*p == '=') {
 			p++;
-			rc = SetDBGLevel( p, MPIU_LCLevelname );
+			rc = SetDBGLevel( p, lc_level_name );
 			if (rc) 
-			    MPIU_DBG_Usage( "-mpich-dbg-level", "terse, typical, verbose" );
+			    dbg_usage( "-mpich-dbg-level", "terse, typical, verbose" );
 		    }
 		}
 		else if (strncmp(s,"-class",6) == 0) {
@@ -623,7 +616,7 @@ static int MPIU_DBG_ProcessArgs( int *argc_p, char ***argv_p )
 			p++;
 			rc = setDBGClass( p );
 			if (rc)
-			    MPIU_DBG_Usage( "-mpich-dbg-class", 0 );
+			    dbg_usage( "-mpich-dbg-class", 0 );
 		    }
 		}
 		else if (strncmp( s, "-filename", 9 ) == 0) {
@@ -648,13 +641,13 @@ static int MPIU_DBG_ProcessArgs( int *argc_p, char ***argv_p )
 			p++;
 			whichRank = (int)strtol( p, &sOut, 10 );
 			if (p == sOut) {
-			    MPIU_DBG_Usage( "-mpich-dbg-rank", 0 );
+			    dbg_usage( "-mpich-dbg-rank", 0 );
 			    whichRank = -1;
 			}
 		    }
 		}
 		else {
-		    MPIU_DBG_Usage( (*argv_p)[i], 0 );
+		    dbg_usage( (*argv_p)[i], 0 );
 		}
 		
 		/* Eventually, should null it out and reduce argc value */
@@ -664,7 +657,7 @@ static int MPIU_DBG_ProcessArgs( int *argc_p, char ***argv_p )
     return MPI_SUCCESS;
 }
 
-static int MPIU_DBG_ProcessEnv( void )
+static int DBG_ProcessEnv( void )
 {
     char *s;
     int rc;
@@ -680,15 +673,15 @@ static int MPIU_DBG_ProcessEnv( void )
     }
     s = getenv( "MPICH_DBG_LEVEL" );
     if (s) {
-	rc = SetDBGLevel( s, MPIU_Levelname );
+	rc = SetDBGLevel( s, level_name );
 	if (rc) 
-	    MPIU_DBG_Usage( "MPICH_DBG_LEVEL", "TERSE, TYPICAL, VERBOSE" );
+	    dbg_usage( "MPICH_DBG_LEVEL", "TERSE, TYPICAL, VERBOSE" );
     }
 
     s = getenv( "MPICH_DBG_CLASS" );
     rc = setDBGClass( s );
     if (rc) 
-	MPIU_DBG_Usage( "MPICH_DBG_CLASS", 0 );
+	dbg_usage( "MPICH_DBG_CLASS", 0 );
 
     s = getenv( "MPICH_DBG_FILENAME" );
     if (s) {
@@ -701,7 +694,7 @@ static int MPIU_DBG_ProcessEnv( void )
 	char *sOut;
 	whichRank = (int)strtol( s, &sOut, 10 );
 	if (s == sOut) {
-	    MPIU_DBG_Usage( "MPICH_DBG_RANK", 0 );
+	    dbg_usage( "MPICH_DBG_RANK", 0 );
 	    whichRank = -1;
 	}
     }
@@ -719,7 +712,7 @@ int MPIU_DBG_PreInit( int *argc_p, char ***argv_p, int wtimeNotReady )
 
     /* if the DBG_MSG system was already initialized, say by the device, then
        return immediately */
-    if (mpiu_dbg_initialized != MPIU_DBG_UNINIT) return MPI_SUCCESS;
+    if (dbg_initialized != DBG_UNINIT) return MPI_SUCCESS;
 
     dbg_init_tls();
 
@@ -727,9 +720,9 @@ int MPIU_DBG_PreInit( int *argc_p, char ***argv_p, int wtimeNotReady )
        tests is important, as they allow general defaults to be set,
        followed by more specific modifications */
     /* First, the environment variables */
-    MPIU_DBG_ProcessEnv();
+    DBG_ProcessEnv();
 
-    MPIU_DBG_ProcessArgs( argc_p, argv_p );
+    DBG_ProcessArgs( argc_p, argv_p );
 
     if (wtimeNotReady == 0) {
 	MPL_Wtime( &t );
@@ -737,7 +730,7 @@ int MPIU_DBG_PreInit( int *argc_p, char ***argv_p, int wtimeNotReady )
 	resetTimeOrigin = 0;
     }
 
-    mpiu_dbg_initialized = MPIU_DBG_PREINIT;
+    dbg_initialized = DBG_PREINIT;
 
     return MPI_SUCCESS;
 }
@@ -752,9 +745,9 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
        return immediately.  Note that the device is then responsible
        for handling the file mode (e.g., reopen when the rank become 
        available) */
-    if (mpiu_dbg_initialized == MPIU_DBG_INITIALIZED || mpiu_dbg_initialized == MPIU_DBG_ERROR) return MPI_SUCCESS;
+    if (dbg_initialized == DBG_INITIALIZED || dbg_initialized == DBG_ERROR) return MPI_SUCCESS;
 
-    if (mpiu_dbg_initialized != MPIU_DBG_PREINIT)
+    if (dbg_initialized != DBG_PREINIT)
         dbg_init_tls();
 
     dbg_fp = get_fp();
@@ -775,10 +768,10 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
        (as they were already handled in DBG_PreInit) */
     /* First, the environment variables */
     if (!has_env) 
-	MPIU_DBG_ProcessEnv();
+	DBG_ProcessEnv();
     /* Now the command-line arguments */
     if (!has_args) 
-	MPIU_DBG_ProcessArgs( argc_p, argv_p );
+	DBG_ProcessArgs( argc_p, argv_p );
 
     worldRank = wrank;
 
@@ -793,7 +786,7 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
     {
         char filename[MAXPATHLEN] = "";
         
-        MPIU_DBG_Get_filename(filename, MAXPATHLEN);
+        dbg_get_filename(filename, MAXPATHLEN);
         ret = rename(temp_filename, filename);
         if (ret){
             /* Retry renaming file after closing it */
@@ -814,16 +807,16 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
         }
     }
 
-    mpiu_dbg_initialized = MPIU_DBG_INITIALIZED;
+    dbg_initialized = DBG_INITIALIZED;
  fn_exit:
     return MPI_SUCCESS;
  fn_fail:
-    mpiu_dbg_initialized = MPIU_DBG_ERROR;
+    dbg_initialized = DBG_ERROR;
     goto fn_exit;
 }
 
 /* Print the usage statement to stderr */
-static int MPIU_DBG_Usage( const char *cmd, const char *vals )
+static int dbg_usage( const char *cmd, const char *vals )
 {
     if (vals) {
 	fprintf( stderr, "Incorrect value for %s, should be one of %s\n",
@@ -856,10 +849,10 @@ Environment variables\n\
 /* creates a temporary file in the same directory the
    user specified for the log file */
 #undef FUNCNAME
-#define FUNCNAME MPIU_DBG_Open_temp_file
+#define FUNCNAME DBG_Open_temp_file
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
+static int DBG_Open_temp_file(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     const char temp_pattern[] = "templogXXXXXX";
@@ -887,7 +880,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     return mpi_errno;
  fn_fail:
     MPL_error_printf( "Could not open log file %s\n", temp_filename );
-    mpiu_dbg_initialized = MPIU_DBG_ERROR;
+    dbg_initialized = DBG_ERROR;
     mpi_errno = MPI_ERR_INTERN;
     goto fn_exit;
 }
@@ -895,10 +888,10 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
 /* creates a temporary file in the same directory the
    user specified for the log file */
 #undef FUNCNAME
-#define FUNCNAME MPIU_DBG_Open_temp_file
+#define FUNCNAME DBG_Open_temp_file
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
+static int DBG_Open_temp_file(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     const char temp_pattern[] = "templogXXXXXX";
@@ -927,7 +920,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     return mpi_errno;
  fn_fail:
     MPL_error_printf( "Could not open log file %s\n", temp_filename );
-    mpiu_dbg_initialized = MPIU_DBG_ERROR;
+    dbg_initialized = DBG_ERROR;
     mpi_errno = MPI_ERR_INTERN;
     goto fn_exit;
 }
@@ -940,10 +933,10 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
    file with the same name may exist.  That file would get clobbered.
 */
 #undef FUNCNAME
-#define FUNCNAME MPIU_DBG_Open_temp_file
+#define FUNCNAME DBG_Open_temp_file
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
+static int DBG_Open_temp_file(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     const char temp_pattern[] = "templogXXXXXX";
@@ -962,7 +955,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     return mpi_errno;
  fn_fail:
     MPL_error_printf( "Could not open log file %s\n", temp_filename );
-    mpiu_dbg_initialized = MPIU_DBG_ERROR;
+    dbg_initialized = DBG_ERROR;
     mpi_errno = MPI_ERR_INTERN;
     goto fn_exit;
 }
@@ -971,7 +964,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
 
 /* This routine can make no MPI calls, since it may be logging those
    calls. */
-static int MPIU_DBG_Get_filename(char *filename, int len)
+static int dbg_get_filename(char *filename, int len)
 {
     int withinMworld = 0,         /* True if within an @W...@ */
 	withinMthread = 0;        /* True if within an @T...@ */
@@ -1104,7 +1097,7 @@ static int MPIU_DBG_Get_filename(char *filename, int len)
 
 /* This routine can make no MPI calls, since it may be logging those
    calls. */
-static int MPIU_DBG_OpenFile(FILE **dbg_fp)
+static int dbg_openfile(FILE **dbg_fp)
 {
     int mpi_errno = MPI_SUCCESS;
     if (!filePattern || *filePattern == 0 ||
@@ -1117,16 +1110,16 @@ static int MPIU_DBG_OpenFile(FILE **dbg_fp)
     else {
 	char filename[MAXPATHLEN];
 
-        /* if we're not at MPIU_DBG_INITIALIZED, we don't know our
+        /* if we're not at DBG_INITIALIZED, we don't know our
            rank yet, so we create a temp file, to be renamed later */
-        if (mpiu_dbg_initialized != MPIU_DBG_INITIALIZED) 
+        if (dbg_initialized != DBG_INITIALIZED) 
         {
-            mpi_errno = MPIU_DBG_Open_temp_file(dbg_fp);
+            mpi_errno = DBG_Open_temp_file(dbg_fp);
             if (mpi_errno) goto fn_fail;
         }
         else 
         {
-            mpi_errno = MPIU_DBG_Get_filename(filename, MAXPATHLEN);
+            mpi_errno = dbg_get_filename(filename, MAXPATHLEN);
             if (mpi_errno) goto fn_fail;
 
             *dbg_fp = fopen( filename, "w" );
@@ -1139,7 +1132,7 @@ static int MPIU_DBG_OpenFile(FILE **dbg_fp)
  fn_exit:
     return mpi_errno;
  fn_fail:
-    mpiu_dbg_initialized = MPIU_DBG_ERROR;
+    dbg_initialized = DBG_ERROR;
     mpi_errno = MPI_ERR_INTERN;
     goto fn_exit;
 }
@@ -1156,28 +1149,28 @@ static int setDBGClass( const char *s )
     if (s && *s) slen = strlen(s);
 
     while (s && *s) {
-	for (i=0; MPIU_Classnames[i].LCName; i++) {
+	for (i=0; classnames[i].LCName; i++) {
 	    /* The LCLen and UCLen *should* be the same, but
 	       just in case, we separate them */
-	    size_t LClen = strlen(MPIU_Classnames[i].LCName);
-	    size_t UClen = strlen(MPIU_Classnames[i].UCName);
+	    size_t LClen = strlen(classnames[i].LCName);
+	    size_t UClen = strlen(classnames[i].UCName);
 	    int matchClass = 0;
 
 	    /* Allow the upper case and lower case in all cases */
 	    if (slen >= LClen && 
-		strncmp(s,MPIU_Classnames[i].LCName, LClen) == 0 &&
+		strncmp(s,classnames[i].LCName, LClen) == 0 &&
 		(s[LClen] == ',' || s[LClen] == 0) ) {
 		matchClass = 1;
 		len = LClen;
 	    }
 	    else if (slen >= UClen && 
-		strncmp(s,MPIU_Classnames[i].UCName, UClen) == 0 &&
+		strncmp(s,classnames[i].UCName, UClen) == 0 &&
 		(s[UClen] == ',' || s[UClen] == 0) ) {
 		matchClass = 1;
 		len = UClen;
 	    }
 	    if (matchClass) {
-		MPIU_DBG_ActiveClasses |= MPIU_Classnames[i].classbits;
+		MPIU_DBG_ActiveClasses |= classnames[i].classbits;
 		s += len;
 		slen -= len;
 		if (*s == ',') { s++; slen--; }
@@ -1185,7 +1178,7 @@ static int setDBGClass( const char *s )
 		break;
 	    }
 	}
-	if (!MPIU_Classnames[i].LCName) {
+	if (!classnames[i].LCName) {
 	    return 1;
 	}
     }
@@ -1201,7 +1194,7 @@ static int SetDBGLevel( const char *s, const char *(names[]) )
 
     for (i=0; names[i]; i++) {
 	if (strcmp( names[i], s ) == 0) {
-	    MPIU_DBG_MaxLevel = MPIU_Levelvalues[i];
+	    MPIU_DBG_MaxLevel = level_values[i];
 	    return 0;
 	}
     }
diff --git a/src/util/dbg/mpidbg.h b/src/util/dbg/mpidbg.h
index 4c2dd67..342c025 100644
--- a/src/util/dbg/mpidbg.h
+++ b/src/util/dbg/mpidbg.h
@@ -87,7 +87,7 @@ enum MPIU_DBG_LEVEL { MPIU_DBG_TERSE   = 0,
 		      MPIU_DBG_TYPICAL = 50,
 		      MPIU_DBG_VERBOSE = 99 };
 /* Any change in MPIU_DBG_CLASS must be matched by changes in 
-   MPIU_Classnames in src/util/dbg/dbg_printf.c */
+   "classnames" in src/util/dbg/dbg_printf.c */
 enum MPIU_DBG_CLASS { MPIU_DBG_PT2PT         = 0x1,
 		      MPIU_DBG_RMA           = 0x2,
 		      MPIU_DBG_THREAD        = 0x4,

http://git.mpich.org/mpich.git/commitdiff/2c49fa2057827762b7a67b83da22829dfe9b830a

commit 2c49fa2057827762b7a67b83da22829dfe9b830a
Author: Pavan Balaji <balaji at anl.gov>
Date:   Wed Dec 30 11:29:03 2015 -0600

    handles: cleanup object handle allocation code.
    
    Remove namespacing where functions/macros are only used internally.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpihandlemem.h b/src/include/mpihandlemem.h
index e099cb8..91b3ae7 100644
--- a/src/include/mpihandlemem.h
+++ b/src/include/mpihandlemem.h
@@ -383,10 +383,6 @@ typedef struct MPIU_Object_alloc_t {
 } MPIU_Object_alloc_t;
 extern void *MPIU_Handle_obj_alloc(MPIU_Object_alloc_t *);
 extern void *MPIU_Handle_obj_alloc_unsafe(MPIU_Object_alloc_t *);
-extern void MPIU_Handle_obj_alloc_complete(MPIU_Object_alloc_t *, int);
 extern void MPIU_Handle_obj_free( MPIU_Object_alloc_t *, void * );
 void *MPIU_Handle_get_ptr_indirect( int, MPIU_Object_alloc_t * );
-extern void *MPIU_Handle_direct_init(void *direct, int direct_size, 
-				     int obj_size, int handle_type);
-int MPIU_Handle_obj_outstanding(const MPIU_Object_alloc_t *objmem);
 #endif
diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index 1057c66..77610ed 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -342,12 +342,6 @@ void MPIR_DatatypeAttrFinalize( void );
 /* Should the following be moved into mpihandlemem.h ?*/
 /* ------------------------------------------------------------------------- */
 
-/* Routines to initialize handle allocations */
-/* These are now internal to the handlemem package
-void *MPIU_Handle_direct_init( void *, int, int, int );
-void *MPIU_Handle_indirect_init( void *(**)[], int *, int, int, int, int );
-int MPIU_Handle_free( void *((*)[]), int );
-*/
 /* Convert Handles to objects for MPI types that have predefined objects */
 /* TODO examine generated assembly for this construct, it's probably suboptimal
  * on Blue Gene.  An if/else if/else might help the compiler out.  It also lets
diff --git a/src/util/mem/check.c b/src/util/mem/check.c
deleted file mode 100644
index 20b89c4..0000000
--- a/src/util/mem/check.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2002 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include <stdio.h>
-
-/* This is a test program, so we allow printf */
-/* style: allow:printf:3 sig:0 */
-
-extern int MPL_snprintf( char *, size_t, const char *, ... );
-
-int main( int argc, char *argv[] )
-{
-    char buf[1000];
-    int n;
-
-    n = MPL_snprintf( buf, 100, "This is a test\n" );
-    printf( "%d:%s", n, buf );
-
-    n = MPL_snprintf( buf, 100, "This is a test %d\n", 3000000 );
-    printf( "%d:%s", n, buf );
-
-    n = MPL_snprintf( buf, 100, "This %s %% %d\n", "is a test for ", -3000 );
-    printf( "%d:%s", n, buf );
-
-    return 0;
-}
diff --git a/src/util/mem/handlemem.c b/src/util/mem/handlemem.c
index 1eea3c2..3dea600 100644
--- a/src/util/mem/handlemem.c
+++ b/src/util/mem/handlemem.c
@@ -35,12 +35,12 @@ cvars:
 #include <stdio.h>
 
 #ifdef NEEDS_PRINT_HANDLE
-static void MPIU_Print_handle( int handle );
+static void print_handle( int handle );
 #endif
 
 #ifdef MPICH_DEBUG_HANDLEALLOC
-static int MPIU_CheckHandlesOnFinalize( void * );
-static const char *MPIR_ObjectName( MPIU_Object_alloc_t * );
+static int check_handles_on_finalize( void * );
+static const char *object_name( MPIU_Object_alloc_t * );
 #endif
 
 /* This is the utility file for info that contains routines used to 
@@ -79,66 +79,12 @@ static const char *MPIR_ObjectName( MPIU_Object_alloc_t * );
    Note that these routines are designed for the MPI objects, and include the
    creation of a "handle" that is appropriate for the MPI object value.
    
-   The following routines are provided:
-   void *MPIU_Handle_direct_init( void *direct, int direct_size, int obj_size,
-                                  int handle_type )
-        Initialize the preallocated array (MPID_<obj>_direct) with
-        direct_size elements each of obj_size.  Returns the first available
-        element (which should usually be assigned to "avail").
-	handle_type is the kind of object (e.g., MPID_INFO)
-
-   void *MPIU_Handle_indirect_init( void (**indirect)[], int *indirect_size, 
-                                    int indirect_num_blocks,
-                                    int indirect_num_indices, 
-                                    int obj_size,
-                                    int handle_type )
-	Initialize the indirect array (MPID_<obj>_indirect) of size
-        indirect_size, each block of which contains indirect_num_indices
-	members of size obj_size.  Returns the first available element, or
-	NULL if no memory is available.  
-        Also incrementes indirect_size and assigns to indirect if it is null.
-
-	The Handle_indirect routine and the data structures that it manages
-	require a little more discussion.
-	This routine allocates an array of pointers to a block of storage.
-	The block of storage contains space for indirect_num_indices 
-	instances of an object of obj_size.  These blocks are allocated
-	as needed; the pointers to these blocks are stored in the 
-	indirect array.  The value of indirect_size is the number of 
-	valid pointers in indirect.  In other words, indirect[0] through
-        indirect[*indirect_size-1] contain pointers to blocks of 
-	storage of size indirect_num_indices * obj_size.  The array 
-	indirect has indirect_num_blocks entries, each holding a pointer.
-
-	The rationale for this approach is that this approach can 
-	handle large amounts of memory; however, relatively little
-	memory is used unless needed.  The definitions in 
-        mpich/src/include/mpihandlemem.h define defaults for the
-        indirect_num_blocks (HANDLE_NUM_BLOCKS = 512) and
-        indirect_num_indices (HANDLE_NUM_INDICES = 16384) that permits
-        the allocation of 8 Mi objects.
-
-   int MPIU_Handle_free( void *(*indirect)[], int indirect_size )
-        Frees any memory allocated for the indirect handles.  Returns 0 on
-	success and nonzero on failure
-
    None of these routines is thread-safe.  Any routine that uses them 
-   must ensure that only one thread at a time may call them.  
-   
+   must ensure that only one thread at a time may call them.
 */
 
-/*
- * You can use this to allocated that necessary local structures
- */
-#define MPID_HANDLE_MEM_ALLOC(Name,NAME) \
-MPID_##Name MPID_##Name_direct[MPID_##NAME##_PREALLOC]; \
-static int initialize = 0;\
-static int MPID_##Name *avail=0;\
-static MPID_##Name *(*MPID_##Name##_indirect)[] = 0;\
-static int MPID_##Name##_indirect_size = 0;
-
 /* This routine is called by finalize when MPI exits */
-static int MPIU_Handle_free( void *((*indirect)[]), int indirect_size )
+static int handle_free( void *((*indirect)[]), int indirect_size )
 {
     int i;
     
@@ -155,7 +101,7 @@ static int MPIU_Handle_free( void *((*indirect)[]), int indirect_size )
 }
 
 #if defined(MPL_VG_AVAILABLE)
-#define MPIU_HANDLE_VG_LABEL(objptr_, objsize_, handle_type_, is_direct_)                        \
+#define HANDLE_VG_LABEL(objptr_, objsize_, handle_type_, is_direct_)                        \
     do {                                                                                         \
         if (MPL_VG_RUNNING_ON_VALGRIND()) {                                                     \
             char desc_str[256];                                                                  \
@@ -170,10 +116,10 @@ static int MPIU_Handle_free( void *((*indirect)[]), int indirect_size )
         }                                                                                        \
     } while (0)
 #else
-#define MPIU_HANDLE_VG_LABEL(objptr_, objsize_, handle_type_, is_direct_) do{}while(0)
+#define HANDLE_VG_LABEL(objptr_, objsize_, handle_type_, is_direct_) do{}while(0)
 #endif
 
-void *MPIU_Handle_direct_init(void *direct,
+static void *handle_direct_init(void *direct,
 			      int direct_size, 
 			      int obj_size, 
 			      int handle_type)
@@ -192,7 +138,7 @@ void *MPIU_Handle_direct_init(void *direct,
 	hptr->handle = ((unsigned)HANDLE_KIND_DIRECT << HANDLE_KIND_SHIFT) | 
 	    (handle_type << HANDLE_MPI_KIND_SHIFT) | i;
 
-        MPIU_HANDLE_VG_LABEL(hptr, obj_size, handle_type, 1);
+        HANDLE_VG_LABEL(hptr, obj_size, handle_type, 1);
     }
 
     if (hptr)
@@ -201,7 +147,7 @@ void *MPIU_Handle_direct_init(void *direct,
 }
 
 /* indirect is really a pointer to a pointer to an array of pointers */
-static void *MPIU_Handle_indirect_init( void *(**indirect)[], 
+static void *handle_indirect_init( void *(**indirect)[], 
 					int *indirect_size, 
 					int indirect_num_blocks,
 					int indirect_num_indices,
@@ -247,7 +193,7 @@ static void *MPIU_Handle_indirect_init( void *(**indirect)[],
 	    (*indirect_size << HANDLE_INDIRECT_SHIFT) | i;
         /* printf("handle=%#x handle_type=%x *indirect_size=%d i=%d\n", hptr->handle, handle_type, *indirect_size, i); */
 
-        MPIU_HANDLE_VG_LABEL(hptr, obj_size, handle_type, 0);
+        HANDLE_VG_LABEL(hptr, obj_size, handle_type, 0);
     }
     hptr->next = 0;
     /* We're here because avail is null, so there is no need to set 
@@ -265,11 +211,11 @@ static void *MPIU_Handle_indirect_init( void *(**indirect)[],
 
  */
 
-static int MPIU_Handle_finalize( void *objmem_ptr )
+static int handle_finalize( void *objmem_ptr )
 {
     MPIU_Object_alloc_t *objmem = (MPIU_Object_alloc_t *)objmem_ptr;
 
-    (void)MPIU_Handle_free( objmem->indirect, objmem->indirect_size );
+    (void)handle_free( objmem->indirect, objmem->indirect_size );
     /* This does *not* remove any Info objects that the user created 
        and then did not destroy */
 
@@ -285,7 +231,7 @@ static int MPIU_Handle_finalize( void *objmem_ptr )
    guaranteed to be single threaded).  When used by the obj_alloc, it
    adds unnecessary overhead, particularly when MPI is single threaded */
 
-void MPIU_Handle_obj_alloc_complete(MPIU_Object_alloc_t *objmem,
+static void handle_obj_alloc_complete(MPIU_Object_alloc_t *objmem,
 				    int initialized)
 {
     if (initialized) {
@@ -298,7 +244,7 @@ void MPIU_Handle_obj_alloc_complete(MPIU_Object_alloc_t *objmem,
 	 * The 0 makes this the lowest priority callback, so 
 	 * that other callbacks will finish before this one is invoked.
 	 */
-	MPIR_Add_finalize(MPIU_Handle_finalize, objmem, 0);
+	MPIR_Add_finalize(handle_finalize, objmem, 0);
     }
 }
 
@@ -372,7 +318,7 @@ void *MPIU_Handle_obj_alloc_unsafe(MPIU_Object_alloc_t *objmem)
 	       jobs do not need to include any of the Info code if no
 	       Info-using routines are used */
 	    objmem->initialized = 1;
-	    ptr = MPIU_Handle_direct_init(objmem->direct,
+	    ptr = handle_direct_init(objmem->direct,
 					  objmem->direct_size,
 					  objsize,
 					  objkind);
@@ -384,14 +330,14 @@ void *MPIU_Handle_obj_alloc_unsafe(MPIU_Object_alloc_t *objmem)
 	    /* The priority of these callbacks must be greater than
 	       the priority of the callback that frees the objmem direct and 
 	       indirect storage. */
-	    MPIR_Add_finalize(MPIU_CheckHandlesOnFinalize, objmem, MPIR_FINALIZE_CALLBACK_HANDLE_CHECK_PRIO);
+	    MPIR_Add_finalize(check_handles_on_finalize, objmem, MPIR_FINALIZE_CALLBACK_HANDLE_CHECK_PRIO);
 #endif
 	    /* ptr points to object to allocate */
 	}
 	else {
 	    /* no space left in direct block; setup the indirect block. */
 
-	    ptr = MPIU_Handle_indirect_init(&objmem->indirect, 
+	    ptr = handle_indirect_init(&objmem->indirect, 
 					    &objmem->indirect_size, 
 					    HANDLE_NUM_BLOCKS,
 					    HANDLE_NUM_INDICES,
@@ -403,7 +349,7 @@ void *MPIU_Handle_obj_alloc_unsafe(MPIU_Object_alloc_t *objmem)
 
 	    /* ptr points to object to allocate */
 	}
-	MPIU_Handle_obj_alloc_complete(objmem, performed_initialize);
+	handle_obj_alloc_complete(objmem, performed_initialize);
     }
 
     if (ptr) {
@@ -574,7 +520,7 @@ const char *MPIU_Handle_get_kind_str(int kind)
    
    When adding memory checking, this routine should be invoked as
 
-   MPIR_Add_finalize(MPIU_CheckHandlesOnFinalize, objmem, 1);
+   MPIR_Add_finalize(check_handles_on_finalize, objmem, 1);
 
    as part of the object intialization.
 
@@ -593,7 +539,7 @@ const char *MPIU_Handle_get_kind_str(int kind)
    the best information, for each free item, we determine to which block
    it belongs.  
 */
-static int MPIU_CheckHandlesOnFinalize( void *objmem_ptr )
+static int check_handles_on_finalize( void *objmem_ptr )
 {
     MPIU_Object_alloc_t *objmem = (MPIU_Object_alloc_t *)objmem_ptr;
     int i;
@@ -635,7 +581,7 @@ static int MPIU_CheckHandlesOnFinalize( void *objmem_ptr )
 	    if (i == objmem->indirect_size) {
 		/* Error - could not find the owning memory */
 		/* Temp */
-		printf( "Could not place object at %p in handle memory for type %s\n", ptr, MPIR_ObjectName( objmem ) );
+		printf( "Could not place object at %p in handle memory for type %s\n", ptr, object_name( objmem ) );
 		printf( "direct block is [%p,%p]\n", direct, directEnd );
 		if (objmem->indirect_size) {
 		    printf( "indirect block is [%p,%p]\n", indirect[0], 
@@ -651,17 +597,17 @@ static int MPIU_CheckHandlesOnFinalize( void *objmem_ptr )
 	/* Produce a report */
 	printf( "Object handles:\n\ttype  \t%s\n\tsize  \t%d\n\tdirect size\t%d\n\
 \tindirect size\t%d\n",
-		MPIR_ObjectName( objmem ), objmem->size, objmem->direct_size, 
+		object_name( objmem ), objmem->size, objmem->direct_size, 
 		objmem->indirect_size );
     }
     if (nDirect != directSize) {
         leaked_handles = TRUE;
-	printf( "In direct memory block for handle type %s, %d handles are still allocated\n", MPIR_ObjectName( objmem ), directSize - nDirect );
+	printf( "In direct memory block for handle type %s, %d handles are still allocated\n", object_name( objmem ), directSize - nDirect );
     }
     for (i=0; i<objmem->indirect_size; i++) {
 	if (nIndirect[i] != HANDLE_NUM_INDICES) {
             leaked_handles = TRUE;
-	    printf( "In indirect memory block %d for handle type %s, %d handles are still allocated\n", i, MPIR_ObjectName( objmem ), HANDLE_NUM_INDICES - nIndirect[i] );
+	    printf( "In indirect memory block %d for handle type %s, %d handles are still allocated\n", i, object_name( objmem ), HANDLE_NUM_INDICES - nIndirect[i] );
 	}
     }
 
@@ -679,7 +625,7 @@ static int MPIU_CheckHandlesOnFinalize( void *objmem_ptr )
     return 0;
 }
 
-static const char *MPIR_ObjectName( MPIU_Object_alloc_t *objmem )
+static const char *object_name( MPIU_Object_alloc_t *objmem )
 {
     return MPIU_Handle_get_kind_str(objmem->kind);
 }
@@ -687,7 +633,7 @@ static const char *MPIR_ObjectName( MPIU_Object_alloc_t *objmem )
 
 #ifdef NEEDS_PRINT_HANDLE
 /* For debugging */
-static void MPIU_Print_handle( int handle )
+static void print_handle( int handle )
 {
     int type, kind, block, index;
 
@@ -712,30 +658,3 @@ static void MPIU_Print_handle( int handle )
     }
 }
 #endif
-
-/*
- * Count the number of objects allocated and the number of objects
- * on the available free list.  Return the difference.
- */
-int MPIU_Handle_obj_outstanding(const MPIU_Object_alloc_t *objmem)
-{
-    int allocated = 0;
-    int available = 0;
-    MPIU_Handle_common *ptr;
-
-    ptr = objmem->avail;
-    while(ptr)
-    {
-        available++;
-        ptr = ptr->next;
-    }
-
-    if(objmem->initialized)
-    {
-        allocated = objmem->direct_size +
-            objmem->indirect_size * HANDLE_NUM_INDICES;
-    }
-
-    return allocated - available;
-}
-

http://git.mpich.org/mpich.git/commitdiff/397516099080f61282221cf5d22bf68451987d58

commit 397516099080f61282221cf5d22bf68451987d58
Author: Pavan Balaji <balaji at anl.gov>
Date:   Wed Dec 30 11:24:33 2015 -0600

    argstr: remove unused string manipulation code.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpimem.h b/src/include/mpimem.h
index f69a37b..7d6c066 100644
--- a/src/include/mpimem.h
+++ b/src/include/mpimem.h
@@ -121,7 +121,6 @@ int MPIU_Str_add_binary_arg(char **str_ptr, int *maxlen_ptr, const char *key,
 			    const char *buffer, int length);
 int MPIU_Str_add_int_arg(char **str_ptr, int *maxlen_ptr, const char *key, 
 			 int val);
-MPIU_BOOL MPIU_Str_hide_string_arg(char *str, const char *key);
 int MPIU_Str_add_string(char **str_ptr, int *maxlen_ptr, const char *val);
 int MPIU_Str_get_string(char **str_ptr, char *val, int maxlen);
 
diff --git a/src/util/mem/argstr.c b/src/util/mem/argstr.c
index 235404b..ca49a98 100644
--- a/src/util/mem/argstr.c
+++ b/src/util/mem/argstr.c
@@ -340,62 +340,6 @@ static int token_copy(const char *token, char *str, int maxlen)
     return MPIU_STR_TRUNCATED;
 }
 
-static void token_hide(char *token)
-{
-    /* check parameters */
-    if (token == NULL)
-	return;
-
-    /* cosy up to the token */
-    token = (char*)first_token(token);
-    if (token == NULL)
-	return;
-
-    if (*token == MPIU_STR_DELIM_CHAR)
-    {
-	*token = MPIU_STR_HIDE_CHAR;
-	return;
-    }
-
-    /* quoted */
-    if (*token == MPIU_STR_QUOTE_CHAR)
-    {
-	*token = MPIU_STR_HIDE_CHAR;
-	token++; /* move over the first quote */
-	while (*token != '\0')
-	{
-	    if (*token == MPIU_STR_ESCAPE_CHAR)
-	    {
-		if (*(token+1) == MPIU_STR_QUOTE_CHAR)
-		{
-		    *token = MPIU_STR_HIDE_CHAR;
-		    token++;
-		}
-		*token = MPIU_STR_HIDE_CHAR;
-	    }
-	    else
-	    {
-		if (*token == MPIU_STR_QUOTE_CHAR)
-		{
-		    *token = MPIU_STR_HIDE_CHAR;
-		    return;
-		}
-		*token = MPIU_STR_HIDE_CHAR;
-	    }
-	    token++;
-	}
-	return;
-    }
-
-    /* literal */
-    while (*token != MPIU_STR_DELIM_CHAR && 
-	   (*token != MPIU_STR_SEPAR_CHAR) && *token != '\0')
-    {
-	*token = MPIU_STR_HIDE_CHAR;
-	token++;
-    }
-}
-
 /*@ MPIU_Str_get_string_arg - Extract an option from a string with a 
   maximum length
   
@@ -506,55 +450,6 @@ int MPIU_Str_get_binary_arg(const char *str, const char *flag, char *buffer,
     return MPIU_STR_FAIL;
 }
 
-/*@ MPIU_Str_hide_string_arg - Over-write the value of an string option 
-  with * characters
-  
-Input Parameters:
-+   str - input string
--   key - key
-
-Output Parameters:
-.   str - The string data is modified if the key is found in the string
-
-    Return value:
-    MPIU_STR_SUCCESS, MPIU_STR_FAIL
-
-    Notes:
-    This routine covers an option in a string converting "key = value" to 
-    "key = *****"
-
-  Module:
-  Utility
-  @*/
-MPIU_BOOL MPIU_Str_hide_string_arg(char *str, const char *flag)
-{
-    /* line up with the first token */
-    str = (char*)first_token(str);
-    if (str == NULL)
-	return TRUE;
-
-    do
-    {
-	if (compare_token(str, flag) == 0)
-	{
-	    str = (char*)next_token(str);
-	    if (compare_token(str, MPIU_STR_DELIM_STR) == 0)
-	    {
-		str = (char*)next_token(str);
-		if (str == NULL)
-		    return TRUE;
-		token_hide(str);
-		return TRUE;
-	    }
-	}
-	else
-	{
-	    str = (char*)next_token(str);
-	}
-    } while (str);
-    return FALSE;
-}
-
 /*@ MPIU_Str_get_int_arg - Extract an option from a string
   
 Input Parameters:
@@ -814,7 +709,6 @@ int MPIU_Str_add_string_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
 	return MPIU_STR_FAIL;
 
     /* add the flag */
-/*     printf("strstr flag\n"); */
     if (strstr(flag, MPIU_STR_SEPAR_STR) || strstr(flag, MPIU_STR_DELIM_STR) ||
 	flag[0] == MPIU_STR_QUOTE_CHAR)
     {
@@ -830,7 +724,6 @@ int MPIU_Str_add_string_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
 	MPIU_DBG_MSG_S(OTHER,VERBOSE,
                   "partial argument added to string: '%s'", *str_ptr);
 	**str_ptr = '\0';
-	/*(*str_ptr)[num_chars-1] = '\0';*/
 	return MPIU_STR_NOMEM;
     }
     *str_ptr = *str_ptr + num_chars;
@@ -841,7 +734,6 @@ int MPIU_Str_add_string_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
     *maxlen_ptr = *maxlen_ptr - 1;
 
     /* add the value string */
-/*     printf("strstr val\n"); */
     if (strstr(val, MPIU_STR_SEPAR_STR) || strstr(val, MPIU_STR_DELIM_STR) ||
 	val[0] == MPIU_STR_QUOTE_CHAR)
     {
@@ -866,10 +758,6 @@ int MPIU_Str_add_string_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
 	MPIU_DBG_MSG_S(OTHER,VERBOSE,
 		       "partial argument added to string: '%s'", *str_ptr);
 	**orig_str_ptr = '\0';
-	/*
-	*str_ptr = *str_ptr - 1;
-	**str_ptr = '\0';
-	*/
 	return MPIU_STR_NOMEM;
     }
     
@@ -967,7 +855,6 @@ int MPIU_Str_add_binary_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
 	MPIU_DBG_MSG_S(OTHER,VERBOSE,
 		       "partial argument added to string: '%s'", *str_ptr);
 	**str_ptr = '\0';
-	/*(*str_ptr)[num_chars-1] = '\0';*/
 	return MPIU_STR_NOMEM;
     }
     *str_ptr = *str_ptr + num_chars;
@@ -992,10 +879,6 @@ int MPIU_Str_add_binary_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
     {
 	MPIU_DBG_MSG_S(OTHER,VERBOSE,
 		       "partial argument added to string: '%s'", *str_ptr);
-	/*
-	*str_ptr = *str_ptr - 1;
-	**str_ptr = '\0';
-	*/
 	**orig_str_ptr = '\0';
 	return MPIU_STR_NOMEM;
     }
@@ -1008,69 +891,3 @@ int MPIU_Str_add_binary_arg(char **str_ptr, int *maxlen_ptr, const char *flag,
 
     return MPIU_STR_SUCCESS;
 }
-
-/*
-int test_argstrings()
-{
-    char buffer[1024];
-    char buffer2[1024];
-    char key[100];
-    char val[1024];
-    int maxlen, maxlen2;
-    char *iter, *iter2;
-    int ibuf[3] = { 1, 2, 3 };
-    int age;
-
-    iter = buffer;
-    maxlen = 1024;
-    MPIU_Str_add_string_arg(&iter, &maxlen, "name", "David Ashton");
-    MPIU_Str_add_string_arg(&iter, &maxlen, "a b", "c d");
-    MPIU_Str_add_binary_arg(&iter, &maxlen, "array", ibuf, 12);
-    MPIU_Str_add_string_arg(&iter, &maxlen, "=", "equals");
-    MPIU_Str_add_string_arg(&iter, &maxlen, "\"help=", "=\"");
-    MPIU_Str_add_int_arg(&iter, &maxlen, "age", 123);
-
-    printf("encoded buffer: <%s>\n", buffer);
-
-    MPIU_Str_get_string_arg(buffer, "name", val, 1024);
-    printf("name = '%s'\n", val);
-    MPIU_Str_get_string_arg(buffer, "a b", val, 1024);
-    printf("a b = '%s'\n", val);
-    MPIU_Str_get_string_arg(buffer, "=", val, 1024);
-    printf("= = '%s'\n", val);
-    MPIU_Str_get_string_arg(buffer, "\"help=", val, 1024);
-    printf("\"help= = '%s'\n", val);
-    MPIU_Str_get_int_arg(buffer, "age", &age);
-    printf("age = %d\n", age);
-    MPIU_Str_get_binary_arg(buffer, "array", ibuf, 12);
-    printf("ibuf[0] = %d\n", ibuf[0]);
-    printf("ibuf[1] = %d\n", ibuf[1]);
-    printf("ibuf[2] = %d\n", ibuf[2]);
-
-    iter = buffer2;
-    maxlen = 1024;
-    MPIU_Str_add_string_arg(&iter, &maxlen, "big arg", buffer);
-    MPIU_Str_add_string(&iter, &maxlen, "Once isn't enough for me");
-    MPIU_Str_add_int_arg(&iter, &maxlen, "size", 100);
-    printf("doubly encoded buffer: <%s>\n", buffer2);
-
-    MPIU_Str_get_string_arg(buffer2, "big arg", buffer, 1024);
-    printf("big arg = '%s'\n", buffer);
-    MPIU_Str_get_string_arg(buffer, "name", val, 1024);
-    printf("name = '%s'\n", val);
-    MPIU_Str_get_string_arg(buffer, "a b", val, 1024);
-    printf("a b = '%s'\n", val);
-    MPIU_Str_get_string_arg(buffer, "=", val, 1024);
-    printf("= = '%s'\n", val);
-    MPIU_Str_get_int_arg(buffer, "age", &age);
-    printf("age = %d\n", age);
-    MPIU_Str_get_binary_arg(buffer, "array", ibuf, 12);
-    printf("ibuf[0] = %d\n", ibuf[0]);
-    printf("ibuf[1] = %d\n", ibuf[1]);
-    printf("ibuf[2] = %d\n", ibuf[2]);
-
-    MPIU_Str_get_int_arg(buffer2, "size", &age);
-    printf("size = %d\n", age);
-    return 0;
-}
-*/

http://git.mpich.org/mpich.git/commitdiff/8f7f8770cd59a120815dd67251b92a3fca943aca

commit 8f7f8770cd59a120815dd67251b92a3fca943aca
Author: Pavan Balaji <balaji at anl.gov>
Date:   Wed Dec 30 16:09:34 2015 -0600

    safestr: move strnapp to MPL.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpimem.h b/src/include/mpimem.h
index 0b5ba7d..f69a37b 100644
--- a/src/include/mpimem.h
+++ b/src/include/mpimem.h
@@ -75,9 +75,6 @@ extern "C" {
   D*/
 
 /* Define the string copy and duplication functions */
-/* Safer string routines */
-int MPIU_Strnapp( char *, const char *, size_t );
-
 /* ---------------------------------------------------------------------- */
 /* FIXME - The string routines do not belong in the memory header file  */
 /* FIXME - The string error code such be MPICH-usable error codes */
diff --git a/src/mpl/include/mpl_str.h b/src/mpl/include/mpl_str.h
index 102811a..c6e3255 100644
--- a/src/mpl/include/mpl_str.h
+++ b/src/mpl/include/mpl_str.h
@@ -57,6 +57,8 @@ extern char *strerror(int errnum);
 char *MPL_strerror(int errnum);
 #endif /* MPL_HAVE_STRERROR */
 
+int MPL_strnapp(char *dest, const char *src, size_t n);
+
 /* *INDENT-ON* */
 #if defined(__cplusplus)
 }
diff --git a/src/mpl/src/str/mpl_str.c b/src/mpl/src/str/mpl_str.c
index 941493b..0595b95 100644
--- a/src/mpl/src/str/mpl_str.c
+++ b/src/mpl/src/str/mpl_str.c
@@ -312,3 +312,55 @@ char *MPL_strerror(int errnum)
     return msgbuf;
 }
 #endif /* MPL_HAVE_STRERROR */
+
+/*@ MPL_strnapp - Append to a string with a maximum length
+
+Input Parameters:
++   instr - String to copy
+-   maxlen - Maximum total length of 'outstr'
+
+Output Parameters:
+.   outstr - String to copy into
+
+    Notes:
+    This routine is similar to 'strncat' except that the 'maxlen' argument
+    is the maximum total length of 'outstr', rather than the maximum
+    number of characters to move from 'instr'.  Thus, this routine is
+    easier to use when the declared size of 'instr' is known.
+
+  Module:
+  Utility
+  @*/
+int MPL_strnapp(char *dest, const char *src, size_t n)
+{
+    char *mpl_restrict d_ptr = dest;
+    const char *mpl_restrict s_ptr = src;
+    register int i;
+
+    /* Get to the end of dest */
+    i = (int) n;
+    while (i-- > 0 && *d_ptr)
+        d_ptr++;
+    if (i <= 0)
+        return 1;
+
+    /* Append.  d_ptr points at first null and i is remaining space. */
+    while (*s_ptr && i-- > 0) {
+        *d_ptr++ = *s_ptr++;
+    }
+
+    /* We allow i >= (not just >) here because the first while decrements
+     * i by one more than there are characters, leaving room for the null */
+    if (i >= 0) {
+        *d_ptr = 0;
+        return 0;
+    }
+    else {
+        /* Force the null at the end */
+        *--d_ptr = 0;
+
+        /* We may want to force an error message here, at least in the
+         * debugging version */
+        return 1;
+    }
+}
diff --git a/src/nameserv/file/file_nameserv.c b/src/nameserv/file/file_nameserv.c
index d63f897..858b093 100644
--- a/src/nameserv/file/file_nameserv.c
+++ b/src/nameserv/file/file_nameserv.c
@@ -93,7 +93,7 @@ int MPID_NS_Create( const MPID_Info *info_ptr, MPID_NS_Handle *handle_ptr )
     }
 
     MPL_strncpy( (*handle_ptr)->dirname, dirname, MAXPATHLEN );
-    MPIU_Strnapp( (*handle_ptr)->dirname, "/.mpinamepub/", MAXPATHLEN );
+    MPL_strnapp( (*handle_ptr)->dirname, "/.mpinamepub/", MAXPATHLEN );
 
     /* Make the directory if necessary */
     /* FIXME : Determine if the directory exists before trying to create it */
@@ -123,7 +123,7 @@ int MPID_NS_Publish( MPID_NS_Handle handle, const MPID_Info *info_ptr,
     /* Determine file and directory name.  The file name is from
        the service name */
     MPL_strncpy( filename, handle->dirname, MAXPATHLEN );
-    MPIU_Strnapp( filename, service_name, MAXPATHLEN );
+    MPL_strnapp( filename, service_name, MAXPATHLEN );
 
     /* Add the file name to the known files now, in case there is 
        a failure during open or writing */
@@ -207,7 +207,7 @@ int MPID_NS_Lookup( MPID_NS_Handle handle, const MPID_Info *info_ptr,
     /* Determine file and directory name.  The file name is from
        the service name */
     MPL_strncpy( filename, handle->dirname, MAXPATHLEN );
-    MPIU_Strnapp( filename, service_name, MAXPATHLEN );
+    MPL_strnapp( filename, service_name, MAXPATHLEN );
 
     fp = fopen( filename, "r" );
     if (!fp) {
@@ -255,7 +255,7 @@ int MPID_NS_Unpublish( MPID_NS_Handle handle, const MPID_Info *info_ptr,
     /* Determine file and directory name.  The file name is from
        the service name */
     MPL_strncpy( filename, handle->dirname, MAXPATHLEN );
-    MPIU_Strnapp( filename, service_name, MAXPATHLEN );
+    MPL_strnapp( filename, service_name, MAXPATHLEN );
 
     /* Find the filename from the list of published files */
     for (i=0; i<handle->nactive; i++) {
diff --git a/src/pm/gforker/mpiexec.c b/src/pm/gforker/mpiexec.c
index 3d2987e..1951a17 100644
--- a/src/pm/gforker/mpiexec.c
+++ b/src/pm/gforker/mpiexec.c
@@ -310,7 +310,7 @@ int mypreamble( void *data, ProcessState *pState )
 	ranks[0] = 0;
 	for (i=0; i<size; i++) {
 	    MPL_snprintf( digits, sizeof(digits), "%d,", i );
-	    MPIU_Strnapp( ranks, digits, sizeof(ranks) );
+	    MPL_strnapp( ranks, digits, sizeof(ranks) );
 	}
 	/* Remove the trailing comma */
 	if (size > 0) 
diff --git a/src/pm/remshell/mpiexec.c b/src/pm/remshell/mpiexec.c
index 5a8c2c8..c446a28 100644
--- a/src/pm/remshell/mpiexec.c
+++ b/src/pm/remshell/mpiexec.c
@@ -440,8 +440,8 @@ static int AddEnvSetToCmdLine( const char *envName, const char *envValue,
 	char tmpBuf[1024];
 	args[nArgs++] = MPIU_Strdup( "export" );
 	MPL_strncpy( tmpBuf, envName, sizeof(tmpBuf) );
-	MPIU_Strnapp( tmpBuf, "=", sizeof(tmpBuf) );
-	MPIU_Strnapp( tmpBuf, envValue, sizeof(tmpBuf) );
+	MPL_strnapp( tmpBuf, "=", sizeof(tmpBuf) );
+	MPL_strnapp( tmpBuf, envValue, sizeof(tmpBuf) );
 	args[nArgs++] = MPIU_Strdup( tmpBuf );
 	args[nArgs++] = MPIU_Strdup( ";" );
     }
diff --git a/src/pm/util/Makefile.mk b/src/pm/util/Makefile.mk
index 7b618ff..d2bc522 100644
--- a/src/pm/util/Makefile.mk
+++ b/src/pm/util/Makefile.mk
@@ -34,8 +34,8 @@ EXTRA_src_pm_util_libmpiexec_la_DEPENDENCIES = $(mpllib)
 
 # We use the msg print routines (for now) - include these in the mpiexec
 # library so that we don't need to copy the source files
-# safestr2 and simple_pmiutil2 are subsets of safestr and simple_pmiutil
-# respectively, since these may no longer be used by other applications
+# simple_pmiutil2 is a subset of simple_pmiutil,
+# since it may no longer be used by other applications
 # (they make use of routines like the trmem routines that may no longer
 # be used by other applications).
 #
@@ -51,7 +51,6 @@ src_pm_util_libmpiexec_la_SOURCES = \
     src/pm/util/rm.c               \
     src/pm/util/pmiport.c          \
     src/pm/util/dbgiface.c         \
-    src/pm/util/safestr2.c         \
     src/pm/util/simple_pmiutil2.c
 
 endif BUILD_PM_UTIL
diff --git a/src/pm/util/env.c b/src/pm/util/env.c
index 7fbe3cf..8da4cd9 100644
--- a/src/pm/util/env.c
+++ b/src/pm/util/env.c
@@ -267,8 +267,8 @@ int MPIE_EnvInitData( EnvData *elist, int getValue )
 	    }
 	    MPL_strncpy( str, elist->name, slen );
 	    if (value && *value) {
-		rc = MPIU_Strnapp( str, "=", slen );
-		rc += MPIU_Strnapp( str, value, slen );
+		rc = MPL_strnapp( str, "=", slen );
+		rc += MPL_strnapp( str, value, slen );
 		if (rc) {
 		    return 1;
 		}
diff --git a/src/pm/util/pmutil.h b/src/pm/util/pmutil.h
index 98d39ca..9f897f5 100644
--- a/src/pm/util/pmutil.h
+++ b/src/pm/util/pmutil.h
@@ -91,7 +91,7 @@ extern int MPIE_Debug;
 #define MPIU_Realloc(a,b)  realloc((void *)(a),(size_t)(b))
 
 int MPL_strncpy( char *outstr, const char *instr, size_t maxlen );
-int MPIU_Strnapp( char *, const char *, size_t );
+int MPL_strnapp( char *, const char *, size_t );
 char *MPIU_Strdup( const char * );
 
 #ifdef HAVE_STRDUP
diff --git a/src/pm/util/process.c b/src/pm/util/process.c
index 3c832ca..039ec35 100644
--- a/src/pm/util/process.c
+++ b/src/pm/util/process.c
@@ -350,7 +350,7 @@ int MPIE_ExecProgram( ProcessState *pState, char *envp[] )
 	   certain files or libraries, for example cygwin1.dll for
 	   Cygwin */
 #ifdef NEEDS_BIN_IN_PATH
-	MPIU_Strnapp( pathstring, ":/bin", sizeof(pathstring)-1 );
+	MPL_strnapp( pathstring, ":/bin", sizeof(pathstring)-1 );
 #endif
 	putenv( pathstring );
 
diff --git a/src/pm/util/rm.c b/src/pm/util/rm.c
index 274563d..59e7ea3 100644
--- a/src/pm/util/rm.c
+++ b/src/pm/util/rm.c
@@ -240,7 +240,7 @@ MachineTable *MPIE_ReadMachines( const char *arch, int nNeeded,
 	}
 	else {
 	    MPL_strncpy( machinesfile, dirname, PATH_MAX );
-	    MPIU_Strnapp( machinesfile, "/machines", PATH_MAX );
+	    MPL_strnapp( machinesfile, "/machines", PATH_MAX );
 	}
 	DBG_PRINTF( ("Attempting to open %s\n", machinesfile) );
 	fp = fopen( machinesfile, "r" );
diff --git a/src/pm/util/safestr2.c b/src/pm/util/safestr2.c
deleted file mode 100644
index 1b7aad1..0000000
--- a/src/pm/util/safestr2.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpichconf.h"
-#include "mpimem.h"
-
-/* 
- * This file contains two of the routines from the "safe" versions of the 
- * various string routines in src/util/mem/safestr.c .  These are duplicated
- * here because the MPICH utility routines can no longer be used by other
- * applications.
- */
-
-/*
- * MPL_strncpy - Copy at most n characters.  Stop once a null is reached.
- *
- * This is different from strncpy, which null pads so that exactly
- * n characters are copied.  The strncpy behavior is correct for many 
- * applications because it guarantees that the string has no uninitialized
- * data.
- *
- * If n characters are copied without reaching a null, return an error.
- * Otherwise, return 0.
- *
- * Question: should we provide a way to request the length of the string,
- * since we know it?
- */
-/*@ MPL_strncpy - Copy a string with a maximum length
-  
-Input Parameters:
-+   instr - String to copy
--   maxlen - Maximum total length of 'outstr'
-
-Output Parameters:
-.   outstr - String to copy into
-
-    Notes:
-    This routine is the routine that you wish 'strncpy' was.  In copying 
-    'instr' to 'outstr', it stops when either the end of 'outstr' (the 
-    null character) is seen or the maximum length 'maxlen' is reached.
-    Unlike 'strncpy', it does not add enough nulls to 'outstr' after 
-    copying 'instr' in order to move precisely 'maxlen' characters.  
-    Thus, this routine may be used anywhere 'strcpy' is used, without any
-    performance cost related to large values of 'maxlen'.
-
-    If there is insufficient space in the destination, the destination is
-    still null-terminated, to avoid potential failures in routines that neglect
-    to check the error code return from this routine.
-
-  Module:
-  Utility
-  @*/
-int MPL_strncpy( char *dest, const char *src, size_t n )
-{
-    char * restrict d_ptr = dest;
-    const char * restrict s_ptr = src;
-    register int i;
-
-    if (n == 0) return 0;
-
-    i = (int)n;
-    while (*s_ptr && i-- > 0) {
-	*d_ptr++ = *s_ptr++;
-    }
-    
-    if (i > 0) { 
-	*d_ptr = 0;
-	return 0;
-    }
-    else {
-	/* Force a null at the end of the string (gives better safety 
-	   in case the user fails to check the error code) */
-	dest[n-1] = 0;
-	/* We may want to force an error message here, at least in the
-	   debugging version */
-	/*printf( "failure in copying %s with length %d\n", src, n ); */
-	return 1;
-    }
-}
-
-/* Append src to dest, but only allow dest to contain n characters (including
-   any null, which is always added to the end of the line */
-/*@ MPIU_Strnapp - Append to a string with a maximum length
-
-Input Parameters:
-+   instr - String to copy
--   maxlen - Maximum total length of 'outstr'
-
-Output Parameters:
-.   outstr - String to copy into
-
-    Notes:
-    This routine is similar to 'strncat' except that the 'maxlen' argument
-    is the maximum total length of 'outstr', rather than the maximum 
-    number of characters to move from 'instr'.  Thus, this routine is
-    easier to use when the declared size of 'instr' is known.
-
-  Module:
-  Utility
-  @*/
-int MPIU_Strnapp( char *dest, const char *src, size_t n )
-{
-    char * restrict d_ptr = dest;
-    const char * restrict s_ptr = src;
-    register int i;
-
-    /* Get to the end of dest */
-    i = (int)n;
-    while (i-- > 0 && *d_ptr) d_ptr++;
-    if (i <= 0) return 1;
-
-    /* Append.  d_ptr points at first null and i is remaining space. */
-    while (*s_ptr && i-- > 0) {
-	*d_ptr++ = *s_ptr++;
-    }
-
-    /* We allow i >= (not just >) here because the first while decrements
-       i by one more than there are characters, leaving room for the null */
-    if (i >= 0) { 
-	*d_ptr = 0;
-	return 0;
-    }
-    else {
-	/* Force the null at the end */
-	*--d_ptr = 0;
-    
-	/* We may want to force an error message here, at least in the
-	   debugging version */
-	return 1;
-    }
-}
-
diff --git a/src/pmi/pmi2/simple/pmi2compat.h b/src/pmi/pmi2/simple/pmi2compat.h
index fcb2389..a926331 100644
--- a/src/pmi/pmi2/simple/pmi2compat.h
+++ b/src/pmi/pmi2/simple/pmi2compat.h
@@ -9,8 +9,7 @@
 #define PMI2U_Malloc MPIU_Malloc
 #define PMI2U_Free MPIU_Free
 #define PMI2U_Strdup MPIU_Strdup
-#define PMI2U_Strncpy MPL_strncpy
-#define PMI2U_Strnapp MPIU_Strnapp
+#define PMI2U_Strnapp MPL_strnapp
 #define PMI2U_Assert MPIU_Assert
 #define PMI2U_Exit MPL_exit
 #define PMI2U_Info MPID_Info
diff --git a/src/pmi/simple/simple_pmi.c b/src/pmi/simple/simple_pmi.c
index b4a2a0d..9053b8d 100644
--- a/src/pmi/simple/simple_pmi.c
+++ b/src/pmi/simple/simple_pmi.c
@@ -573,7 +573,7 @@ int PMI_Spawn_multiple(int count,
 	if (rc < 0) { 
 	    return PMI_FAIL;
 	}
-	rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE);
+	rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE);
 	if (rc != 0) {
 	    return PMI_FAIL;
 	}
@@ -597,7 +597,7 @@ int PMI_Spawn_multiple(int count,
 		if (rc < 0) {
 		    return PMI_FAIL;
 		}
-                rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE);
+                rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE);
 		if (rc != 0) {
 		    return PMI_FAIL;
 		}
@@ -611,7 +611,7 @@ int PMI_Spawn_multiple(int count,
 	if (rc < 0) {
 	    return PMI_FAIL;
 	}
-        rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE);
+        rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE);
 	if (rc != 0) {
 	    return PMI_FAIL;
 	}
@@ -622,7 +622,7 @@ int PMI_Spawn_multiple(int count,
 	    return PMI_FAIL;
 	}
 
-        rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE);
+        rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE);
 	if (rc != 0) {
 	    return PMI_FAIL;
 	}
@@ -632,7 +632,7 @@ int PMI_Spawn_multiple(int count,
 	    if (rc < 0) {
 		return PMI_FAIL;
 	    }
-	    rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE); 
+	    rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE); 
 	    if (rc != 0) {
 		return PMI_FAIL;
 	    }
@@ -641,7 +641,7 @@ int PMI_Spawn_multiple(int count,
 	    if (rc < 0) {
 		return PMI_FAIL;
 	    }
-	    rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE); 
+	    rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE); 
 	    if (rc != 0) {
 		return PMI_FAIL;
 	    }
@@ -651,7 +651,7 @@ int PMI_Spawn_multiple(int count,
 	if (rc < 0) {
 	    return PMI_FAIL;
 	}
-        rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE);
+        rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE);
 	if (rc != 0) {
 	    return PMI_FAIL;
 	}
@@ -662,7 +662,7 @@ int PMI_Spawn_multiple(int count,
 	    if (rc < 0) {
 		return PMI_FAIL;
 	    }
-	    rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE); 
+	    rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE); 
 	    if (rc != 0) {
 		return PMI_FAIL;
 	    }
@@ -671,13 +671,13 @@ int PMI_Spawn_multiple(int count,
 	    if (rc < 0) {
 		return PMI_FAIL;
 	    }
-	    rc = MPIU_Strnapp(buf,tempbuf,PMIU_MAXLINE); 
+	    rc = MPL_strnapp(buf,tempbuf,PMIU_MAXLINE); 
 	    if (rc != 0) {
 		return PMI_FAIL;
 	    }
 	}
 
-        rc = MPIU_Strnapp(buf, "endcmd\n", PMIU_MAXLINE);
+        rc = MPL_strnapp(buf, "endcmd\n", PMIU_MAXLINE);
 	if (rc != 0) {
 	    return PMI_FAIL;
 	}
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 78cdec7..ab84150 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -1048,7 +1048,7 @@ static int MPIU_DBG_Get_filename(char *filename, int len)
                 MPL_snprintf( rankAsChar, sizeof(rankAsChar), "%d", 
                                worldRank );
                 *pDest = 0;
-                MPIU_Strnapp( filename, rankAsChar, len );
+                MPL_strnapp( filename, rankAsChar, len );
                 pDest += strlen(rankAsChar);
             }
             else if (*p == 't') {
@@ -1061,7 +1061,7 @@ static int MPIU_DBG_Get_filename(char *filename, int len)
                 MPL_snprintf( threadIDAsChar, sizeof(threadIDAsChar), 
                                "%llx", threadID );
                 *pDest = 0;
-                MPIU_Strnapp( filename, threadIDAsChar, len );
+                MPL_strnapp( filename, threadIDAsChar, len );
                 pDest += strlen(threadIDAsChar);
 #else
                 *pDest++ = '0';
@@ -1071,7 +1071,7 @@ static int MPIU_DBG_Get_filename(char *filename, int len)
                 /* FIXME: Get world number */
                 /* *pDest++ = '0'; */
                 *pDest = 0;
-                MPIU_Strnapp( filename, worldNumAsChar, len );
+                MPL_strnapp( filename, worldNumAsChar, len );
                 pDest += strlen(worldNumAsChar);
             }
             else if (*p == 'p') {
@@ -1084,7 +1084,7 @@ static int MPIU_DBG_Get_filename(char *filename, int len)
 #endif /* HAVE_GETPID */
                 MPL_snprintf( pidAsChar, sizeof(pidAsChar), "%d", (int)pid );
                 *pDest = 0;
-                MPIU_Strnapp( filename, pidAsChar, len );
+                MPL_strnapp( filename, pidAsChar, len );
                 pDest += strlen(pidAsChar);
             }
             else {
diff --git a/src/util/mem/Makefile.mk b/src/util/mem/Makefile.mk
index cc3aa78..d8b4217 100644
--- a/src/util/mem/Makefile.mk
+++ b/src/util/mem/Makefile.mk
@@ -13,7 +13,6 @@ noinst_HEADERS +=                               \
 mpi_core_sources += \
     src/util/mem/trmem.c      \
     src/util/mem/handlemem.c  \
-    src/util/mem/safestr.c    \
     src/util/mem/argstr.c     \
     src/util/mem/strerror.c
 
diff --git a/src/util/mem/safestr.c b/src/util/mem/safestr.c
deleted file mode 100644
index a5d43e3..0000000
--- a/src/util/mem/safestr.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpichconf.h"
-#include "mpimem.h"
-
-/* style: allow:sprintf:1 sig:0 */
-
-/* 
- * This file contains "safe" versions of the various string and printf
- * operations.
- */
-
-/* Append src to dest, but only allow dest to contain n characters (including
-   any null, which is always added to the end of the line */
-/*@ MPIU_Strnapp - Append to a string with a maximum length
-
-Input Parameters:
-+   instr - String to copy
--   maxlen - Maximum total length of 'outstr'
-
-Output Parameters:
-.   outstr - String to copy into
-
-    Notes:
-    This routine is similar to 'strncat' except that the 'maxlen' argument
-    is the maximum total length of 'outstr', rather than the maximum 
-    number of characters to move from 'instr'.  Thus, this routine is
-    easier to use when the declared size of 'instr' is known.
-
-  Module:
-  Utility
-  @*/
-int MPIU_Strnapp( char *dest, const char *src, size_t n )
-{
-    char * restrict d_ptr = dest;
-    const char * restrict s_ptr = src;
-    register int i;
-
-    /* Get to the end of dest */
-    i = (int)n;
-    while (i-- > 0 && *d_ptr) d_ptr++;
-    if (i <= 0) return 1;
-
-    /* Append.  d_ptr points at first null and i is remaining space. */
-    while (*s_ptr && i-- > 0) {
-	*d_ptr++ = *s_ptr++;
-    }
-
-    /* We allow i >= (not just >) here because the first while decrements
-       i by one more than there are characters, leaving room for the null */
-    if (i >= 0) { 
-	*d_ptr = 0;
-	return 0;
-    }
-    else {
-	/* Force the null at the end */
-	*--d_ptr = 0;
-    
-	/* We may want to force an error message here, at least in the
-	   debugging version */
-	return 1;
-    }
-}
diff --git a/src/util/mem/strerror.c b/src/util/mem/strerror.c
index 243b406..a409b59 100644
--- a/src/util/mem/strerror.c
+++ b/src/util/mem/strerror.c
@@ -4,9 +4,6 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-/* This would live in safestr.c, but it requires thread-private storage support
- * from mpiimpl.h and friends.  safestr.c is meant to be able to be used in
- * different software packages, perhaps someday by moving it to MPL. */
 #include "mpiimpl.h"
 
 #if defined(HAVE_STRERROR_R) && defined(NEEDS_STRERROR_R_DECL)

http://git.mpich.org/mpich.git/commitdiff/fba6815857d0a05fc4b48370ea5206b5eac11f6d

commit fba6815857d0a05fc4b48370ea5206b5eac11f6d
Author: Pavan Balaji <balaji at anl.gov>
Date:   Wed Dec 30 16:05:09 2015 -0600

    safestr: make MPIU_Basename a static function and rename.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpimem.h b/src/include/mpimem.h
index fffceb5..0b5ba7d 100644
--- a/src/include/mpimem.h
+++ b/src/include/mpimem.h
@@ -414,13 +414,6 @@ if (pointer_) { \
 #   error "No function defined for case-insensitive strncmp"
 #endif
 
-/* MPIU_Basename(path, basename)
-   This function finds the basename in a path (ala "man 1 basename").
-   *basename will point to an element in path.
-   More formally: This function sets basename to the character just after the last '/' in path.
-*/
-void MPIU_Basename(char *path, char **basename);
-
 /* Evaluates to a boolean expression, true if the given byte ranges overlap,
  * false otherwise.  That is, true iff [a_,a_+a_len_) overlaps with [b_,b_+b_len_) */
 #define MPIU_MEM_RANGES_OVERLAP(a_,a_len_,b_,b_len_) \
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 528f199..78cdec7 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -77,6 +77,24 @@ static int dbg_rank = -1;
 
 static void dbg_init(void);
 
+/*
+   This function finds the basename in a path (ala "man 1 basename").
+   *basename will point to an element in path.
+   More formally: This function sets basename to the character just after the last '/' in path.
+*/
+static void find_basename(char *path, char **basename)
+{
+    char *c;
+
+    c = *basename = path;
+    while (*c)
+    {
+        if (*c == '/')
+            *basename = c+1;
+        ++c;
+    } 
+}
+
 int MPIU_dbg_init(int rank)
 {
     dbg_rank = rank;
@@ -852,7 +870,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     ret = MPL_strncpy(temp_filename, filePattern, MAXPATHLEN);
     if (ret) goto fn_fail;
     
-    MPIU_Basename(temp_filename, &basename);
+    find_basename(temp_filename, &basename);
 
     /* make sure there's enough room in temp_filename to store temp_pattern */
     if (basename - temp_filename > MAXPATHLEN - sizeof(temp_pattern)) goto fn_fail;
@@ -892,7 +910,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     ret = MPL_strncpy(temp_filename, filePattern, MAXPATHLEN);
     if (ret) goto fn_fail;
 
-    MPIU_Basename(temp_filename, &basename);
+    find_basename(temp_filename, &basename);
 
     /* make sure there's enough room in temp_filename to store temp_pattern */
     if (basename - temp_filename > MAXPATHLEN - sizeof(temp_pattern)) goto fn_fail;
diff --git a/src/util/mem/safestr.c b/src/util/mem/safestr.c
index 313448e..a5d43e3 100644
--- a/src/util/mem/safestr.c
+++ b/src/util/mem/safestr.c
@@ -65,21 +65,3 @@ int MPIU_Strnapp( char *dest, const char *src, size_t n )
 	return 1;
     }
 }
-
-/* MPIU_Basename(path, basename)
-   This function finds the basename in a path (ala "man 1 basename").
-   *basename will point to an element in path.
-   More formally: This function sets basename to the character just after the last '/' in path.
-*/
-void MPIU_Basename(char *path, char **basename)
-{
-    char *c;
-
-    c = *basename = path;
-    while (*c)
-    {
-        if (*c == '/')
-            *basename = c+1;
-        ++c;
-    } 
-}

http://git.mpich.org/mpich.git/commitdiff/37f967c93e2016e096e653a8de2f22a53a365f78

commit 37f967c93e2016e096e653a8de2f22a53a365f78
Author: Pavan Balaji <balaji at anl.gov>
Date:   Wed Dec 30 15:18:07 2015 -0600

    safestr: use MPL_ routines where available.
    
    In some cases, we had MPIU and MPL routines for the same functionality
    (in fact, the code was duplicated).  This patch deletes the MPIU
    functionality and uses MPL in the MPICH code.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpimem.h b/src/include/mpimem.h
index 71ee499..fffceb5 100644
--- a/src/include/mpimem.h
+++ b/src/include/mpimem.h
@@ -76,10 +76,7 @@ extern "C" {
 
 /* Define the string copy and duplication functions */
 /* Safer string routines */
-int MPIU_Strncpy( char *outstr, const char *instr, size_t maxlen );
-
 int MPIU_Strnapp( char *, const char *, size_t );
-char *MPIU_Strdup( const char * );
 
 /* ---------------------------------------------------------------------- */
 /* FIXME - The string routines do not belong in the memory header file  */
@@ -237,11 +234,6 @@ void MPIU_trdump(FILE *, int);
 #if defined(strdup) || defined(__strdup)
 #undef strdup
 #endif
-    /* We include string.h first, so that if it contains a definition of 
-     strdup, we won't have an obscure failure when a file include string.h
-    later in the compilation process. */
-#include <string.h>
-
     /* The ::: should cause the compiler to choke; the string 
        will give the explanation */
 #undef strdup /* in case strdup is a macro */
@@ -253,16 +245,7 @@ void MPIU_trdump(FILE *, int);
 #define MPIU_Calloc(a,b)  calloc((size_t)(a),(size_t)(b))
 #define MPIU_Free(a)      free((void *)(a))
 #define MPIU_Realloc(a,b)  realloc((void *)(a),(size_t)(b))
-
-#ifdef HAVE_STRDUP
-/* Watch for the case where strdup is defined as a macro by a header include */
-# if defined(NEEDS_STRDUP_DECL) && !defined(strdup)
-extern char *strdup( const char * );
-# endif
-#define MPIU_Strdup(a)    strdup(a)
-#else
-/* Don't define MPIU_Strdup, provide it in safestr.c */
-#endif /* HAVE_STRDUP */
+#define MPIU_Strdup       MPL_strdup
 
 #endif /* USE_MEMORY_TRACING */
 
diff --git a/src/mpi/comm/comm_get_name.c b/src/mpi/comm/comm_get_name.c
index 0d05f5a..dd3c3ef 100644
--- a/src/mpi/comm/comm_get_name.c
+++ b/src/mpi/comm/comm_get_name.c
@@ -28,7 +28,7 @@ int MPI_Comm_get_name(MPI_Comm comm, char *comm_name, int *resultlen) __attribut
 void MPIR_Comm_get_name_impl(MPID_Comm *comm_ptr, char *comm_name, int *resultlen)
 {
     /* The user must allocate a large enough section of memory */
-    MPIU_Strncpy(comm_name, comm_ptr->name, MPI_MAX_OBJECT_NAME);
+    MPL_strncpy(comm_name, comm_ptr->name, MPI_MAX_OBJECT_NAME);
     *resultlen = (int)strlen(comm_name);
     return;
 }
diff --git a/src/mpi/comm/comm_set_name.c b/src/mpi/comm/comm_set_name.c
index 37b7538..dfb8279 100644
--- a/src/mpi/comm/comm_set_name.c
+++ b/src/mpi/comm/comm_set_name.c
@@ -89,7 +89,7 @@ int MPI_Comm_set_name(MPI_Comm comm, const char *comm_name)
     /* ... body of routine ...  */
 
     MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_POBJ_COMM_MUTEX(comm_ptr));
-    MPIU_Strncpy( comm_ptr->name, comm_name, MPI_MAX_OBJECT_NAME );
+    MPL_strncpy( comm_ptr->name, comm_name, MPI_MAX_OBJECT_NAME );
     MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_POBJ_COMM_MUTEX(comm_ptr));
 
     /* ... end of body of routine ... */
diff --git a/src/mpi/datatype/type_get_name.c b/src/mpi/datatype/type_get_name.c
index 2d78d3a..b7939a1 100644
--- a/src/mpi/datatype/type_get_name.c
+++ b/src/mpi/datatype/type_get_name.c
@@ -181,7 +181,7 @@ int MPIR_Datatype_init_names(void)
 	    MPIU_DBG_MSG_FMT(DATATYPE,VERBOSE,(MPIU_DBG_FDEST,
 		   "mpi_names[%d].name = %p", i, mpi_names[i].name));
 
-	    MPIU_Strncpy(datatype_ptr->name, mpi_names[i].name,
+	    MPL_strncpy(datatype_ptr->name, mpi_names[i].name,
 			 MPI_MAX_OBJECT_NAME);
 	}
 	/* Handle the minloc/maxloc types */
@@ -196,7 +196,7 @@ int MPIR_Datatype_init_names(void)
 	    if (!datatype_ptr) {
 		MPIR_ERR_SETFATALANDJUMP(mpi_errno,MPI_ERR_INTERN, "**typeinitminmaxloc");
 	    }
-	    MPIU_Strncpy(datatype_ptr->name, mpi_maxloc_names[i].name,
+	    MPL_strncpy(datatype_ptr->name, mpi_maxloc_names[i].name,
 			 MPI_MAX_OBJECT_NAME);
 	}
         needsInit = 0;
@@ -290,7 +290,7 @@ int MPI_Type_get_name(MPI_Datatype datatype, char *type_name, int *resultlen)
     }
 
     /* Include the null in MPI_MAX_OBJECT_NAME */
-    MPIU_Strncpy(type_name, datatype_ptr->name, MPI_MAX_OBJECT_NAME);
+    MPL_strncpy(type_name, datatype_ptr->name, MPI_MAX_OBJECT_NAME);
     *resultlen = (int) strlen(type_name);
 
     /* ... end of body of routine ... */
diff --git a/src/mpi/datatype/type_set_name.c b/src/mpi/datatype/type_set_name.c
index d590331..08ce1fb 100644
--- a/src/mpi/datatype/type_set_name.c
+++ b/src/mpi/datatype/type_set_name.c
@@ -104,7 +104,7 @@ int MPI_Type_set_name(MPI_Datatype datatype, const char *type_name)
     }
 
     /* Include the null in MPI_MAX_OBJECT_NAME */
-    MPIU_Strncpy( datatype_ptr->name, type_name, MPI_MAX_OBJECT_NAME );
+    MPL_strncpy( datatype_ptr->name, type_name, MPI_MAX_OBJECT_NAME );
     
     /* ... end of body of routine ... */
 
diff --git a/src/mpi/errhan/dynerrutil.c b/src/mpi/errhan/dynerrutil.c
index 0fb81cf..1b066b8 100644
--- a/src/mpi/errhan/dynerrutil.c
+++ b/src/mpi/errhan/dynerrutil.c
@@ -150,7 +150,7 @@ int MPIR_Err_set_msg( int code, const char *msg_string )
     /* --END ERROR HANDLING-- */
 
     /* --------------------------------------------------------------------- */
-    MPIU_Strncpy( str, msg_string, msg_len + 1 );
+    MPL_strncpy( str, msg_string, msg_len + 1 );
     if (errcode) {
 	if (errcode < first_free_code) {
 	    if (user_code_msgs[errcode]) {
diff --git a/src/mpi/errhan/errutil.c b/src/mpi/errhan/errutil.c
index 99f514d..b380fbc 100644
--- a/src/mpi/errhan/errutil.c
+++ b/src/mpi/errhan/errutil.c
@@ -587,7 +587,7 @@ void MPIR_Err_get_string( int errorcode, char * msg, int length,
 	if (!MPIR_Process.errcode_to_string) {
 	    /* FIXME: not internationalized */
 	    /* --BEGIN ERROR HANDLING-- */
-	    if (MPIU_Strncpy(msg, "Undefined dynamic error code", 
+	    if (MPL_strncpy(msg, "Undefined dynamic error code", 
 			     num_remaining))
 	    {
 		msg[num_remaining - 1] = '\0';
@@ -596,7 +596,7 @@ void MPIR_Err_get_string( int errorcode, char * msg, int length,
 	}
 	else
 	{
-	    if (MPIU_Strncpy(msg, MPIR_Process.errcode_to_string( errorcode ), 
+	    if (MPL_strncpy(msg, MPIR_Process.errcode_to_string( errorcode ), 
 			     num_remaining))
 	    {
 		msg[num_remaining - 1] = '\0';
@@ -606,7 +606,7 @@ void MPIR_Err_get_string( int errorcode, char * msg, int length,
     else if ( (errorcode & ERROR_CLASS_MASK) == errorcode) {
 	error_class = MPIR_ERR_GET_CLASS(errorcode);
 
-        if (MPIU_Strncpy(msg, get_class_msg( errorcode ), num_remaining))
+        if (MPL_strncpy(msg, get_class_msg( errorcode ), num_remaining))
 	    {
 		msg[num_remaining - 1] = '\0';
 	    }
@@ -618,7 +618,7 @@ void MPIR_Err_get_string( int errorcode, char * msg, int length,
            message is supposed to be complete by itself. */
 	error_class = MPIR_ERR_GET_CLASS(errorcode);
 
-        MPIU_Strncpy(msg, get_class_msg(error_class), num_remaining);
+        MPL_strncpy(msg, get_class_msg(error_class), num_remaining);
 	msg[num_remaining - 1] = '\0';
 	len = (int)strlen(msg);
 	msg += len;
@@ -1020,17 +1020,17 @@ int MPIR_Err_create_code_valist( int lastcode, int fatal, const char fcname[],
 				   specific_fmt, Argp );
 		}
 		else {
-		    MPIU_Strncpy( ring_msg, user_ring_msg, MPIR_MAX_ERROR_LINE );
+		    MPL_strncpy( ring_msg, user_ring_msg, MPIR_MAX_ERROR_LINE );
 		}
 	    }
 	    else if (generic_idx >= 0)
 	    {
-		MPIU_Strncpy( ring_msg,generic_err_msgs[generic_idx].long_name,
+		MPL_strncpy( ring_msg,generic_err_msgs[generic_idx].long_name,
 			      MPIR_MAX_ERROR_LINE );
 	    }
 	    else
 	    {
-		MPIU_Strncpy( ring_msg, generic_msg, MPIR_MAX_ERROR_LINE );
+		MPL_strncpy( ring_msg, generic_msg, MPIR_MAX_ERROR_LINE );
 	    }
 
 	    ring_msg[MPIR_MAX_ERROR_LINE] = '\0';
@@ -1381,13 +1381,13 @@ static const char * GetAssertString(int d)
 
     if (d == 0)
     {
-	MPIU_Strncpy(str, "assert=0", ASSERT_STR_MAXLEN);
+	MPL_strncpy(str, "assert=0", ASSERT_STR_MAXLEN);
 	return str;
     }
     cur = str;
     if (d & MPI_MODE_NOSTORE)
     {
-	MPIU_Strncpy(cur, "MPI_MODE_NOSTORE", len);
+	MPL_strncpy(cur, "MPI_MODE_NOSTORE", len);
 	n = strlen(cur);
 	cur += n;
 	len -= n;
@@ -1396,9 +1396,9 @@ static const char * GetAssertString(int d)
     if (d & MPI_MODE_NOCHECK)
     {
 	if (len < ASSERT_STR_MAXLEN)
-	    MPIU_Strncpy(cur, " | MPI_MODE_NOCHECK", len);
+	    MPL_strncpy(cur, " | MPI_MODE_NOCHECK", len);
 	else
-	    MPIU_Strncpy(cur, "MPI_MODE_NOCHECK", len);
+	    MPL_strncpy(cur, "MPI_MODE_NOCHECK", len);
 	n = strlen(cur);
 	cur += n;
 	len -= n;
@@ -1407,9 +1407,9 @@ static const char * GetAssertString(int d)
     if (d & MPI_MODE_NOPUT)
     {
 	if (len < ASSERT_STR_MAXLEN)
-	    MPIU_Strncpy(cur, " | MPI_MODE_NOPUT", len);
+	    MPL_strncpy(cur, " | MPI_MODE_NOPUT", len);
 	else
-	    MPIU_Strncpy(cur, "MPI_MODE_NOPUT", len);
+	    MPL_strncpy(cur, "MPI_MODE_NOPUT", len);
 	n = strlen(cur);
 	cur += n;
 	len -= n;
@@ -1418,9 +1418,9 @@ static const char * GetAssertString(int d)
     if (d & MPI_MODE_NOPRECEDE)
     {
 	if (len < ASSERT_STR_MAXLEN)
-	    MPIU_Strncpy(cur, " | MPI_MODE_NOPRECEDE", len);
+	    MPL_strncpy(cur, " | MPI_MODE_NOPRECEDE", len);
 	else
-	    MPIU_Strncpy(cur, "MPI_MODE_NOPRECEDE", len);
+	    MPL_strncpy(cur, "MPI_MODE_NOPRECEDE", len);
 	n = strlen(cur);
 	cur += n;
 	len -= n;
@@ -1429,9 +1429,9 @@ static const char * GetAssertString(int d)
     if (d & MPI_MODE_NOSUCCEED)
     {
 	if (len < ASSERT_STR_MAXLEN)
-	    MPIU_Strncpy(cur, " | MPI_MODE_NOSUCCEED", len);
+	    MPL_strncpy(cur, " | MPI_MODE_NOSUCCEED", len);
 	else
-	    MPIU_Strncpy(cur, "MPI_MODE_NOSUCCEED", len);
+	    MPL_strncpy(cur, "MPI_MODE_NOSUCCEED", len);
 	n = strlen(cur);
 	cur += n;
 	len -= n;
@@ -1464,7 +1464,7 @@ static const char * GetDTypeString(MPI_Datatype d)
 
     if (d == 0)
     {
-	MPIU_Strncpy(default_str, "dtype=0x0", sizeof(default_str));
+	MPL_strncpy(default_str, "dtype=0x0", sizeof(default_str));
 	return default_str;
     }
 
@@ -1593,9 +1593,9 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	case (int)'s':
 	    s = va_arg(list, char *);
 	    if (s) 
-	        MPIU_Strncpy(str, s, maxlen);
+	        MPL_strncpy(str, s, maxlen);
             else {
-		MPIU_Strncpy(str, "<NULL>", maxlen );
+		MPL_strncpy(str, "<NULL>", maxlen );
 	    }
 	    break;
 	case (int)'d':
@@ -1619,13 +1619,13 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    switch (i)
 	    {
 	    case MPI_ANY_SOURCE:
-		MPIU_Strncpy(str, "MPI_ANY_SOURCE", maxlen);
+		MPL_strncpy(str, "MPI_ANY_SOURCE", maxlen);
 		break;
 	    case MPI_PROC_NULL:
-		MPIU_Strncpy(str, "MPI_PROC_NULL", maxlen);
+		MPL_strncpy(str, "MPI_PROC_NULL", maxlen);
 		break;
 	    case MPI_ROOT:
-		MPIU_Strncpy(str, "MPI_ROOT", maxlen);
+		MPL_strncpy(str, "MPI_ROOT", maxlen);
 		break;
 	    default:
 		MPL_snprintf(str, maxlen, "%d", i);
@@ -1637,7 +1637,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    switch (t)
 	    {
 	    case MPI_ANY_TAG:
-		MPIU_Strncpy(str, "MPI_ANY_TAG", maxlen);
+		MPL_strncpy(str, "MPI_ANY_TAG", maxlen);
 		break;
 	    default:
                 /* Note that MPI_UNDEFINED is not a valid tag value,
@@ -1654,7 +1654,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	       where that is valid */
 	    if (p == MPI_IN_PLACE)
 	    {
-		MPIU_Strncpy(str, "MPI_IN_PLACE", maxlen);
+		MPL_strncpy(str, "MPI_IN_PLACE", maxlen);
 	    }
 	    else
 	    {
@@ -1670,13 +1670,13 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    switch (C)
 	    {
 	    case MPI_COMM_WORLD:
-		MPIU_Strncpy(str, "MPI_COMM_WORLD", maxlen);
+		MPL_strncpy(str, "MPI_COMM_WORLD", maxlen);
 		break;
 	    case MPI_COMM_SELF:
-		MPIU_Strncpy(str, "MPI_COMM_SELF", maxlen);
+		MPL_strncpy(str, "MPI_COMM_SELF", maxlen);
 		break;
 	    case MPI_COMM_NULL:
-		MPIU_Strncpy(str, "MPI_COMM_NULL", maxlen);
+		MPL_strncpy(str, "MPI_COMM_NULL", maxlen);
 		break;
 	    default:
 		MPL_snprintf(str, maxlen, "comm=0x%x", C);
@@ -1687,7 +1687,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    info = va_arg(list, MPI_Info);
 	    if (info == MPI_INFO_NULL)
 	    {
-		MPIU_Strncpy(str, "MPI_INFO_NULL", maxlen);
+		MPL_strncpy(str, "MPI_INFO_NULL", maxlen);
 	    }
 	    else
 	    {
@@ -1706,7 +1706,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    F = va_arg(list, MPI_File);
 	    if (F == MPI_FILE_NULL)
 	    {
-		MPIU_Strncpy(str, "MPI_FILE_NULL", maxlen);
+		MPL_strncpy(str, "MPI_FILE_NULL", maxlen);
 	    }
 	    else
 	    {
@@ -1719,7 +1719,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    W = va_arg(list, MPI_Win);
 	    if (W == MPI_WIN_NULL)
 	    {
-		MPIU_Strncpy(str, "MPI_WIN_NULL", maxlen);
+		MPL_strncpy(str, "MPI_WIN_NULL", maxlen);
 	    }
 	    else
 	    {
@@ -1734,7 +1734,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    G = va_arg(list, MPI_Group);
 	    if (G == MPI_GROUP_NULL)
 	    {
-		MPIU_Strncpy(str, "MPI_GROUP_NULL", maxlen);
+		MPL_strncpy(str, "MPI_GROUP_NULL", maxlen);
 	    }
 	    else
 	    {
@@ -1749,7 +1749,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    R = va_arg(list, MPI_Request);
 	    if (R == MPI_REQUEST_NULL)
 	    {
-		MPIU_Strncpy(str, "MPI_REQUEST_NULL", maxlen);
+		MPL_strncpy(str, "MPI_REQUEST_NULL", maxlen);
 	    }
 	    else
 	    {
@@ -1760,7 +1760,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
 	    E = va_arg(list, MPI_Errhandler);
 	    if (E == MPI_ERRHANDLER_NULL)
 	    {
-		MPIU_Strncpy(str, "MPI_ERRHANDLER_NULL", maxlen);
+		MPL_strncpy(str, "MPI_ERRHANDLER_NULL", maxlen);
 	    }
 	    else
 	    {
@@ -1788,7 +1788,7 @@ static int vsnprintf_mpi(char *str, size_t maxlen, const char *fmt_orig,
     }
     if (*begin != '\0')
     {
-	MPIU_Strncpy(str, begin, maxlen);
+	MPL_strncpy(str, begin, maxlen);
     }
     /* Free the dup'ed format string */
     MPIU_Free( fmt );
@@ -2003,7 +2003,7 @@ static int ErrGetInstanceString( int errorcode, char msg[], int num_remaining )
     int len;
 
     if (MPIR_CVAR_PRINT_ERROR_STACK) {
-	MPIU_Strncpy(msg, ", error stack:\n", num_remaining);
+	MPL_strncpy(msg, ", error stack:\n", num_remaining);
 	msg[num_remaining - 1] = '\0';
 	len = (int)strlen(msg);
 	msg += len;
diff --git a/src/mpi/info/info_get.c b/src/mpi/info/info_get.c
index a4f4898..0198deb 100644
--- a/src/mpi/info/info_get.c
+++ b/src/mpi/info/info_get.c
@@ -39,7 +39,7 @@ int MPIR_Info_get_impl(MPID_Info *info_ptr, const char *key, int valuelen, char
 
     while (curr_ptr) {
         if (!strncmp(curr_ptr->key, key, MPI_MAX_INFO_KEY)) {
-            err = MPIU_Strncpy(value, curr_ptr->value, valuelen+1);
+            err = MPL_strncpy(value, curr_ptr->value, valuelen+1);
             /* +1 because the MPI Standard says "In C, valuelen
              * (passed to MPI_Info_get) should be one less than the
              * amount of allocated space to allow for the null
diff --git a/src/mpi/info/info_getnth.c b/src/mpi/info/info_getnth.c
index 86a8bd8..c7253f2 100644
--- a/src/mpi/info/info_getnth.c
+++ b/src/mpi/info/info_getnth.c
@@ -45,7 +45,7 @@ int MPIR_Info_get_nthkey_impl(MPID_Info *info_ptr, int n, char *key)
     /* verify that n is valid */
     MPIR_ERR_CHKANDJUMP2((!curr_ptr), mpi_errno, MPI_ERR_ARG, "**infonkey", "**infonkey %d %d", n, nkeys);
 
-    MPIU_Strncpy( key, curr_ptr->key, MPI_MAX_INFO_KEY+1 );
+    MPL_strncpy( key, curr_ptr->key, MPI_MAX_INFO_KEY+1 );
     /* Eventually, we could remember the location of this key in
        the head using the key/value locations (and a union datatype?) */
  
diff --git a/src/mpi/init/initthread.c b/src/mpi/init/initthread.c
index 87da31e..343b914 100644
--- a/src/mpi/init/initthread.c
+++ b/src/mpi/init/initthread.c
@@ -395,7 +395,7 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
     MPIR_Process.comm_world->comm_kind	    = MPID_INTRACOMM;
     /* This initialization of the comm name could be done only when 
        comm_get_name is called */
-    MPIU_Strncpy(MPIR_Process.comm_world->name, "MPI_COMM_WORLD",
+    MPL_strncpy(MPIR_Process.comm_world->name, "MPI_COMM_WORLD",
 		 MPI_MAX_OBJECT_NAME);
 
     MPIR_Process.comm_self		    = MPID_Comm_builtin + 1;
@@ -404,7 +404,7 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
     MPIR_Process.comm_self->context_id	    = 1 << MPID_CONTEXT_PREFIX_SHIFT;
     MPIR_Process.comm_self->recvcontext_id  = 1 << MPID_CONTEXT_PREFIX_SHIFT;
     MPIR_Process.comm_self->comm_kind	    = MPID_INTRACOMM;
-    MPIU_Strncpy(MPIR_Process.comm_self->name, "MPI_COMM_SELF",
+    MPL_strncpy(MPIR_Process.comm_self->name, "MPI_COMM_SELF",
 		 MPI_MAX_OBJECT_NAME);
 
 #ifdef MPID_NEEDS_ICOMM_WORLD
@@ -414,7 +414,7 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
     MPIR_Process.icomm_world->context_id    = 2 << MPID_CONTEXT_PREFIX_SHIFT;
     MPIR_Process.icomm_world->recvcontext_id= 2 << MPID_CONTEXT_PREFIX_SHIFT;
     MPIR_Process.icomm_world->comm_kind	    = MPID_INTRACOMM;
-    MPIU_Strncpy(MPIR_Process.icomm_world->name, "MPI_ICOMM_WORLD",
+    MPL_strncpy(MPIR_Process.icomm_world->name, "MPI_ICOMM_WORLD",
 		 MPI_MAX_OBJECT_NAME);
 
     /* Note that these communicators are not ready for use - MPID_Init 
diff --git a/src/mpi/rma/win_get_name.c b/src/mpi/rma/win_get_name.c
index 10900d1..6bafc5d 100644
--- a/src/mpi/rma/win_get_name.c
+++ b/src/mpi/rma/win_get_name.c
@@ -96,7 +96,7 @@ int MPI_Win_get_name(MPI_Win win, char *win_name, int *resultlen)
 
     /* ... body of routine ...  */
     
-    MPIU_Strncpy( win_name, win_ptr->name, MPI_MAX_OBJECT_NAME );
+    MPL_strncpy( win_name, win_ptr->name, MPI_MAX_OBJECT_NAME );
     *resultlen = (int)strlen( win_name );
     
     /* ... end of body of routine ... */
diff --git a/src/mpi/rma/win_set_name.c b/src/mpi/rma/win_set_name.c
index b04f415..ac8f138 100644
--- a/src/mpi/rma/win_set_name.c
+++ b/src/mpi/rma/win_set_name.c
@@ -90,7 +90,7 @@ int MPI_Win_set_name(MPI_Win win, const char *win_name)
 
     /* ... body of routine ...  */
     
-    MPIU_Strncpy( win_ptr->name, win_name, MPI_MAX_OBJECT_NAME );
+    MPL_strncpy( win_ptr->name, win_name, MPI_MAX_OBJECT_NAME );
     
     /* ... end of body of routine ... */
 
diff --git a/src/mpi_t/cvar_read.c b/src/mpi_t/cvar_read.c
index 789bc36..19ae770 100644
--- a/src/mpi_t/cvar_read.c
+++ b/src/mpi_t/cvar_read.c
@@ -63,7 +63,7 @@ int MPIR_T_cvar_read_impl(MPI_T_cvar_handle handle, void *buf)
             ((double *)buf)[i] = ((double *)addr)[i];
         break;
     case MPI_CHAR:
-        MPIU_Strncpy(buf, addr, count);
+        MPL_strncpy(buf, addr, count);
         break;
     default:
          /* FIXME the error handling code may not have been setup yet */
diff --git a/src/mpi_t/cvar_write.c b/src/mpi_t/cvar_write.c
index 3fdc908..860fa85 100644
--- a/src/mpi_t/cvar_write.c
+++ b/src/mpi_t/cvar_write.c
@@ -72,7 +72,7 @@ int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, const void *buf)
         break;
     case MPI_CHAR:
         MPIU_Assert(count > strlen(buf)); /* Make sure buf will not overflow this cvar */
-        MPIU_Strncpy(addr, buf, count);
+        MPL_strncpy(addr, buf, count);
         break;
     default:
          /* FIXME the error handling code may not have been setup yet */
diff --git a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
index 7f1989f..d3ac74a 100644
--- a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
+++ b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
@@ -149,7 +149,7 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr);
         if (num_bytes != 0) {                                                           \
             int pt_err = 1;                                                             \
             int mpi_errno = MPI_ERR_OTHER;                                              \
-            MPIU_Strncpy(error_msg, str, MPIU_STRERROR_BUF_SIZE);                       \
+            MPL_strncpy(error_msg, str, MPIU_STRERROR_BUF_SIZE);                       \
             LocalFree(str);                                                             \
             strtok(error_msg, "\r\n");                                                  \
             MPIR_ERR_CHKANDJUMP1(pt_err, mpi_errno, MPI_ERR_OTHER, "**windows_mutex",   \
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h
index b717382..64b529b 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h
@@ -395,7 +395,7 @@ static inline void _dbg_mxm_hexdump(void *ptr, int buflen)
 static inline char *_tag_val_to_str(int tag, char *out, int max)
 {
     if (tag == MPI_ANY_TAG) {
-        MPIU_Strncpy(out, "MPI_ANY_TAG", max);
+        MPL_strncpy(out, "MPI_ANY_TAG", max);
     }
     else {
         MPL_snprintf(out, max, "%d", tag);
@@ -406,7 +406,7 @@ static inline char *_tag_val_to_str(int tag, char *out, int max)
 static inline char *_rank_val_to_str(int rank, char *out, int max)
 {
     if (rank == MPI_ANY_SOURCE) {
-        MPIU_Strncpy(out, "MPI_ANY_SOURCE", max);
+        MPL_strncpy(out, "MPI_ANY_SOURCE", max);
     }
     else {
         MPL_snprintf(out, max, "%d", rank);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_getip.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_getip.c
index 71b2b49..89f3d3f 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_getip.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_getip.c
@@ -256,7 +256,7 @@ int MPIDI_Get_IP_for_iface(const char *ifname, MPIDU_Sock_ifaddr_t *ifaddr, int
     fd = socket(AF_INET, SOCK_DGRAM, 0);
     MPIR_ERR_CHKANDJUMP2(fd < 0, mpi_errno, MPI_ERR_OTHER, "**sock_create", "**sock_create %s %d", MPIU_Strerror(errno), errno);
     ifr.ifr_addr.sa_family = AF_INET; /* just IPv4 for now */
-    MPIU_Strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1);
+    MPL_strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1);
     ret = ioctl(fd, SIOCGIFADDR, &ifr);
     MPIR_ERR_CHKANDJUMP2(ret < 0, mpi_errno, MPI_ERR_OTHER, "**ioctl", "**ioctl %d %s", errno, MPIU_Strerror(errno));
 
diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c
index 73805fb..d2b17b7 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c
@@ -364,7 +364,7 @@ static int GetSockInterfaceAddr(int myRank, char *ifname, int maxIfname,
     }
     else {
 	/* Copy this name into the output name */
-	MPIU_Strncpy( ifname, ifname_string, maxIfname );
+	MPL_strncpy( ifname, ifname_string, maxIfname );
     }
 
     /* If we don't have an IP address, try to get it from the name */
diff --git a/src/mpid/ch3/src/ch3u_recvq.c b/src/mpid/ch3/src/ch3u_recvq.c
index 4518cb4..57a1eaa 100644
--- a/src/mpid/ch3/src/ch3u_recvq.c
+++ b/src/mpid/ch3/src/ch3u_recvq.c
@@ -1164,7 +1164,7 @@ int MPIDI_CH3U_Complete_posted_with_error(MPIDI_VC_t *vc)
 static char *tag_val_to_str(int tag, char *out, int max)
 {
     if (tag == MPI_ANY_TAG) {
-        MPIU_Strncpy(out, "MPI_ANY_TAG", max);
+        MPL_strncpy(out, "MPI_ANY_TAG", max);
     }
     else {
         MPL_snprintf(out, max, "%d", tag);
@@ -1176,7 +1176,7 @@ static char *tag_val_to_str(int tag, char *out, int max)
 static char *rank_val_to_str(int rank, char *out, int max)
 {
     if (rank == MPI_ANY_SOURCE) {
-        MPIU_Strncpy(out, "MPI_ANY_SOURCE", max);
+        MPL_strncpy(out, "MPI_ANY_SOURCE", max);
     }
     else {
         MPL_snprintf(out, max, "%d", rank);
diff --git a/src/mpid/ch3/src/mpid_getpname.c b/src/mpid/ch3/src/mpid_getpname.c
index db069c5..36b7bdf 100644
--- a/src/mpid/ch3/src/mpid_getpname.c
+++ b/src/mpid/ch3/src/mpid_getpname.c
@@ -32,11 +32,11 @@ int MPID_Get_processor_name(char * name, int namelen, int * resultlen)
     }
     MPIR_ERR_CHKANDJUMP(processorNameLen <= 0, mpi_errno, MPI_ERR_OTHER, "**procnamefailed");
 
-    /* MPIU_Strncpy only copies until (and including) the null,
+    /* MPL_strncpy only copies until (and including) the null,
        unlike strncpy, it does not blank pad.  This is a good thing
        here, because users don't always allocated MPI_MAX_PROCESSOR_NAME
        characters */
-    MPIU_Strncpy(name, processorName, namelen );
+    MPL_strncpy(name, processorName, namelen );
     if (resultlen)
         *resultlen = processorNameLen;
 
diff --git a/src/mpid/ch3/src/mpid_init.c b/src/mpid/ch3/src/mpid_init.c
index c0367d8..0ca8962 100644
--- a/src/mpid/ch3/src/mpid_init.c
+++ b/src/mpid/ch3/src/mpid_init.c
@@ -306,7 +306,7 @@ int MPID_Init(int *argc, char ***argv, int requested, int *provided,
 
 	MPIR_Process.comm_parent = comm;
 	MPIU_Assert(MPIR_Process.comm_parent != NULL);
-	MPIU_Strncpy(comm->name, "MPI_COMM_PARENT", MPI_MAX_OBJECT_NAME);
+	MPL_strncpy(comm->name, "MPI_COMM_PARENT", MPI_MAX_OBJECT_NAME);
         
 	/* FIXME: Check that this intercommunicator gets freed in MPI_Finalize
 	   if not already freed.  */
@@ -480,7 +480,7 @@ static int init_pg( int *argc, char ***argv,
 	if (pg_id == NULL) {
 	    MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER, "**nomem");
 	}
-	MPIU_Strncpy( pg_id, "0", 2 );
+	MPL_strncpy( pg_id, "0", 2 );
     }
 
     /*
diff --git a/src/mpid/ch3/src/mpidi_pg.c b/src/mpid/ch3/src/mpidi_pg.c
index 72dbd98..cc3d417 100644
--- a/src/mpid/ch3/src/mpidi_pg.c
+++ b/src/mpid/ch3/src/mpidi_pg.c
@@ -905,7 +905,7 @@ static int getConnInfo( int rank, char *buf, int bufsize, MPIDI_PG_t *pg )
 
     /* printf( "Copying %s to buf\n", connInfo->connStrings[rank] ); fflush(stdout); */
     
-    MPIU_Strncpy( buf, connInfo->connStrings[rank], bufsize );
+    MPL_strncpy( buf, connInfo->connStrings[rank], bufsize );
     return MPI_SUCCESS;
 }
 
diff --git a/src/mpid/ch3/util/ftb/ftb.c b/src/mpid/ch3/util/ftb/ftb.c
index e7b4ed8..b7746a0 100644
--- a/src/mpid/ch3/util/ftb/ftb.c
+++ b/src/mpid/ch3/util/ftb/ftb.c
@@ -41,9 +41,9 @@ int MPIDU_Ftb_init(void)
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDU_FTB_INIT);
 
-    MPIU_Strncpy(ci.event_space, "ftb.mpi.mpich", sizeof(ci.event_space));
-    MPIU_Strncpy(ci.client_name, "mpich " MPICH_VERSION, sizeof(ci.client_name));
-    MPIU_Strncpy(ci.client_subscription_style, "FTB_SUBSCRIPTION_NONE", sizeof(ci.client_subscription_style));
+    MPL_strncpy(ci.event_space, "ftb.mpi.mpich", sizeof(ci.event_space));
+    MPL_strncpy(ci.client_name, "mpich " MPICH_VERSION, sizeof(ci.client_name));
+    MPL_strncpy(ci.client_subscription_style, "FTB_SUBSCRIPTION_NONE", sizeof(ci.client_subscription_style));
     ci.client_polling_queue_len = -1;
     
 #ifdef USE_PMI2_API
@@ -85,7 +85,7 @@ void MPIDU_Ftb_publish(const char *event_name, const char *event_payload)
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDU_FTB_PUBLISH);
 
     event_prop.event_type = 1;
-    MPIU_Strncpy(event_prop.event_payload, event_payload, sizeof(event_prop.event_payload));
+    MPL_strncpy(event_prop.event_payload, event_payload, sizeof(event_prop.event_payload));
     
     CHECK_FTB_ERROR(FTB_Publish(client_handle, event_name, &event_prop, &event_handle));
 
diff --git a/src/mpid/ch3/util/sock/ch3u_getinterfaces.c b/src/mpid/ch3/util/sock/ch3u_getinterfaces.c
index 0e5cda5..06794e5 100644
--- a/src/mpid/ch3/util/sock/ch3u_getinterfaces.c
+++ b/src/mpid/ch3/util/sock/ch3u_getinterfaces.c
@@ -120,7 +120,7 @@ int MPIDU_CH3U_GetSockInterfaceAddr( int myRank, char *ifname, int maxIfname,
     }
     else {
 	/* Copy this name into the output name */
-	MPIU_Strncpy( ifname, ifname_string, maxIfname );
+	MPL_strncpy( ifname, ifname_string, maxIfname );
     }
 
     /* If we don't have an IP address, try to get it from the name */
diff --git a/src/mpid/common/sock/iocp/sock.c b/src/mpid/common/sock/iocp/sock.c
index 2f3ff2c..754ba7f 100644
--- a/src/mpid/common/sock/iocp/sock.c
+++ b/src/mpid/common/sock/iocp/sock.c
@@ -97,7 +97,7 @@ static void translate_error(int error, char *msg, char *prepend)
     if (num_bytes == 0)
     {
 	if (prepend != NULL)
-	    MPIU_Strncpy(msg, prepend, 1024);
+	    MPL_strncpy(msg, prepend, 1024);
 	else
 	    *msg = '\0';
     }
@@ -559,7 +559,7 @@ static int already_used_or_add(char *host, socki_host_name_t **list)
 	/* if out of memory then treat it as not found */
 	return 0;
     }
-    MPIU_Strncpy(iter->host, host, 256);
+    MPL_strncpy(iter->host, host, 256);
 
     /* insert new hosts at the end of the list */
     if (trailer != NULL)
@@ -735,7 +735,7 @@ int MPIDU_Sock_get_host_description(int myRank,
     env = getenv("MPICH_INTERFACE_HOSTNAME");
     if (env != NULL && *env != '\0')
     {
-	MPIU_Strncpy(hostname, env, sizeof(hostname));
+	MPL_strncpy(hostname, env, sizeof(hostname));
     }
     else
     {
@@ -1161,7 +1161,7 @@ int MPIDU_Sock_post_connect(MPIDU_Sock_set_t set, void * user_ptr, char * host_d
     connect_state = (sock_state_t*)MPIU_Malloc(sizeof(sock_state_t));
     init_state_struct(connect_state);
     connect_state->cur_host = connect_state->host_description;
-    MPIU_Strncpy(connect_state->host_description, host_description, SOCKI_DESCRIPTION_LENGTH);
+    MPL_strncpy(connect_state->host_description, host_description, SOCKI_DESCRIPTION_LENGTH);
 
     /* create a socket */
     mpi_errno = easy_create(&connect_state->sock, ADDR_ANY, INADDR_ANY);
@@ -1176,7 +1176,7 @@ int MPIDU_Sock_post_connect(MPIDU_Sock_set_t set, void * user_ptr, char * host_d
     pEnv = getenv("MPICH_NETMASK");
     if (pEnv != NULL)
     {
-	MPIU_Strncpy(pszNetMask, pEnv, 50);
+	MPL_strncpy(pszNetMask, pEnv, 50);
 	token = strtok(pszNetMask, "/");
 	if (token != NULL)
 	{
@@ -2860,55 +2860,55 @@ int MPIDU_Sock_get_error_class_string(int error, char *error_string, int length)
     switch (MPIR_ERR_GET_CLASS(error))
     {
     case MPIDU_SOCK_ERR_FAIL:
-	MPIU_Strncpy(error_string, "generic socket failure", length);
+	MPL_strncpy(error_string, "generic socket failure", length);
 	break;
     case MPIDU_SOCK_ERR_INIT:
-	MPIU_Strncpy(error_string, "socket module not initialized", length);
+	MPL_strncpy(error_string, "socket module not initialized", length);
 	break;
     case MPIDU_SOCK_ERR_NOMEM:
-	MPIU_Strncpy(error_string, "not enough memory to complete the socket operation", length);
+	MPL_strncpy(error_string, "not enough memory to complete the socket operation", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_SET:
-	MPIU_Strncpy(error_string, "invalid socket set", length);
+	MPL_strncpy(error_string, "invalid socket set", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_SOCK:
-	MPIU_Strncpy(error_string, "invalid socket", length);
+	MPL_strncpy(error_string, "invalid socket", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_HOST:
-	MPIU_Strncpy(error_string, "host description buffer not large enough", length);
+	MPL_strncpy(error_string, "host description buffer not large enough", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_HOSTNAME:
-	MPIU_Strncpy(error_string, "invalid host name", length);
+	MPL_strncpy(error_string, "invalid host name", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_PORT:
-	MPIU_Strncpy(error_string, "invalid port", length);
+	MPL_strncpy(error_string, "invalid port", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_BUF:
-	MPIU_Strncpy(error_string, "invalid buffer", length);
+	MPL_strncpy(error_string, "invalid buffer", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_LEN:
-	MPIU_Strncpy(error_string, "invalid length", length);
+	MPL_strncpy(error_string, "invalid length", length);
 	break;
     case MPIDU_SOCK_ERR_SOCK_CLOSED:
-	MPIU_Strncpy(error_string, "socket closed", length);
+	MPL_strncpy(error_string, "socket closed", length);
 	break;
     case MPIDU_SOCK_ERR_CONN_CLOSED:
-	MPIU_Strncpy(error_string, "socket connection closed", length);
+	MPL_strncpy(error_string, "socket connection closed", length);
 	break;
     case MPIDU_SOCK_ERR_CONN_FAILED:
-	MPIU_Strncpy(error_string, "socket connection failed", length);
+	MPL_strncpy(error_string, "socket connection failed", length);
 	break;
     case MPIDU_SOCK_ERR_INPROGRESS:
-	MPIU_Strncpy(error_string, "socket operation in progress", length);
+	MPL_strncpy(error_string, "socket operation in progress", length);
 	break;
     case MPIDU_SOCK_ERR_TIMEOUT:
-	MPIU_Strncpy(error_string, "socket operation timed out", length);
+	MPL_strncpy(error_string, "socket operation timed out", length);
 	break;
     case MPIDU_SOCK_ERR_INTR:
-	MPIU_Strncpy(error_string, "socket operation interrupted", length);
+	MPL_strncpy(error_string, "socket operation interrupted", length);
 	break;
     case MPIDU_SOCK_ERR_NO_NEW_SOCK:
-	MPIU_Strncpy(error_string, "no new connection available", length);
+	MPL_strncpy(error_string, "no new connection available", length);
 	break;
     default:
 	MPL_snprintf(error_string, length, "unknown socket error %d", error);
diff --git a/src/mpid/common/sock/poll/sock_misc.i b/src/mpid/common/sock/poll/sock_misc.i
index b6f3d9d..983071b 100644
--- a/src/mpid/common/sock/poll/sock_misc.i
+++ b/src/mpid/common/sock/poll/sock_misc.i
@@ -53,7 +53,7 @@ int MPIDU_Sock_get_host_description(int myRank,
 
     if (env_hostname != NULL)
     {
-	rc = MPIU_Strncpy(host_description, env_hostname, (size_t) len);
+	rc = MPL_strncpy(host_description, env_hostname, (size_t) len);
 	/* --BEGIN ERROR HANDLING-- */
 	if (rc != 0)
 	{
@@ -284,55 +284,55 @@ int MPIDU_Sock_get_error_class_string(int error, char *error_string, size_t leng
     switch (MPIR_ERR_GET_CLASS(error))
     {
     case MPIDU_SOCK_ERR_FAIL:
-	MPIU_Strncpy(error_string, "generic socket failure", length);
+	MPL_strncpy(error_string, "generic socket failure", length);
 	break;
     case MPIDU_SOCK_ERR_INIT:
-	MPIU_Strncpy(error_string, "socket module not initialized", length);
+	MPL_strncpy(error_string, "socket module not initialized", length);
 	break;
     case MPIDU_SOCK_ERR_NOMEM:
-	MPIU_Strncpy(error_string, "not enough memory to complete the socket operation", length);
+	MPL_strncpy(error_string, "not enough memory to complete the socket operation", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_SET:
-	MPIU_Strncpy(error_string, "invalid socket set", length);
+	MPL_strncpy(error_string, "invalid socket set", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_SOCK:
-	MPIU_Strncpy(error_string, "invalid socket", length);
+	MPL_strncpy(error_string, "invalid socket", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_HOST:
-	MPIU_Strncpy(error_string, "host description buffer not large enough", length);
+	MPL_strncpy(error_string, "host description buffer not large enough", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_HOSTNAME:
-	MPIU_Strncpy(error_string, "invalid host name", length);
+	MPL_strncpy(error_string, "invalid host name", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_PORT:
-	MPIU_Strncpy(error_string, "invalid port", length);
+	MPL_strncpy(error_string, "invalid port", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_BUF:
-	MPIU_Strncpy(error_string, "invalid buffer", length);
+	MPL_strncpy(error_string, "invalid buffer", length);
 	break;
     case MPIDU_SOCK_ERR_BAD_LEN:
-	MPIU_Strncpy(error_string, "invalid length", length);
+	MPL_strncpy(error_string, "invalid length", length);
 	break;
     case MPIDU_SOCK_ERR_SOCK_CLOSED:
-	MPIU_Strncpy(error_string, "socket closed", length);
+	MPL_strncpy(error_string, "socket closed", length);
 	break;
     case MPIDU_SOCK_ERR_CONN_CLOSED:
-	MPIU_Strncpy(error_string, "socket connection closed", length);
+	MPL_strncpy(error_string, "socket connection closed", length);
 	break;
     case MPIDU_SOCK_ERR_CONN_FAILED:
-	MPIU_Strncpy(error_string, "socket connection failed", length);
+	MPL_strncpy(error_string, "socket connection failed", length);
 	break;
     case MPIDU_SOCK_ERR_INPROGRESS:
-	MPIU_Strncpy(error_string, "socket operation in progress", length);
+	MPL_strncpy(error_string, "socket operation in progress", length);
 	break;
     case MPIDU_SOCK_ERR_TIMEOUT:
-	MPIU_Strncpy(error_string, "socket operation timed out", length);
+	MPL_strncpy(error_string, "socket operation timed out", length);
 	break;
     case MPIDU_SOCK_ERR_INTR:
-	MPIU_Strncpy(error_string, "socket operation interrupted", length);
+	MPL_strncpy(error_string, "socket operation interrupted", length);
 	break;
     case MPIDU_SOCK_ERR_NO_NEW_SOCK:
-	MPIU_Strncpy(error_string, "no new connection available", length);
+	MPL_strncpy(error_string, "no new connection available", length);
 	break;
     default:
 	MPL_snprintf(error_string, length, "unknown socket error %d", error);
diff --git a/src/mpid/pamid/src/dyntask/mpidi_pg.c b/src/mpid/pamid/src/dyntask/mpidi_pg.c
index bb69e10..7678742 100644
--- a/src/mpid/pamid/src/dyntask/mpidi_pg.c
+++ b/src/mpid/pamid/src/dyntask/mpidi_pg.c
@@ -791,7 +791,7 @@ static int MPIDI_getConnInfo( int rank, char *buf, int bufsize, MPIDI_PG_t *pg )
 
     /* printf( "Copying %s to buf\n", connInfo->connStrings[rank] ); fflush(stdout); */
 
-    MPIU_Strncpy( buf, connInfo->connStrings[rank], bufsize );
+    MPL_strncpy( buf, connInfo->connStrings[rank], bufsize );
     return MPI_SUCCESS;
 }
 
diff --git a/src/mpid/pamid/src/mpid_init.c b/src/mpid/pamid/src/mpid_init.c
index 743c66c..5026b25 100644
--- a/src/mpid/pamid/src/mpid_init.c
+++ b/src/mpid/pamid/src/mpid_init.c
@@ -1372,7 +1372,7 @@ int MPID_Init(int * argc,
 
 	MPIR_Process.comm_parent = comm;
 	MPIU_Assert(MPIR_Process.comm_parent != NULL);
-	MPIU_Strncpy(comm->name, "MPI_COMM_PARENT", MPI_MAX_OBJECT_NAME);
+	MPL_strncpy(comm->name, "MPI_COMM_PARENT", MPI_MAX_OBJECT_NAME);
 
 	/* FIXME: Check that this intercommunicator gets freed in MPI_Finalize
 	   if not already freed.  */
@@ -1651,7 +1651,7 @@ int MPIDI_InitPG( int *argc, char ***argv,
     else {
 	/* Create a default pg id */
 	pg_id = MPIU_Malloc(2);
-	MPIU_Strncpy( pg_id, "0", 2 );
+	MPL_strncpy( pg_id, "0", 2 );
     }
 
 	TRACE_ERR("pg_size=%d pg_id=%s\n", pg_size, pg_id);
diff --git a/src/nameserv/file/file_nameserv.c b/src/nameserv/file/file_nameserv.c
index 5cb4233..d63f897 100644
--- a/src/nameserv/file/file_nameserv.c
+++ b/src/nameserv/file/file_nameserv.c
@@ -92,7 +92,7 @@ int MPID_NS_Create( const MPID_Info *info_ptr, MPID_NS_Handle *handle_ptr )
         }
     }
 
-    MPIU_Strncpy( (*handle_ptr)->dirname, dirname, MAXPATHLEN );
+    MPL_strncpy( (*handle_ptr)->dirname, dirname, MAXPATHLEN );
     MPIU_Strnapp( (*handle_ptr)->dirname, "/.mpinamepub/", MAXPATHLEN );
 
     /* Make the directory if necessary */
@@ -122,7 +122,7 @@ int MPID_NS_Publish( MPID_NS_Handle handle, const MPID_Info *info_ptr,
 
     /* Determine file and directory name.  The file name is from
        the service name */
-    MPIU_Strncpy( filename, handle->dirname, MAXPATHLEN );
+    MPL_strncpy( filename, handle->dirname, MAXPATHLEN );
     MPIU_Strnapp( filename, service_name, MAXPATHLEN );
 
     /* Add the file name to the known files now, in case there is 
@@ -206,7 +206,7 @@ int MPID_NS_Lookup( MPID_NS_Handle handle, const MPID_Info *info_ptr,
     
     /* Determine file and directory name.  The file name is from
        the service name */
-    MPIU_Strncpy( filename, handle->dirname, MAXPATHLEN );
+    MPL_strncpy( filename, handle->dirname, MAXPATHLEN );
     MPIU_Strnapp( filename, service_name, MAXPATHLEN );
 
     fp = fopen( filename, "r" );
@@ -254,7 +254,7 @@ int MPID_NS_Unpublish( MPID_NS_Handle handle, const MPID_Info *info_ptr,
     /* Remove the file corresponding to the service name */
     /* Determine file and directory name.  The file name is from
        the service name */
-    MPIU_Strncpy( filename, handle->dirname, MAXPATHLEN );
+    MPL_strncpy( filename, handle->dirname, MAXPATHLEN );
     MPIU_Strnapp( filename, service_name, MAXPATHLEN );
 
     /* Find the filename from the list of published files */
diff --git a/src/nameserv/pmi/pmi_nameserv.c b/src/nameserv/pmi/pmi_nameserv.c
index 9805ba2..3d55386 100644
--- a/src/nameserv/pmi/pmi_nameserv.c
+++ b/src/nameserv/pmi/pmi_nameserv.c
@@ -184,7 +184,7 @@ int MPID_NS_Create( const MPID_Info *info_ptr, MPID_NS_Handle *handle_ptr )
     pmi_namepub_kvs = getenv("PMI_NAMEPUB_KVS");
     if (pmi_namepub_kvs)
     {
-	MPIU_Strncpy((*handle_ptr)->kvsname, pmi_namepub_kvs, length);
+	MPL_strncpy((*handle_ptr)->kvsname, pmi_namepub_kvs, length);
     }
     else
     {
diff --git a/src/pm/gforker/mpiexec.c b/src/pm/gforker/mpiexec.c
index 378f4c4..3d2987e 100644
--- a/src/pm/gforker/mpiexec.c
+++ b/src/pm/gforker/mpiexec.c
@@ -87,7 +87,7 @@
 /* We can't use mpimem.h, because the memory routines are no longer available
    as utility routines, and instead now import properties from the device 
    and other parts of the code */
-/* mpimem.h contains prototypes for MPIU_Strncpy etc. */
+/* mpimem.h contains prototypes for MPL_strncpy etc. */
 /* #include "mpimem.h" */
 
 typedef struct { PMISetup pmiinfo; IOLabelSetup labelinfo; } SetupInfo;
diff --git a/src/pm/remshell/mpiexec.c b/src/pm/remshell/mpiexec.c
index 6c133c5..5a8c2c8 100644
--- a/src/pm/remshell/mpiexec.c
+++ b/src/pm/remshell/mpiexec.c
@@ -80,7 +80,7 @@
 #include "rm.h"
 #include "simple_pmiutil.h"
 #include "env.h"             /* MPIE_Putenv */
-/* mpimem.h contains prototypes for MPIU_Strncpy etc. */
+/* mpimem.h contains prototypes for MPL_strncpy etc. */
 /* We no longer can use these because they are MPI device specific */
 /* #include "mpimem.h" */
 
@@ -439,7 +439,7 @@ static int AddEnvSetToCmdLine( const char *envName, const char *envValue,
     else {
 	char tmpBuf[1024];
 	args[nArgs++] = MPIU_Strdup( "export" );
-	MPIU_Strncpy( tmpBuf, envName, sizeof(tmpBuf) );
+	MPL_strncpy( tmpBuf, envName, sizeof(tmpBuf) );
 	MPIU_Strnapp( tmpBuf, "=", sizeof(tmpBuf) );
 	MPIU_Strnapp( tmpBuf, envValue, sizeof(tmpBuf) );
 	args[nArgs++] = MPIU_Strdup( tmpBuf );
diff --git a/src/pm/util/env.c b/src/pm/util/env.c
index 66909b1..7fbe3cf 100644
--- a/src/pm/util/env.c
+++ b/src/pm/util/env.c
@@ -265,7 +265,7 @@ int MPIE_EnvInitData( EnvData *elist, int getValue )
 	    if (!str) {
 		return 1;
 	    }
-	    MPIU_Strncpy( str, elist->name, slen );
+	    MPL_strncpy( str, elist->name, slen );
 	    if (value && *value) {
 		rc = MPIU_Strnapp( str, "=", slen );
 		rc += MPIU_Strnapp( str, value, slen );
diff --git a/src/pm/util/labelout.c b/src/pm/util/labelout.c
index fc0b464..7634ea4 100644
--- a/src/pm/util/labelout.c
+++ b/src/pm/util/labelout.c
@@ -211,7 +211,7 @@ static int IOLabelSetLabelText( const char pattern[], char label[],
 	    case 'd': 
 		dlen = (int)strlen( rankAsChar );
 		if (dlen < lenleft) {
-		    MPIU_Strncpy( pout, rankAsChar, lenleft );
+		    MPL_strncpy( pout, rankAsChar, lenleft );
 		    pout += dlen;
 		    lenleft -= dlen;
 		}
@@ -223,7 +223,7 @@ static int IOLabelSetLabelText( const char pattern[], char label[],
 	    case 'w':
 		dlen = (int)strlen(worldnumAsChar);
 		if (dlen < lenleft) {
-		    MPIU_Strncpy( pout, worldnumAsChar, lenleft );
+		    MPL_strncpy( pout, worldnumAsChar, lenleft );
 		    pout += dlen;
 		    lenleft -= dlen;
 		}
@@ -250,7 +250,7 @@ static int IOLabelSetLabelText( const char pattern[], char label[],
 					     rank, worldnum );
 			dlen = (int)strlen(wLabel);
 			if (dlen < lenleft) {
-			    MPIU_Strncpy( pout, wLabel, lenleft );
+			    MPL_strncpy( pout, wLabel, lenleft );
 			    pout    += dlen;
 			    lenleft -= dlen;
 			}
@@ -287,7 +287,7 @@ int IOLabelCheckEnv( void )
     envval = getenv( "MPIEXEC_PREFIX_STDOUT" );
     if (envval) {
 	if (strlen(envval) < MAX_LABEL) {
-	    MPIU_Strncpy( outLabelPattern, envval, MAX_LABEL );
+	    MPL_strncpy( outLabelPattern, envval, MAX_LABEL );
 	    useLabels = 1;
 	}
 	else {
@@ -297,7 +297,7 @@ int IOLabelCheckEnv( void )
     envval = getenv( "MPIEXEC_PREFIX_STDERR" );
     if (envval) {
 	if (strlen(envval) < MAX_LABEL) {
-	    MPIU_Strncpy( errLabelPattern, envval, MAX_LABEL );
+	    MPL_strncpy( errLabelPattern, envval, MAX_LABEL );
 	    useLabels = 1;
 	}
 	else {
diff --git a/src/pm/util/pmiserv.c b/src/pm/util/pmiserv.c
index 5376ded..1f5a380 100644
--- a/src/pm/util/pmiserv.c
+++ b/src/pm/util/pmiserv.c
@@ -494,7 +494,7 @@ static int fPMIKVSGetNewSpace( char kvsname[], int maxlen )
     PMIKVSpace *kvs;
 
     kvs = fPMIKVSAllocate( );
-    MPIU_Strncpy( kvsname, kvs->kvsname, maxlen );
+    MPL_strncpy( kvsname, kvs->kvsname, maxlen );
     return 0;
 }
 static int fPMIKVSFindKey( PMIKVSpace *kvs, 
@@ -508,7 +508,7 @@ static int fPMIKVSFindKey( PMIKVSpace *kvs,
 	rc = strcmp( p->key, key );
 	if (rc == 0) {
 	    /* Found it.  Get the value and return success */
-	    MPIU_Strncpy( val, p->val, maxval );
+	    MPL_strncpy( val, p->val, maxval );
 	    return 0;
 	}
 	if (rc > 0) {
@@ -548,8 +548,8 @@ static int fPMIKVSAddPair( PMIKVSpace *kvs,
     if (!pair) {
 	return -1;
     }
-    MPIU_Strncpy( pair->key, key, sizeof(pair->key) );
-    MPIU_Strncpy( pair->val, val, sizeof(pair->val) );
+    MPL_strncpy( pair->key, key, sizeof(pair->key) );
+    MPL_strncpy( pair->val, val, sizeof(pair->val) );
 
     /* Insert into the list */
     pair->nextPair = p;
@@ -698,7 +698,7 @@ static int fPMI_Handle_put( PMIProcess *pentry )
 	}
 	else {
 	    rc = 0;
-	    MPIU_Strncpy( message, "success", PMIU_MAXLINE );
+	    MPL_strncpy( message, "success", PMIU_MAXLINE );
 	}
     }
     else {
@@ -733,18 +733,18 @@ static int fPMI_Handle_get( PMIProcess *pentry )
 	rc = fPMIKVSFindKey( kvs, key, value, sizeof(value) );
 	if (rc == 0) {
 	    rc = 0;
-	    MPIU_Strncpy( message, "success", PMIU_MAXLINE );
+	    MPL_strncpy( message, "success", PMIU_MAXLINE );
 	}
 	else if (rc) {
 	    rc = -1;
-	    MPIU_Strncpy( value, "unknown", PMIU_MAXLINE );
+	    MPL_strncpy( value, "unknown", PMIU_MAXLINE );
 	    MPL_snprintf( message, PMIU_MAXLINE, "key_%s_not_found", 
 			   kvsname );
 	}
     }
     else { 
 	rc = -1;
-	MPIU_Strncpy( value, "unknown", PMIU_MAXLINE );
+	MPL_strncpy( value, "unknown", PMIU_MAXLINE );
 	MPL_snprintf( message, PMIU_MAXLINE, "kvs_%s_not_found", kvsname );
     }
     MPL_snprintf( outbuf, PMIU_MAXLINE, 
@@ -1142,7 +1142,7 @@ static int fPMI_Handle_spawn( PMIProcess *pentry )
 	}
 	else if (strncmp( "preput_key_", cmdPtr, 11 ) == 0) {
 	    /* Save the key */
-	    MPIU_Strncpy( key, valPtr, sizeof(key) );
+	    MPL_strncpy( key, valPtr, sizeof(key) );
 	}
 	else if (strncmp( "preput_val_", cmdPtr, 11 ) == 0) {
 	    /* Place the key,val into the space associate with the current 
@@ -1166,7 +1166,7 @@ static int fPMI_Handle_spawn( PMIProcess *pentry )
 	    /* The actual name has a digit, which indicates *which* info 
 	       key this is */
 	    curInfoIdx = atoi( cmdPtr + 9 );
-	    MPIU_Strncpy( curInfoKey, valPtr, sizeof(curInfoKey) );
+	    MPL_strncpy( curInfoKey, valPtr, sizeof(curInfoKey) );
 	}
 	else if (strncmp( "info_val_", cmdPtr, 9 ) == 0) {
 	    /* The actual name has a digit, which indicates *which* info 
@@ -1177,7 +1177,7 @@ static int fPMI_Handle_spawn( PMIProcess *pentry )
 		return 1;
 	    }
 	    else {
-		MPIU_Strncpy( curInfoVal, valPtr, sizeof(curInfoVal) );
+		MPL_strncpy( curInfoVal, valPtr, sizeof(curInfoVal) );
 		/* Apply this info item */
 		fPMIInfoKey( app, curInfoKey, curInfoVal );
 		/* printf( "Got info %s+%s\n", curInfoKey, curInfoVal ); */
diff --git a/src/pm/util/pmutil.h b/src/pm/util/pmutil.h
index 9f29dbd..98d39ca 100644
--- a/src/pm/util/pmutil.h
+++ b/src/pm/util/pmutil.h
@@ -90,7 +90,7 @@ extern int MPIE_Debug;
 #define MPIU_Free(a)      free((void *)(a))
 #define MPIU_Realloc(a,b)  realloc((void *)(a),(size_t)(b))
 
-int MPIU_Strncpy( char *outstr, const char *instr, size_t maxlen );
+int MPL_strncpy( char *outstr, const char *instr, size_t maxlen );
 int MPIU_Strnapp( char *, const char *, size_t );
 char *MPIU_Strdup( const char * );
 
diff --git a/src/pm/util/rm.c b/src/pm/util/rm.c
index a2f98fc..274563d 100644
--- a/src/pm/util/rm.c
+++ b/src/pm/util/rm.c
@@ -229,7 +229,7 @@ MachineTable *MPIE_ReadMachines( const char *arch, int nNeeded,
 	    len = strlen(path);
 	
 	/* Copy path into the file name */
-	MPIU_Strncpy( dirname, path, len+1 );
+	MPL_strncpy( dirname, path, len+1 );
 
 	dirname[len] = 0;
 
@@ -239,7 +239,7 @@ MachineTable *MPIE_ReadMachines( const char *arch, int nNeeded,
 			   "%s/machines.%s", dirname, arch );
 	}
 	else {
-	    MPIU_Strncpy( machinesfile, dirname, PATH_MAX );
+	    MPL_strncpy( machinesfile, dirname, PATH_MAX );
 	    MPIU_Strnapp( machinesfile, "/machines", PATH_MAX );
 	}
 	DBG_PRINTF( ("Attempting to open %s\n", machinesfile) );
diff --git a/src/pm/util/safestr2.c b/src/pm/util/safestr2.c
index 0b19186..1b7aad1 100644
--- a/src/pm/util/safestr2.c
+++ b/src/pm/util/safestr2.c
@@ -15,7 +15,7 @@
  */
 
 /*
- * MPIU_Strncpy - Copy at most n characters.  Stop once a null is reached.
+ * MPL_strncpy - Copy at most n characters.  Stop once a null is reached.
  *
  * This is different from strncpy, which null pads so that exactly
  * n characters are copied.  The strncpy behavior is correct for many 
@@ -28,7 +28,7 @@
  * Question: should we provide a way to request the length of the string,
  * since we know it?
  */
-/*@ MPIU_Strncpy - Copy a string with a maximum length
+/*@ MPL_strncpy - Copy a string with a maximum length
   
 Input Parameters:
 +   instr - String to copy
@@ -53,7 +53,7 @@ Output Parameters:
   Module:
   Utility
   @*/
-int MPIU_Strncpy( char *dest, const char *src, size_t n )
+int MPL_strncpy( char *dest, const char *src, size_t n )
 {
     char * restrict d_ptr = dest;
     const char * restrict s_ptr = src;
diff --git a/src/pm/util/simple_pmiutil2.c b/src/pm/util/simple_pmiutil2.c
index fcda7e9..c6467fe 100644
--- a/src/pm/util/simple_pmiutil2.c
+++ b/src/pm/util/simple_pmiutil2.c
@@ -54,7 +54,7 @@ void PMIU_Set_rank( int PMI_rank )
 }
 void PMIU_SetServer( void )
 {
-    MPIU_Strncpy( PMIU_print_id, "server", PMIU_IDSIZE );
+    MPL_strncpy( PMIU_print_id, "server", PMIU_IDSIZE );
 }
 
 /* Note that vfprintf is part of C89 */
@@ -243,14 +243,14 @@ int PMIU_parse_keyvals( char *st )
 	/* Null terminate the key */
 	*p = 0;
 	/* store key */
-        MPIU_Strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].key, keystart, 
+        MPL_strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].key, keystart, 
 		      MAXKEYLEN );
 
 	valstart = ++p;			/* start of value */
 	while ( *p != ' ' && *p != '\n' && *p != '\0' )
 	    p++;
 	/* store value */
-        MPIU_Strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].value, valstart, 
+        MPL_strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].value, valstart, 
 		      MAXVALLEN );
 	offset = p - valstart;
 	/* When compiled with -fPIC, the pgcc compiler generates incorrect
@@ -278,9 +278,9 @@ char *PMIU_getval( const char *keystr, char *valstr, int vallen )
     
     for (i = 0; i < PMIU_keyval_tab_idx; i++) {
 	if ( strcmp( keystr, PMIU_keyval_tab[i].key ) == 0 ) { 
-	    rc = MPIU_Strncpy( valstr, PMIU_keyval_tab[i].value, vallen );
+	    rc = MPL_strncpy( valstr, PMIU_keyval_tab[i].value, vallen );
 	    if (rc != 0) {
-		PMIU_printf( 1, "MPIU_Strncpy failed in PMIU_getval\n" );
+		PMIU_printf( 1, "MPL_strncpy failed in PMIU_getval\n" );
 		return NULL;
 	    }
 	    return valstr;
@@ -296,7 +296,7 @@ void PMIU_chgval( const char *keystr, char *valstr )
     
     for ( i = 0; i < PMIU_keyval_tab_idx; i++ ) {
 	if ( strcmp( keystr, PMIU_keyval_tab[i].key ) == 0 ) {
-	    MPIU_Strncpy( PMIU_keyval_tab[i].value, valstr, MAXVALLEN - 1 );
+	    MPL_strncpy( PMIU_keyval_tab[i].value, valstr, MAXVALLEN - 1 );
 	    PMIU_keyval_tab[i].value[MAXVALLEN - 1] = '\0';
 	}
     }
diff --git a/src/pmi/pmi2/simple/pmi2compat.h b/src/pmi/pmi2/simple/pmi2compat.h
index a459fd2..fcb2389 100644
--- a/src/pmi/pmi2/simple/pmi2compat.h
+++ b/src/pmi/pmi2/simple/pmi2compat.h
@@ -9,7 +9,7 @@
 #define PMI2U_Malloc MPIU_Malloc
 #define PMI2U_Free MPIU_Free
 #define PMI2U_Strdup MPIU_Strdup
-#define PMI2U_Strncpy MPIU_Strncpy
+#define PMI2U_Strncpy MPL_strncpy
 #define PMI2U_Strnapp MPIU_Strnapp
 #define PMI2U_Assert MPIU_Assert
 #define PMI2U_Exit MPL_exit
diff --git a/src/pmi/simple/simple_pmi.c b/src/pmi/simple/simple_pmi.c
index 72f2c25..b4a2a0d 100644
--- a/src/pmi/simple/simple_pmi.c
+++ b/src/pmi/simple/simple_pmi.c
@@ -389,9 +389,9 @@ int PMI_KVS_Put( const char kvsname[], const char key[], const char value[] )
 
     /* This is a special hack to support singleton initialization */
     if (PMI_initialized == SINGLETON_INIT_BUT_NO_PM) {
-	rc = MPIU_Strncpy(cached_singinit_key,key,PMI_keylen_max);
+	rc = MPL_strncpy(cached_singinit_key,key,PMI_keylen_max);
 	if (rc != 0) return PMI_FAIL;
-	rc = MPIU_Strncpy(cached_singinit_val,value,PMI_vallen_max);
+	rc = MPL_strncpy(cached_singinit_val,value,PMI_vallen_max);
 	if (rc != 0) return PMI_FAIL;
 	return 0;
     }
diff --git a/src/pmi/simple/simple_pmiutil.c b/src/pmi/simple/simple_pmiutil.c
index c10dc45..930e450 100644
--- a/src/pmi/simple/simple_pmiutil.c
+++ b/src/pmi/simple/simple_pmiutil.c
@@ -58,7 +58,7 @@ void PMIU_Set_rank( int PMI_rank )
 }
 void PMIU_SetServer( void )
 {
-    MPIU_Strncpy( PMIU_print_id, "server", PMIU_IDSIZE );
+    MPL_strncpy( PMIU_print_id, "server", PMIU_IDSIZE );
 }
 
 /* Note that vfprintf is part of C89 */
@@ -238,14 +238,14 @@ int PMIU_parse_keyvals( char *st )
 	/* Null terminate the key */
 	*p = 0;
 	/* store key */
-        MPIU_Strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].key, keystart, 
+        MPL_strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].key, keystart, 
 		      MAXKEYLEN );
 
 	valstart = ++p;			/* start of value */
 	while ( *p != ' ' && *p != '\n' && *p != '\0' )
 	    p++;
 	/* store value */
-        MPIU_Strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].value, valstart, 
+        MPL_strncpy( PMIU_keyval_tab[PMIU_keyval_tab_idx].value, valstart, 
 		      MAXVALLEN );
 	offset = (int)(p - valstart);
 	/* When compiled with -fPIC, the pgcc compiler generates incorrect
@@ -273,9 +273,9 @@ char *PMIU_getval( const char *keystr, char *valstr, int vallen )
     
     for (i = 0; i < PMIU_keyval_tab_idx; i++) {
 	if ( strcmp( keystr, PMIU_keyval_tab[i].key ) == 0 ) { 
-	    rc = MPIU_Strncpy( valstr, PMIU_keyval_tab[i].value, vallen );
+	    rc = MPL_strncpy( valstr, PMIU_keyval_tab[i].value, vallen );
 	    if (rc != 0) {
-		PMIU_printf( 1, "MPIU_Strncpy failed in PMIU_getval\n" );
+		PMIU_printf( 1, "MPL_strncpy failed in PMIU_getval\n" );
 		return NULL;
 	    }
 	    return valstr;
@@ -291,7 +291,7 @@ void PMIU_chgval( const char *keystr, char *valstr )
     
     for ( i = 0; i < PMIU_keyval_tab_idx; i++ ) {
 	if ( strcmp( keystr, PMIU_keyval_tab[i].key ) == 0 ) {
-	    MPIU_Strncpy( PMIU_keyval_tab[i].value, valstr, MAXVALLEN - 1 );
+	    MPL_strncpy( PMIU_keyval_tab[i].value, valstr, MAXVALLEN - 1 );
 	    PMIU_keyval_tab[i].value[MAXVALLEN - 1] = '\0';
 	}
     }
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 0e3aabf..528f199 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -849,7 +849,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     char *basename;
     int ret;
     
-    ret = MPIU_Strncpy(temp_filename, filePattern, MAXPATHLEN);
+    ret = MPL_strncpy(temp_filename, filePattern, MAXPATHLEN);
     if (ret) goto fn_fail;
     
     MPIU_Basename(temp_filename, &basename);
@@ -857,7 +857,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     /* make sure there's enough room in temp_filename to store temp_pattern */
     if (basename - temp_filename > MAXPATHLEN - sizeof(temp_pattern)) goto fn_fail;
     
-    MPIU_Strncpy(basename, temp_pattern, sizeof(temp_pattern));
+    MPL_strncpy(basename, temp_pattern, sizeof(temp_pattern));
     
     fd = mkstemp(temp_filename);
     if (fd == -1) goto fn_fail;
@@ -889,7 +889,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     int ret;
     errno_t ret_errno;
     
-    ret = MPIU_Strncpy(temp_filename, filePattern, MAXPATHLEN);
+    ret = MPL_strncpy(temp_filename, filePattern, MAXPATHLEN);
     if (ret) goto fn_fail;
 
     MPIU_Basename(temp_filename, &basename);
@@ -897,7 +897,7 @@ static int MPIU_DBG_Open_temp_file(FILE **dbg_fp)
     /* make sure there's enough room in temp_filename to store temp_pattern */
     if (basename - temp_filename > MAXPATHLEN - sizeof(temp_pattern)) goto fn_fail;
 
-    MPIU_Strncpy(basename, temp_pattern, sizeof(temp_pattern));
+    MPL_strncpy(basename, temp_pattern, sizeof(temp_pattern));
     
     ret_errno = _mktemp_s(temp_filename, MAXPATHLEN);
     if (ret_errno != 0) goto fn_fail;
diff --git a/src/util/logging/rlog/irlog2rlog.c b/src/util/logging/rlog/irlog2rlog.c
index 9633181..f1539e5 100644
--- a/src/util/logging/rlog/irlog2rlog.c
+++ b/src/util/logging/rlog/irlog2rlog.c
@@ -213,7 +213,7 @@ void SaveArrow(RLOG_IARROW *pArrow)
 
     if (g_fArrow == NULL)
     {
-	MPIU_Strncpy(g_pszArrowFilename, "ArrowFile.tmp", 1024);
+	MPL_strncpy(g_pszArrowFilename, "ArrowFile.tmp", 1024);
 	g_fArrow = fopen(g_pszArrowFilename, "w+b");
 	if (g_fArrow == NULL)
 	{
diff --git a/src/util/logging/rlog/rlog.c b/src/util/logging/rlog/rlog.c
index 3f2ff50..7fd54f3 100644
--- a/src/util/logging/rlog/rlog.c
+++ b/src/util/logging/rlog/rlog.c
@@ -407,11 +407,11 @@ void RLOG_DescribeState(RLOG_Struct* pRLOG, int state, char *name, char *color)
     pHeader->length = sizeof(RLOG_HEADER) + sizeof(RLOG_STATE);
 
     pState->event = state;
-    MPIU_Strncpy(pState->color, (color != NULL) ? color : get_random_color_str(), RLOG_COLOR_LENGTH);
+    MPL_strncpy(pState->color, (color != NULL) ? color : get_random_color_str(), RLOG_COLOR_LENGTH);
     pState->color[RLOG_COLOR_LENGTH-1] = '\0';
     if (name)
     {
-	MPIU_Strncpy(pState->description, name, RLOG_DESCRIPTION_LENGTH);
+	MPL_strncpy(pState->description, name, RLOG_DESCRIPTION_LENGTH);
 	pState->description[RLOG_DESCRIPTION_LENGTH-1] = '\0';
     }
     else
diff --git a/src/util/mem/safestr.c b/src/util/mem/safestr.c
index 000ee3b..313448e 100644
--- a/src/util/mem/safestr.c
+++ b/src/util/mem/safestr.c
@@ -14,73 +14,6 @@
  * operations.
  */
 
-/*
- * MPIU_Strncpy - Copy at most n characters.  Stop once a null is reached.
- *
- * This is different from strncpy, which null pads so that exactly
- * n characters are copied.  The strncpy behavior is correct for many 
- * applications because it guarantees that the string has no uninitialized
- * data.
- *
- * If n characters are copied without reaching a null, return an error.
- * Otherwise, return 0.
- *
- * Question: should we provide a way to request the length of the string,
- * since we know it?
- */
-/*@ MPIU_Strncpy - Copy a string with a maximum length
-  
-Input Parameters:
-+   instr - String to copy
--   maxlen - Maximum total length of 'outstr'
-
-Output Parameters:
-.   outstr - String to copy into
-
-    Notes:
-    This routine is the routine that you wish 'strncpy' was.  In copying 
-    'instr' to 'outstr', it stops when either the end of 'outstr' (the 
-    null character) is seen or the maximum length 'maxlen' is reached.
-    Unlike 'strncpy', it does not add enough nulls to 'outstr' after 
-    copying 'instr' in order to move precisely 'maxlen' characters.  
-    Thus, this routine may be used anywhere 'strcpy' is used, without any
-    performance cost related to large values of 'maxlen'.
-
-    If there is insufficient space in the destination, the destination is
-    still null-terminated, to avoid potential failures in routines that neglect
-    to check the error code return from this routine.
-
-  Module:
-  Utility
-  @*/
-int MPIU_Strncpy( char *dest, const char *src, size_t n )
-{
-    char * restrict d_ptr = dest;
-    const char * restrict s_ptr = src;
-    register int i;
-
-    if (n == 0) return 0;
-
-    i = (int)n;
-    while (*s_ptr && i-- > 0) {
-	*d_ptr++ = *s_ptr++;
-    }
-    
-    if (i > 0) { 
-	*d_ptr = 0;
-	return 0;
-    }
-    else {
-	/* Force a null at the end of the string (gives better safety 
-	   in case the user fails to check the error code) */
-	dest[n-1] = 0;
-	/* We may want to force an error message here, at least in the
-	   debugging version */
-	/*printf( "failure in copying %s with length %d\n", src, n ); */
-	return 1;
-    }
-}
-
 /* Append src to dest, but only allow dest to contain n characters (including
    any null, which is always added to the end of the line */
 /*@ MPIU_Strnapp - Append to a string with a maximum length
@@ -133,49 +66,6 @@ int MPIU_Strnapp( char *dest, const char *src, size_t n )
     }
 }
 
-#ifndef HAVE_STRDUP
-#ifdef MPIU_Strdup
-#undef MPIU_Strdup
-#endif
-/*@ 
-  MPIU_Strdup - Duplicate a string
-
-  Synopsis:
-.vb
-    char *MPIU_Strdup( const char *str )
-.ve
-
-Input Parameters:
-. str - null-terminated string to duplicate
-
-  Return value:
-  A pointer to a copy of the string, including the terminating null.  A
-  null pointer is returned on error, such as out-of-memory.
-
-  Notes:
-  Like 'MPIU_Malloc' and 'MPIU_Free', this will often be implemented as a 
-  macro but may use 'MPIU_trstrdup' to provide a tracing version.
-
-  Module:
-  Utility
-  @*/
-char *MPIU_Strdup( const char *str )
-{
-    char * restrict p = (char *)MPIU_Malloc( strlen(str) + 1 );
-    const char * restrict in_p = str;
-    char *save_p;
-
-    save_p = p;
-    if (p) {
-	while (*in_p) {
-	    *p++ = *in_p++;
-	}
-	*p = 0;
-    }
-    return save_p;
-}
-#endif
-
 /* MPIU_Basename(path, basename)
    This function finds the basename in a path (ala "man 1 basename").
    *basename will point to an element in path.

http://git.mpich.org/mpich.git/commitdiff/e7ca9b82e0cf5b3ffbed46984c8dbe513177e459

commit e7ca9b82e0cf5b3ffbed46984c8dbe513177e459
Author: Pavan Balaji <balaji at anl.gov>
Date:   Mon Dec 28 14:20:19 2015 -0600

    safestr: remove unused MPIU and corresponding MPL functions.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/configure.ac b/configure.ac
index a352893..0e27ce4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4660,27 +4660,6 @@ if test "$enable_g_mem" != "yes" ; then
         # Do we need to declare strdup?
         PAC_FUNC_NEEDS_DECL([#include <string.h>],strdup)
     fi
-else
-    # search.h is used for fancier output from trmem.  Disabled for now,
-    # since the tsearch routines have problematic prototypes.
-    AC_CHECK_HEADERS(search)
-    AC_CHECK_FUNCS(tsearch)
-    # Check that we can compile tsearch without error.  Try to compile
-    # it with the header and the char * args
-    if test "$ac_cv_func_tsearch" = "yes" ; then
-        AC_CACHE_CHECK([whether tsearch requires char* args],
-	               pac_cv_tsearch_charp,[
-        AC_TRY_COMPILE([#include <search.h>
-    char *tsearch( char *k, char **r, (int (*)())compare ) { return k; }],
-    [int f=0;],pac_cv_tsearch_charp=yes,pac_cv_tsearch_charp=no)])
-        if test "$pac_cv_tsearch_charp" = "yes" ; then
-	    # this should consider defining a name with the argument type
-	    # so that no further ifdefs are needed
-	    AC_DEFINE(USE_TSEARCH_WITH_CHARP,1,[Define if tsearch requires char pointers])
-	fi
-    fi
-    # Note that HPUX and AIX may require _INCLUDE_XOPEN_SOURCE or
-    # _XOPEN_SOURCE be defined respectively.
 fi
 
 # ----------------------------------------------------------------------------
diff --git a/src/include/mpimem.h b/src/include/mpimem.h
index cc4d1e0..71ee499 100644
--- a/src/include/mpimem.h
+++ b/src/include/mpimem.h
@@ -137,14 +137,9 @@ void MPIU_trinit(int);
 void *MPIU_trmalloc(size_t, int, const char []);
 void MPIU_trfree(void *, int, const char []);
 int MPIU_trvalid(const char []);
-void MPIU_trspace(size_t *, size_t *);
-void MPIU_trid(int);
-void MPIU_trlevel(int);
-void MPIU_trDebugLevel(int);
 void *MPIU_trcalloc(size_t, size_t, int, const char []);
 void *MPIU_trrealloc(void *, size_t, int, const char[]);
 void *MPIU_trstrdup(const char *, int, const char[]);
-void MPIU_TrSetMaxMem(size_t);
 void MPIU_trdump(FILE *, int);
 
 #ifdef USE_MEMORY_TRACING
diff --git a/src/mpi/init/initthread.c b/src/mpi/init/initthread.c
index ab1f771..87da31e 100644
--- a/src/mpi/init/initthread.c
+++ b/src/mpi/init/initthread.c
@@ -502,9 +502,6 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
        allocated already will have an id of zero; this helps 
        separate memory leaks in the initialization code from 
        leaks in the "active" code */
-    /* Uncomment this code to leave out any of the MPID_Init/etc 
-       memory allocations from the memory leak testing */
-    /* MPIU_trid( 1 ); */
 #endif
 #ifdef USE_DBG_LOGGING
     MPIU_DBG_Init( argc, argv, has_args, has_env, 
diff --git a/src/mpl/configure.ac b/src/mpl/configure.ac
index a1c000d..647c3bd 100644
--- a/src/mpl/configure.ac
+++ b/src/mpl/configure.ac
@@ -73,7 +73,7 @@ if test "$pac_cv_have___typeof" = "yes" ; then
 fi
 
 dnl Check if the necessary headers are available
-AC_CHECK_HEADERS(stdio.h stdlib.h string.h stdarg.h ctype.h search.h sys/types.h sys/uio.h execinfo.h backtrace.h libunwind.h)
+AC_CHECK_HEADERS(stdio.h stdlib.h string.h stdarg.h ctype.h sys/types.h sys/uio.h execinfo.h backtrace.h libunwind.h)
 
 # A C99 compliant compiler should have inttypes.h for fixed-size int types
 AC_CHECK_HEADERS(inttypes.h stdint.h)
diff --git a/src/mpl/include/mpl_trmem.h b/src/mpl/include/mpl_trmem.h
index 2c8766e..6d7d7d0 100644
--- a/src/mpl/include/mpl_trmem.h
+++ b/src/mpl/include/mpl_trmem.h
@@ -16,19 +16,12 @@ void *MPL_trmalloc(size_t, int, const char[]);
 void MPL_trfree(void *, int, const char[]);
 int MPL_trvalid(const char[]);
 int MPL_trvalid2(const char[],int,const char[]);
-void MPL_trspace(size_t *, size_t *);
-void MPL_trid(int);
-void MPL_trlevel(int);
-void MPL_trDebugLevel(int);
 void *MPL_trcalloc(size_t, size_t, int, const char[]);
 void *MPL_trrealloc(void *, size_t, int, const char[]);
 void *MPL_trstrdup(const char *, int, const char[]);
-void MPL_TrSetMaxMem(size_t);
 
 /* Make sure that FILE is defined */
 #include <stdio.h>
 void MPL_trdump(FILE *, int);
-void MPL_trSummary(FILE *, int);
-void MPL_trdumpGrouped(FILE *, int);
 
 #endif /* !defined(MPL_TRMEM_H_INCLUDED) */
diff --git a/src/mpl/src/mem/mpl_trmem.c b/src/mpl/src/mem/mpl_trmem.c
index 0da22e9..8580902 100644
--- a/src/mpl/src/mem/mpl_trmem.c
+++ b/src/mpl/src/mem/mpl_trmem.c
@@ -27,58 +27,13 @@
 #endif
 #endif
 
-#if defined(MPL_HAVE_STDLIB_H) || defined(MPL_STDC_HEADERS)
-#include <stdlib.h>
-#else
-/* We should test to see if these will work */
-extern void *malloc(size_t);
-extern void *calloc(size_t, size_t);
-extern int free(void *);
-#endif
-
-/*D
-    MPL_trspace - Routines for tracing space usage
-
-    Description:
-    MPL_trmalloc replaces malloc and MPL_trfree replaces free.
-    These routines
-    have the same syntax and semantics as the routines that they replace,
-    In addition, there are routines to report statistics on the memory
-    usage, and to report the currently allocated space.  These routines
-    are built on top of malloc and free, and can be used together with
-    them as long as any space allocated with MPL_trmalloc is only freed with
-    MPL_trfree.
-
-    Note that the malloced data is scrubbed each time; you don't get
-    random trash (or fortuitous zeros).  What you get is fc (bytes);
-    this will usually create a "bad" value.
-
-    As an aid in developing codes, a maximum memory threshold can
-    be set with MPL_TrSetMaxMem.
- D*/
-
 /* HEADER_DOUBLES is the number of doubles in a trSPACE header */
 /* We have to be careful about alignment rules here */
-#define USE_LONG_NAMES_IN_TRMEM
-#ifdef USE_LONG_NAMES_IN_TRMEM
 /* Assume worst case and align on 8 bytes */
 #define TR_ALIGN_BYTES 8
 #define TR_ALIGN_MASK  0x7
 #define TR_FNAME_LEN   48
 #define HEADER_DOUBLES 19
-#else
-#if SIZEOF_VOID_P > 4
-#define TR_ALIGN_BYTES 8
-#define TR_ALIGN_MASK  0x7
-#define TR_FNAME_LEN   16
-#define HEADER_DOUBLES 12
-#else
-#define TR_ALIGN_BYTES 4
-#define TR_ALIGN_MASK  0x3
-#define TR_FNAME_LEN   12
-#define HEADER_DOUBLES 8
-#endif
-#endif
 
 #define COOKIE_VALUE   0xf0e0d0c9
 #define ALREADY_FREED  0x0f0e0d9c
@@ -118,7 +73,6 @@ static volatile int TRidSet = 0;
 static volatile int TRlevel = 0;
 static unsigned char TRDefaultByte = 0xda;
 static unsigned char TRFreedByte = 0xfc;
-#define MAX_TR_STACK 20
 static int TRdebugLevel = 0;
 static int TRSetBytes   = 0;
 #define TR_MALLOC 0x1
@@ -590,22 +544,6 @@ int MPL_trvalid2(const char str[], int line, const char file[] )
 }
 
 /*+C
-   MPL_trspace - Return space statistics
-
-   Output parameters:
-.   space - number of bytes currently allocated
-.   frags - number of blocks currently allocated
- +*/
-void MPL_trspace(size_t *space, size_t *fr)
-{
-    /* We use ints because systems without prototypes will usually
-     * allow calls with ints instead of longs, leading to unexpected
-     * behavior */
-    *space =  allocated;
-    *fr =  frags;
-}
-
-/*+C
   MPL_trdump - Dump the allocated memory blocks to a file
 
 Input Parameters:
@@ -662,137 +600,6 @@ void MPL_trdump(FILE * fp, int minid)
  */
 }
 
-/* Configure will set HAVE_SEARCH for these systems.  We assume that
-   the system does NOT have search.h unless otherwise noted.
-   The otherwise noted lets the non-configure approach work on our
-   two major systems */
-#if defined(HAVE_SEARCH_H)
-
-/* The following routine uses the tsearch routines to summarize the
-   memory heap by id */
-
-#include <search.h>
-typedef struct TRINFO {
-    int id, size, lineno;
-    char *fname;
-} TRINFO;
-
-static int IntCompare(TRINFO * a, TRINFO * b)
-{
-    return a->id - b->id;
-}
-
-static volatile FILE *TRFP = 0;
-static void PrintSum(TRINFO ** a, VISIT order, int level)
-{
-    if (order == postorder || order == leaf)
-        fprintf(TRFP, "[%d]%s[%d] has %d\n", (*a)->id, (*a)->fname, (*a)->lineno, (*a)->size);
-}
-
-/*+C
-  MPL_trSummary - Summarize the allocate memory blocks by id
-
-Input Parameters:
-+  fp  - file pointer.  If fp is NULL, stderr is assumed.
--  minid - Only print allocated memory blocks whose id is at least 'minid'
-
-  Note:
-  This routine is the same as MPL_trDump on those systems that do not include
-  /usr/include/search.h .
- +*/
-void MPL_trSummary(FILE * fp, int minid)
-{
-    TRSPACE *head;
-    TRINFO *root, *key, **fnd;
-    TRINFO nspace[1000];
-
-    if (fp == 0)
-        fp = stderr;
-    root = 0;
-    if (TRhead[0] != TRHEAD_PRESENTINAL || TRhead[2] != TRHEAD_POSTSENTINAL) {
-        MPL_error_printf("TRhead corrupted - likely memory overwrite.\n");
-        return;
-    }
-    head = TRhead[1];
-    key = nspace;
-    while (head) {
-        if (head->id >= minid) {
-            key->id = head->id;
-            key->size = 0;
-            key->lineno = head->lineno;
-            key->fname = head->fname;
-#if defined(USE_TSEARCH_WITH_CHARP)
-            fnd = (TRINFO **) tsearch((char *) key, (char **) &root, IntCompare);
-#else
-            fnd = (TRINFO **) tsearch((void *) key, (void **) &root, (int (*)()) IntCompare);
-#endif
-            if (*fnd == key) {
-                key->size = 0;
-                key++;
-            }
-            (*fnd)->size += head->size;
-        }
-        head = head->next;
-    }
-
-    /* Print the data */
-    TRFP = fp;
-    twalk((char *) root, (void (*)()) PrintSum);
-    /*
-     * msg_fprintf(fp, "# [%d] The maximum space allocated was %d bytes [%d]\n",
-     * world_rank, TRMaxMem, TRMaxMemId);
-     */
-}
-#else
-void MPL_trSummary(FILE * fp, int minid)
-{
-    if (fp == 0)
-        fp = stderr;
-    fprintf(fp, "# [%d] The maximum space allocated was %lu bytes [%d]\n",
-            world_rank, (unsigned long)TRMaxMem, TRMaxMemId);
-}
-#endif
-
-/*+
-  MPL_trid - set an "id" field to be used with each fragment
- +*/
-void MPL_trid(int id)
-{
-    TRid = id;
-    TRidSet = 1;        /* Recall whether we ever use this feature to
-                         * help clean up output */
-}
-
-/*+C
-  MPL_trlevel - Set the level of output to be used by the tracing routines
-
-Input Parameters:
-. level = 0 - notracing
-. level = 1 - trace mallocs
-. level = 2 - trace frees
-
-  Note:
-  You can add levels together to get combined tracing.
- +*/
-void MPL_trlevel(int level)
-{
-    TRlevel = level;
-}
-
-
-/*+C
-    MPL_trDebugLevel - set the level of debugging for the space management
-    routines
-
-Input Parameters:
-.   level - level of debugging.  Currently, either 0 (no checking) or 1
-    (use MPL_trvalid at each MPL_trmalloc or MPL_trfree).
-+*/
-void MPL_trDebugLevel(int level)
-{
-    TRdebugLevel = level;
-}
-
 /*+C
     MPL_trcalloc - Calloc with tracing
 
@@ -905,146 +712,3 @@ void *MPL_trstrdup(const char *str, int lineno, const char fname[])
     }
     return p;
 }
-
-#define TR_MAX_DUMP 100
-/*
-   The following routine attempts to give useful information about the
-   memory usage when an "out-of-memory" error is encountered.  The rules are:
-   If there are less than TR_MAX_DUMP blocks, output those.
-   Otherwise, try to find multiple instances of the same routine/line #, and
-   print a summary by number:
-   file line number-of-blocks total-number-of-blocks
-
-   We have to do a sort-in-place for this
- */
-
-/*
-  Sort by file/line number.  Do this without calling a system routine or
-  allocating ANY space (space is being optimized here).
-
-  We do this by first recursively sorting halves of the list and then
-  merging them.
- */
-/* Forward refs for these local (hence static) routines */
-static TRSPACE *MPL_trImerge(TRSPACE *, TRSPACE *);
-static TRSPACE *MPL_trIsort(TRSPACE *, int);
-static void MPL_trSortBlocks(void);
-
-/* Merge two lists, returning the head of the merged list */
-static TRSPACE *MPL_trImerge(TRSPACE * l1, TRSPACE * l2)
-{
-    TRSPACE *head = 0, *tail = 0;
-    int sign;
-    while (l1 && l2) {
-        sign = strncmp(l1->fname, l2->fname, TR_FNAME_LEN - 1);
-        if (sign > 0 || (sign == 0 && l1->lineno >= l2->lineno)) {
-            if (head)
-                tail->next = l1;
-            else
-                head = tail = l1;
-            tail = l1;
-            l1 = l1->next;
-        }
-        else {
-            if (head)
-                tail->next = l2;
-            else
-                head = tail = l2;
-            tail = l2;
-            l2 = l2->next;
-        }
-    }
-    /* Add the remaining elements to the end */
-    if (l1)
-        tail->next = l1;
-    if (l2)
-        tail->next = l2;
-
-    return head;
-}
-
-/* Sort head with n elements, returning the head */
-/* assumes that the MEMALLOC critical section is currently held */
-static TRSPACE *MPL_trIsort(TRSPACE * head, int n)
-{
-    TRSPACE *p, *l1, *l2;
-    int m, i;
-
-    if (n <= 1)
-        return head;
-
-    /* This guarentees that m, n are both > 0 */
-    m = n / 2;
-    p = head;
-    for (i = 0; i < m - 1; i++)
-        p = p->next;
-    /* p now points to the END of the first list */
-    l2 = p->next;
-    p->next = 0;
-    l1 = MPL_trIsort(head, m);
-    l2 = MPL_trIsort(l2, n - m);
-    return MPL_trImerge(l1, l2);
-}
-
-/* assumes that the MEMALLOC critical section is currently held */
-static void MPL_trSortBlocks(void)
-{
-    TRSPACE *head;
-    int cnt;
-
-    if (TRhead[0] != TRHEAD_PRESENTINAL || TRhead[2] != TRHEAD_POSTSENTINAL) {
-        MPL_error_printf("TRhead corrupted - likely memory overwrite.\n");
-        return;
-    }
-    head = TRhead[1];
-    cnt = 0;
-    while (head) {
-        cnt++;
-        head = head->next;
-    }
-    TRhead[1] = MPL_trIsort(TRhead[1], cnt);
-}
-
-/* Takes sorted input and dumps as an aggregate */
-void MPL_trdumpGrouped(FILE * fp, int minid)
-{
-    TRSPACE *head, *cur;
-    int nblocks, nbytes;
-
-    if (fp == 0)
-        fp = stderr;
-
-    if (TRhead[0] != TRHEAD_PRESENTINAL || TRhead[2] != TRHEAD_POSTSENTINAL) {
-        MPL_error_printf("TRhead corrupted - likely memory overwrite.\n");
-        return;
-    }
-
-    MPL_trSortBlocks();
-    head = TRhead[1];
-    cur = 0;
-    while (head) {
-        cur = head->next;
-        if (head->id >= minid) {
-            nblocks = 1;
-            nbytes = (int) head->size;
-            while (cur &&
-                   strncmp(cur->fname, head->fname, TR_FNAME_LEN - 1) == 0 &&
-                   cur->lineno == head->lineno) {
-                nblocks++;
-                nbytes += (int) cur->size;
-                cur = cur->next;
-            }
-            fprintf(fp,
-                    "[%d] File %13s line %5d: %d bytes in %d allocation%c\n",
-                    world_rank, head->fname, head->lineno, nbytes, nblocks,
-                    (nblocks > 1) ? 's' : ' ');
-        }
-        head = cur;
-    }
-    fflush(fp);
-}
-
-void MPL_TrSetMaxMem(size_t size)
-{
-    TRMaxMemAllow = size;
-}
diff --git a/src/util/mem/trmem.c b/src/util/mem/trmem.c
index 73549ad..97520cb 100644
--- a/src/util/mem/trmem.c
+++ b/src/util/mem/trmem.c
@@ -47,34 +47,6 @@ int MPIU_trvalid(const char str[])
     return retval;
 }
 
-void MPIU_trspace(size_t *space, size_t *fr)
-{
-    MPID_THREAD_CS_ENTER(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-    MPL_trspace(space, fr);
-    MPID_THREAD_CS_EXIT(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-}
-
-void MPIU_trid(int id)
-{
-    MPID_THREAD_CS_ENTER(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-    MPL_trid(id);
-    MPID_THREAD_CS_EXIT(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-}
-
-void MPIU_trlevel(int level)
-{
-    MPID_THREAD_CS_ENTER(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-    MPL_trlevel(level);
-    MPID_THREAD_CS_EXIT(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-}
-
-void MPIU_trDebugLevel(int level)
-{
-    MPID_THREAD_CS_ENTER(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-    MPL_trDebugLevel(level);
-    MPID_THREAD_CS_EXIT(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-}
-
 void *MPIU_trcalloc(size_t nelem, size_t elsize, int lineno, const char fname[])
 {
     void *retval;
@@ -101,11 +73,3 @@ void *MPIU_trstrdup(const char *str, int lineno, const char fname[])
     MPID_THREAD_CS_EXIT(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
     return retval;
 }
-
-void MPIU_TrSetMaxMem(size_t size)
-{
-    MPID_THREAD_CS_ENTER(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-    MPL_TrSetMaxMem(size);
-    MPID_THREAD_CS_EXIT(ALLGRAN, MPIR_THREAD_ALLGRAN_MEMALLOC_MUTEX);
-}
-

http://git.mpich.org/mpich.git/commitdiff/90d7f8848bbebe20e8219b61d69d1385e313f791

commit 90d7f8848bbebe20e8219b61d69d1385e313f791
Author: Pavan Balaji <balaji at anl.gov>
Date:   Sun Jan 3 21:17:59 2016 -0600

    timers: initial move of the timer code to MPL.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/.gitignore b/.gitignore
index 0bd7ad3..04b565a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -200,6 +200,7 @@ Makefile.am-stamp
 /src/mpl/confdb
 /src/mpl/libtool
 /src/mpl/include/mplconfig.h
+/src/mpl/include/mpl_timer.h
 /src/mpl/include/stamp-h1
 /src/mpl/include/config.h
 /src/mpl/include/stamp-h2
@@ -577,9 +578,6 @@ Makefile.am-stamp
 /src/util/logging/rlog/irlog2rlog
 /src/util/logging/rlog/trace_impl.h
 
-# /src/util/timers
-/src/util/timers/mpiu_timer.h
-
 # /test/
 /test/runtests
 
diff --git a/configure.ac b/configure.ac
index 681246a..a352893 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4704,318 +4704,6 @@ fi
 
 
 # ----------------------------------------------------------------------------
-# Support for timers.  The following code processes the 
-#  --enable-timer-type=name argument and selects the timer based on 
-# both that field and what configure is able to determine is available.
-# The file src/include/mpiu_timer.h is also created.
-# Note that at least the handling of the "device" option must come *after* 
-# the setup_device script is loaded so that the device can set the appropriate
-# fields.  For now, we've split this so that there is an update to the timer
-# after the setup_device script is loaded, but we should consider moving
-# this entire block.
-# FIXME DJG setup_device has been eliminated in favor of subconfigure.m4 files
-# ----------------------------------------------------------------------------
-# Default type for timer stamp.
-MPICH_TIMER_TYPE=long
-AC_SUBST(MPICH_TIMER_TYPE)
-
-# If the device specified a timer type, use that by default.  Else,
-# try to detect a type that works on this system.
-if test -n "$MPID_DEVICE_DEFINES_TIMER" ; then
-   default_timer_type=device
-else
-   default_timer_type=
-fi
-
-# clock_gettime is the POSIX gettimeofday
-# gethrtime is the Solaris high-resolution timer
-dnl
-dnl Specific checks that a function works correctly
-dnl
-dnl Now that we know what the options are, choose the timer to use
-dnl
-dnl The default preference is
-dnl    Solaris gethrtime
-dnl    Posix   clock_gettime
-dnl    Unix    gettimeofday (one of two versions)
-dnl
-dnl Also available are various hardware time stamps
-dnl    Linux-x86 cycle counter
-dnl    Linux-alpha cycle counter
-dnl
-dnl We also allow --enable-timer-type=name to select a timer type
-AC_ARG_ENABLE(timer-type,
-[  --enable-timer-type=name - Select the timer to use for MPI_Wtime and
-                             internal timestamps.
-        gethrtime          - Solaris timer (Solaris systems only)
-        clock_gettime      - Posix timer (where available)
-        gettimeofday       - Most Unix systems
-        linux86_cycle      - Linux x86; returns cycle counts, not time in seconds*
-        gcc_ia64_cycle     - IPF ar.itc timer*
-	mach_absolute_time - Mach absolute time (alternative to clock_gettime
-                             for OSX)
-        device - The timer is provided by the device
-
-        *Note that the cycle timers are intended to be used by MPICH
-        developers for internal low-level timing.  Normal users should
-        not use these as they are not guaranteed to be accurate in
-        certain situations.
-],timer_type=$enable_timer_type,timer_type=${default_timer_type})
-
-if test -z "$timer_type" ; then 
-    # Try to pick a timer based on what is available
-    AC_CHECK_FUNCS(clock_gettime clock_getres gethrtime mach_absolute_time gettimeofday)
-    if test "$ac_cv_func_gethrtime" = "yes" ; then
-        # Sigh.  The Solaris include files do not define hrtime_t
-	# Before we accept this choice, make sure that we can 
-	# do arithmetic with hrtime_t .
-        AC_CACHE_CHECK([that hrtime_t is properly defined for gethrtime],
-	pac_cv_hrtime_works,[
-	AC_TRY_COMPILE([
-#include <sys/time.h>
-],[hrtime_t t1, t2; t1 = 1; t2 = 2; t1 = t1 + t2;],
-pac_cv_hrtime_works=yes,pac_cv_hrtime_works=no)])
-	# A more ambitious test would look to see if casting an 
-	# hrtime_t to int64_t works, and even more ambitious
-	# would check whether long or long long was 64 bits (or even
-	# better, the sizeof hrtime_t).  
-    fi
-    if test "$ac_cv_func_gethrtime" = "yes" -a \
-            "$pac_cv_hrtime_works" = "yes" ; then
-        timer_type=gethrtime
-    elif test "$ac_cv_func_clock_gettime" = "yes" -a \
-              "$ac_cv_func_clock_getres" = "yes" ; then
-	 # Test on both because some systems (e.g., cygwin) provide
-	 # clock_gettime but not clock_getres
-        timer_type=clock_gettime
-    elif test "$ac_cv_func_mach_absolute_time" = "yes" ; then 
-        timer_type=mach_absolute_time
-    elif test "$ac_cv_func_gettimeofday" = "yes" ; then
-        timer_type=gettimeofday
-    fi
-fi
-if test -z "$timer_type" ; then
-    AC_MSG_ERROR([No timer found])
-fi
-
-# Check for valid timer and select datatypes for the time stamp
-case "$timer_type" in
-
-    gethrtime)
-    MPICH_TIMER_TYPE=hrtime_t
-    AC_CHECK_FUNC(gethrtime,,[
-         AC_MSG_ERROR([Requested timer gethrtime is not available])
-])
-    ;;
-
-    clock_gettime)
-    missing_function=no
-    AC_SEARCH_LIBS([clock_gettime],[rt],,AC_MSG_ERROR([clock_gettime is not available]))
-    AC_SEARCH_LIBS([clock_getres],[rt],,AC_MSG_ERROR([clock_getres is not available]))
-    MPICH_TIMER_TYPE="struct timespec"
-    # AIX does not always define struct timespec (!)
-    # Make sure that we can use struct timespec
-    AC_CACHE_CHECK([whether struct timespec is defined in time.h],
-                    pac_cv_struct_timespec_defined,[
-    AC_TRY_COMPILE([
-#include <time.h>],[
-    struct timespec t;],pac_cv_struct_timespec_defined=yes,
-    pac_cv_struct_timespec_defined=no)
-])
-    if test "$pac_cv_struct_timespec_defined" != "yes" ; then
-        # Try again, but with -D_XOPEN_SOURCE=500 (works for AIX)
-        AC_CACHE_CHECK([whether struct timespec is defined in time.h with _XOPEN_SOURCE=500],
-                    pac_cv_struct_timespec_defined_with_xopen500,[
-        AC_TRY_COMPILE([
-#define _XOPEN_SOURCE 500
-#include <time.h>],[
-    struct timespec t;],pac_cv_struct_timespec_defined_with_xopen500=yes,
-    pac_cv_struct_timespec_defined_with_xopen500=no)
-])
-	if test "$pac_cv_struct_timespec_defined_with_xopen500" = "yes" ; then
-	    # We need to define _XOPEN_SOURCE=500, but we need to ensure that
-	    # this is done before any include files are loaded.  At
-	    # this point it is really too late to add this definition,
-	    # since it may make other tests incompatible.
-	    AC_MSG_ERROR([The available timer requires _XOPEN_SOURCE=500.  Add -D_XOPEN_SOURCE=500 to CFLAGS and rerun configure])
-        fi
-    fi
-    # 
-    # FreeBSD 4.3 incorrectly puts the header into sys/time.h; 
-    # time.h is required (see pages 45 and 46 in the POSIX standard).
-    # See if we can compile
-    AC_CACHE_CHECK([for CLOCK_REALTIME defined in time.h],pac_cv_posix_clock_realtime,[
-    AC_TRY_COMPILE([
-#include <time.h>],[
-    clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes,
-pac_cv_posix_clock_realtime=no)])
-    if test "$pac_cv_posix_clock_realtime" = "no" ; then
-         AC_MSG_WARN([POSIX timer requires definitions in time.h])
-	 # Check for the definition in sys/time.h, which is where
-	 # OpenBSD and FreeBSD have put it by mistake
-         AC_TRY_COMPILE([
-#include <time.h>
-#include <sys/time.h>],[
-    clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes,
-pac_cv_posix_clock_realtime=no)
-	if test "$pac_cv_posix_clock_realtime" = yes ; then
-	    AC_MSG_WARN([sys/time.h required for POSIX timer])
-	    AC_DEFINE(NEEDS_SYS_TIME_H,1,[Define if sys/time.h is required to get timer definitions])
-	else
-	    AC_MSG_ERROR([Cannot find the definition of CLOCK_REALTIME for the POSIX timer])
-	fi
-    fi
-    ;;
-
-    gettimeofday)
-    MPICH_TIMER_TYPE="struct timeval"
-    # We may have already tested for gettimeofday.  If we got a "yes",
-    # we're good to go
-    if test "$ac_cv_func_gettimeofday" != "yes" ; then
-        AC_CHECK_FUNC(gettimeofday,,[
-         AC_MSG_ERROR([Requested timer gettimeofday is not available])
-])
-    fi
-    ;;
-
-    linux86_cycle|linux86_cycle_2)
-    
-# The following AC_TRY_RUN statements are needed because x86_64 compilers
-# usually know about rdtscp but the cpu may or may not actually implement the
-# feature.  This is not cross-compile safe, unfortunately.  In the long run we
-# should allow the user to override this with a configure flag.
-    AC_CACHE_CHECK([that linux86 cycle counter is available],
-        pac_cv_linux86_cycle,
-            AC_TRY_RUN([
-int main()
-{
-    /* rdtscp */
-    long long var, *var_ptr=&var;
-    __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
-    return 0;
-}
-            ],pac_cv_linux86_cycle=rdtscp,
-                AC_TRY_RUN([[
-int main()
-{
-    /* cpuid 64 */
-    long long var, *var_ptr=&var;
-    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
-    return 0;
-}
-                ]],pac_cv_linux86_cycle=cpuid_rdtsc64,
-                    AC_TRY_RUN([[[
-int main()
-{
-    /* cpuid 32 */
-    long long var, *var_ptr=&var;
-    __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
-    return 0;
-}
-                    ]]],pac_cv_linux86_cycle=cpuid_rdtsc32,
-                        AC_TRY_RUN([[[[
-int main()
-{
-    /* simple */
-    long long var, *var_ptr=&var;
-    __asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
-    return 0;
-}
-                        ]]]],pac_cv_linux86_cycle=rdtsc,
-                        pac_cv_linux86_cycle=no)
-                    )
-                ),
-dnl The if-cross-compiling clause from the first AC_TRY_RUN.  Hope that if the
-dnl compiler knows about the instruction then it's supported by the target
-dnl platform.
-                AC_TRY_COMPILE(,[[
-                    long long var, *var_ptr=&var;
-                    __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
-                ]],pac_cv_linux86_cycle=rdtscp,
-                    AC_TRY_COMPILE(,[[[
-                        long long var, *var_ptr=&var;
-                        __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
-                    ]]],pac_cv_linux86_cycle=cpuid_rdtsc64,
-                        AC_TRY_COMPILE(,[[[[
-                            long long var, *var_ptr=&var;
-                            __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
-                        ]]]],pac_cv_linux86_cycle=cpuid_rdtsc32,
-                            AC_TRY_COMPILE(,[[[[[
-                                long long var, *var_ptr=&var;
-                                __asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
-                            ]]]]],pac_cv_linux86_cycle=rdtsc,
-                            pac_cv_linux86_cycle=no)
-                        )
-                    )
-                )
-            )
-    )
-
-    case "$pac_cv_linux86_cycle" in
-        "rdtscp")
-            AC_DEFINE(LINUX86_CYCLE_RDTSCP,1,[Define which x86 cycle counter to use])
-	    ;;
-        "cpuid_rdtsc64")
-            AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC64,1,[Define which x86 cycle counter to use])
-            ;;
-        "cpuid_rdtsc32")
-            AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC32,1,[Define which x86 cycle counter to use])
-	    ;;
-        "rdtsc")
-            AC_DEFINE(LINUX86_CYCLE_RDTSC,1,[Define which x86 cycle counter to use])
-	    ;;
-        *)
-            cpu_gcc_x86_cycle=no
-	    ;;
-    esac
-
-    if test "$cpu_gcc_x86_cycle" = "no" ; then
-        AC_MSG_ERROR([Linux86 cycle counter is not available on this system and or with the $CC compiler])
-    fi
-    MPICH_TIMER_TYPE="long long"
-    ;;
-
-    gcc_ia64_cycle)
-    AC_CACHE_CHECK([that IPF timer is available],
-pac_cv_ia64_cycle,[
-    AC_TRY_COMPILE(,[
-    long var, *var_ptr=&var;
-#ifdef __INTEL_COMPILER
-#include "ia64regs.h"
-    var=__getReg(_IA64_REG_AR_ITC);
-#else
-    __asm__ __volatile__("mov %0=ar.itc" : "=r" (var_ptr));
-#endif
-],pac_cv_gcc_ia64_cycle=yes,pac_cv_gcc_ia64_cycle=no)])
-    if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then
-        AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler])
-     fi
-     MPICH_TIMER_TYPE="long"
-     ;;
-
-    mach_absolute_time)
-    AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])])
-    AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])])
-    MPICH_TIMER_TYPE="uint64_t"
-    ;;
-
-    device)
-    # The device selected should export the datatype for the timer
-    MPICH_TIMER_TYPE="void *"
-    ;;
-
-    *)
-    AC_MSG_ERROR([Invalid timer type $timer_type])
-    ;;
-esac
-# Convert timer type to upper case
-timer_type=`echo $timer_type | \
-    tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-MPICH_TIMER_KIND=MPIU_TIMER_KIND__$timer_type
-AC_SUBST(MPICH_TIMER_KIND)
-# ----------------------------------------------------------------------------
-# End of code for timer support (except for ac_ OUTPUT)
-# ----------------------------------------------------------------------------
 # Setup other replaceable values
 AC_SUBST(MPILIBNAME)
 AC_SUBST(PMPILIBNAME)
@@ -6190,7 +5878,6 @@ AC_OUTPUT(Makefile \
 	  src/env/mpifort.bash \
           src/env/parkill \
 	  src/util/dbg/getfuncstack \
-	  src/util/timers/mpiu_timer.h \
           src/include/mpi.h \
           doc/design/Makefile \
           doc/installguide/Makefile \
diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index 9eebc69..2598ffd 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -4283,9 +4283,7 @@ sub build_specials {
     &set_weak_decl( "MPI_Wtime", "void", "double" );
     &set_weak_decl( "PMPI_Wtime", "void", "double" );
     &print_header( "mpi_", "MPI_Wtime", "wtime", "" );
-    # mpiu_timer.h is needed for the timer definitions
     print $OUTFD "#include \"mpichconf.h\"\n";
-    print $OUTFD "#include \"mpiu_timer.h\"\n";
     &print_routine_type_decl( $OUTFD, $out_prefix, "wtime" );
     print $OUTFD "( void ) ";
     #&print_attr;
@@ -4312,9 +4310,7 @@ sub build_specials {
     &set_weak_decl( "MPI_Wtick", "void", "double" );
     &set_weak_decl( "PMPI_Wtick", "void", "double" );
     &print_header( "mpi_", "MPI_Wtick", "wtick", "" );
-    # mpiu_timer.h is needed for the timer definitions
     print $OUTFD "#include \"mpichconf.h\"\n";
-    print $OUTFD "#include \"mpiu_timer.h\"\n";
     &print_routine_type_decl( $OUTFD, $out_prefix, "wtick" );
     print $OUTFD "( void ) ";
     #&print_attr;
diff --git a/src/include/mpiutil.h b/src/include/mpiutil.h
index 18937de..94de015 100644
--- a/src/include/mpiutil.h
+++ b/src/include/mpiutil.h
@@ -11,7 +11,6 @@
 #include "mpiu_type_defs.h"
 #include "mpidbg.h"
 #include "mpiassert.h"
-#include "mpiu_timer.h"
 #include "mpiu_pointer.h"
 
 #endif /* !defined(MPIUTIL_H_INCLUDED) */
diff --git a/src/include/rlog_macros.h b/src/include/rlog_macros.h
index ccb8b11..bb2a9bb 100644
--- a/src/include/rlog_macros.h
+++ b/src/include/rlog_macros.h
@@ -8,7 +8,6 @@
 #define RLOG_MACROS_H_INCLUDED
 
 #include "rlog.h"
-#include "mpiu_timer.h"
 
 #ifndef MPIDM_Wtime_todouble
 #error Failed to select a defintion for MPIDM_Wtime_todouble
diff --git a/src/mpid/common/timers/mpid_timers_fallback.h b/src/mpid/common/timers/mpid_timers_fallback.h
index cf8f321..a31fd93 100644
--- a/src/mpid/common/timers/mpid_timers_fallback.h
+++ b/src/mpid/common/timers/mpid_timers_fallback.h
@@ -7,12 +7,12 @@
 #if !defined(MPID_TIMERS_FALLBACK_H_INCLUDED)
 #define MPID_TIMERS_FALLBACK_H_INCLUDED
 
-#define MPID_Time_t         MPIU_Time_t
-#define MPID_Wtime          MPIU_Wtime
-#define MPID_Wtime_diff     MPIU_Wtime_diff
-#define MPID_Wtime_acc      MPIU_Wtime_acc
-#define MPID_Wtime_todouble MPIU_Wtime_todouble
-#define MPID_Wtick          MPIU_Wtick
-#define MPID_Wtime_init     MPIU_Wtime_init
+#define MPID_Time_t         MPL_Time_t
+#define MPID_Wtime          MPL_Wtime
+#define MPID_Wtime_diff     MPL_Wtime_diff
+#define MPID_Wtime_acc      MPL_Wtime_acc
+#define MPID_Wtime_todouble MPL_Wtime_todouble
+#define MPID_Wtick          MPL_Wtick
+#define MPID_Wtime_init     MPL_Wtime_init
 
 #endif /* !defined(MPID_TIMERS_FALLBACK_H_INCLUDED) */
diff --git a/src/mpid/pamid/include/mpidpre.h b/src/mpid/pamid/include/mpidpre.h
index 27765c2..20d2175 100644
--- a/src/mpid/pamid/include/mpidpre.h
+++ b/src/mpid/pamid/include/mpidpre.h
@@ -54,8 +54,8 @@
  * device is initialized.  Once the device is initialized, it must
  * always return SUCCESS, so the upper layers do not need to check for
  * the return code.  */
-#define MPID_TIMER_SUCCESS              MPIU_TIMER_SUCCESS
-#define MPID_TIMER_ERR_NOT_INITIALIZED  MPIU_TIMER_ERR_NOT_INITIALIZED
+#define MPID_TIMER_SUCCESS              MPL_TIMER_SUCCESS
+#define MPID_TIMER_ERR_NOT_INITIALIZED  MPL_TIMER_ERR_NOT_INITIALIZED
 
 typedef double MPID_Time_t;
 
diff --git a/src/mpid/pamid/src/mpid_time.c b/src/mpid/pamid/src/mpid_time.c
index e714dec..4581f85 100644
--- a/src/mpid/pamid/src/mpid_time.c
+++ b/src/mpid/pamid/src/mpid_time.c
@@ -21,15 +21,9 @@
  */
 #include <mpidimpl.h>
 
-#if MPICH_TIMER_KIND == USE_GETTIMEOFDAY
-#warning Compiling mpid/pamid/src/mpid_time.c when MPICH_TIMER_KIND == USE_GETTIMEOFDAY
-#elif MPICH_TIMER_KIND != MPIU_TIMER_KIND__DEVICE
-#error "Not using DEVICE TIMEBASE"
-#else
-
 int MPIDI_PAMID_Timer_is_ready = 0;
 
-static int wtime(MPIU_Time_t *tval)
+static int wtime(MPL_Time_t *tval)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
         *((MPID_Time_t *) tval) = PAMI_Wtime(MPIDI_Client);
@@ -41,7 +35,7 @@ static int wtime(MPIU_Time_t *tval)
 
 int MPID_Wtime(MPID_Time_t *tval)
 {
-    return wtime((MPIU_Time_t *) tval);
+    return wtime((MPL_Time_t *) tval);
 }
 
 static int wtick(double *wtick)
@@ -56,10 +50,10 @@ static int wtick(double *wtick)
 
 int MPID_Wtick(double *tick)
 {
-    return wtick((MPIU_Time_t *) tick);
+    return wtick((MPL_Time_t *) tick);
 }
 
-static int wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
+static int wtime_diff(MPL_Time_t *t1, MPL_Time_t *t2, double *diff)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
         *diff = *((MPID_Time_t *) t2) - *((MPID_Time_t *) t1);
@@ -71,10 +65,10 @@ static int wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
 
 int MPID_Wtime_diff(MPID_Time_t *t1, MPID_Time_t *t2, double *diff)
 {
-    return wtime_diff((MPIU_Time_t *) t1, (MPIU_Time_t *) t2, diff);
+    return wtime_diff((MPL_Time_t *) t1, (MPL_Time_t *) t2, diff);
 }
 
-static int wtime_todouble(MPIU_Time_t *t, double *val)
+static int wtime_todouble(MPL_Time_t *t, double *val)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
         *val = *((MPID_Time_t *) t);
@@ -86,10 +80,10 @@ static int wtime_todouble(MPIU_Time_t *t, double *val)
 
 int MPID_Wtime_todouble(MPID_Time_t *t, double *val)
 {
-    return wtime_todouble((MPIU_Time_t *) t, val);
+    return wtime_todouble((MPL_Time_t *) t, val);
 }
 
-static int wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
+static int wtime_acc(MPL_Time_t *t1, MPL_Time_t *t2, MPL_Time_t *t3)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
         *((MPID_Time_t *) t3) += *((MPID_Time_t *) t1) - *((MPID_Time_t *) t2);
@@ -101,16 +95,16 @@ static int wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
 
 int MPID_Wtime_acc(MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3)
 {
-    return wtime_acc((MPIU_Time_t *) t1, (MPIU_Time_t *) t2, (MPIU_Time_t *) t3);
+    return wtime_acc((MPL_Time_t *) t1, (MPL_Time_t *) t2, (MPL_Time_t *) t3);
 }
 
 int MPID_Wtime_init( void )
 {
-    MPIU_Wtime_fn = wtime;
-    MPIU_Wtick_fn = wtick;
-    MPIU_Wtime_diff_fn = wtime_diff;
-    MPIU_Wtime_todouble_fn = wtime_todouble;
-    MPIU_Wtime_acc_fn = wtime_acc;
+    MPL_Wtime_fn = wtime;
+    MPL_Wtick_fn = wtick;
+    MPL_Wtime_diff_fn = wtime_diff;
+    MPL_Wtime_todouble_fn = wtime_todouble;
+    MPL_Wtime_acc_fn = wtime_acc;
 
     return MPID_TIMER_SUCCESS;
 }
diff --git a/src/mpid/pamid/subconfigure.m4 b/src/mpid/pamid/subconfigure.m4
index 93bbe4f..a353c4e 100644
--- a/src/mpid/pamid/subconfigure.m4
+++ b/src/mpid/pamid/subconfigure.m4
@@ -62,7 +62,6 @@ elif test "${pamid_platform}" = "BGQ" ; then
   MPID_DEFAULT_PM=no
 fi
 
-MPID_DEVICE_DEFINES_TIMER
 MPID_MAX_THREAD_LEVEL=MPI_THREAD_MULTIPLE
 
 dnl the PAMID device depends on the common NBC scheduler code
diff --git a/src/mpl/configure.ac b/src/mpl/configure.ac
index a8c3c63..a1c000d 100644
--- a/src/mpl/configure.ac
+++ b/src/mpl/configure.ac
@@ -156,6 +156,314 @@ char mempool_obj;
     fi
 fi
 
+
+#######################################################################
+## TIMER CODE
+#######################################################################
+
+# ----------------------------------------------------------------------------
+# Support for timers.  The following code processes the 
+#  --enable-timer-type=name argument and selects the timer based on 
+# both that field and what configure is able to determine is available.
+# The file src/include/mpl_timer.h is also created.
+# ----------------------------------------------------------------------------
+
+# clock_gettime is the POSIX gettimeofday
+# gethrtime is the Solaris high-resolution timer
+dnl
+dnl Specific checks that a function works correctly
+dnl
+dnl Now that we know what the options are, choose the timer to use
+dnl
+dnl The default preference is
+dnl    Solaris gethrtime
+dnl    Posix   clock_gettime
+dnl    Unix    gettimeofday (one of two versions)
+dnl
+dnl Also available are various hardware time stamps
+dnl    Linux-x86 cycle counter
+dnl    BG/Q PAMI-based timer
+dnl
+dnl We also allow --enable-timer-type=name to select a timer type
+AC_ARG_ENABLE(timer-type,
+[  --enable-timer-type=name - Select the timer to use for MPI_Wtime and
+                             internal timestamps.
+        gethrtime          - Solaris timer (Solaris systems only)
+        clock_gettime      - Posix timer (where available)
+        gettimeofday       - Most Unix systems
+        linux86_cycle      - Linux x86; returns cycle counts, not time in seconds*
+        gcc_ia64_cycle     - IPF ar.itc timer*
+	mach_absolute_time - Mach absolute time (alternative to clock_gettime
+                             for OSX)
+        device             - The timer is provided by the device
+
+        *Note that the cycle timers are intended to be used by
+        developers for internal low-level timing.  Normal users should
+        not use these as they are not guaranteed to be accurate in
+        certain situations.
+],timer_type=$enable_timer_type)
+
+## The user did not specify a timer type.  Try to find a sane option
+## that is supported by the platform.
+if test -z "$timer_type" ; then 
+    # Try to pick a timer based on what is available
+    AC_CHECK_FUNCS(clock_gettime clock_getres gethrtime mach_absolute_time gettimeofday)
+    if test "$ac_cv_func_gethrtime" = "yes" ; then
+        # Sigh.  The Solaris include files do not define hrtime_t
+	# Before we accept this choice, make sure that we can 
+	# do arithmetic with hrtime_t .
+        AC_CACHE_CHECK([that hrtime_t is properly defined for gethrtime],
+	pac_cv_hrtime_works,[
+	AC_TRY_COMPILE([
+#include <sys/time.h>
+],[hrtime_t t1, t2; t1 = 1; t2 = 2; t1 = t1 + t2;],
+pac_cv_hrtime_works=yes,pac_cv_hrtime_works=no)])
+	# A more ambitious test would look to see if casting an 
+	# hrtime_t to int64_t works, and even more ambitious
+	# would check whether long or long long was 64 bits (or even
+	# better, the sizeof hrtime_t).  
+    fi
+    if test "$ac_cv_func_gethrtime" = "yes" -a \
+            "$pac_cv_hrtime_works" = "yes" ; then
+        timer_type=gethrtime
+    elif test "$ac_cv_func_clock_gettime" = "yes" -a \
+              "$ac_cv_func_clock_getres" = "yes" ; then
+	 # Test on both because some systems (e.g., cygwin) provide
+	 # clock_gettime but not clock_getres
+        timer_type=clock_gettime
+    elif test "$ac_cv_func_mach_absolute_time" = "yes" ; then 
+        timer_type=mach_absolute_time
+    elif test "$ac_cv_func_gettimeofday" = "yes" ; then
+        timer_type=gettimeofday
+    fi
+fi
+if test -z "$timer_type" ; then
+    AC_MSG_ERROR([No timer found])
+fi
+
+# Check for valid timer and select datatypes for the time stamp
+case "$timer_type" in
+
+    gethrtime)
+    MPL_TIMER_TYPE=hrtime_t
+    AC_CHECK_FUNC(gethrtime,,[
+         AC_MSG_ERROR([Requested timer gethrtime is not available])
+])
+    ;;
+
+    clock_gettime)
+    missing_function=no
+    AC_SEARCH_LIBS([clock_gettime],[rt],,AC_MSG_ERROR([clock_gettime is not available]))
+    AC_SEARCH_LIBS([clock_getres],[rt],,AC_MSG_ERROR([clock_getres is not available]))
+    MPL_TIMER_TYPE="struct timespec"
+    # AIX does not always define struct timespec (!)
+    # Make sure that we can use struct timespec
+    AC_CACHE_CHECK([whether struct timespec is defined in time.h],
+                    pac_cv_struct_timespec_defined,[
+    AC_TRY_COMPILE([
+#include <time.h>],[
+    struct timespec t;],pac_cv_struct_timespec_defined=yes,
+    pac_cv_struct_timespec_defined=no)
+])
+    if test "$pac_cv_struct_timespec_defined" != "yes" ; then
+        # Try again, but with -D_XOPEN_SOURCE=500 (works for AIX)
+        AC_CACHE_CHECK([whether struct timespec is defined in time.h with _XOPEN_SOURCE=500],
+                    pac_cv_struct_timespec_defined_with_xopen500,[
+        AC_TRY_COMPILE([
+#define _XOPEN_SOURCE 500
+#include <time.h>],[
+    struct timespec t;],pac_cv_struct_timespec_defined_with_xopen500=yes,
+    pac_cv_struct_timespec_defined_with_xopen500=no)
+])
+	if test "$pac_cv_struct_timespec_defined_with_xopen500" = "yes" ; then
+	    # We need to define _XOPEN_SOURCE=500, but we need to ensure that
+	    # this is done before any include files are loaded.  At
+	    # this point it is really too late to add this definition,
+	    # since it may make other tests incompatible.
+	    AC_MSG_ERROR([The available timer requires _XOPEN_SOURCE=500.  Add -D_XOPEN_SOURCE=500 to CFLAGS and rerun configure])
+        fi
+    fi
+    # 
+    # FreeBSD 4.3 incorrectly puts the header into sys/time.h; 
+    # time.h is required (see pages 45 and 46 in the POSIX standard).
+    # See if we can compile
+    AC_CACHE_CHECK([for CLOCK_REALTIME defined in time.h],pac_cv_posix_clock_realtime,[
+    AC_TRY_COMPILE([
+#include <time.h>],[
+    clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes,
+pac_cv_posix_clock_realtime=no)])
+    if test "$pac_cv_posix_clock_realtime" = "no" ; then
+         AC_MSG_WARN([POSIX timer requires definitions in time.h])
+	 # Check for the definition in sys/time.h, which is where
+	 # OpenBSD and FreeBSD have put it by mistake
+         AC_TRY_COMPILE([
+#include <time.h>
+#include <sys/time.h>],[
+    clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes,
+pac_cv_posix_clock_realtime=no)
+	if test "$pac_cv_posix_clock_realtime" = yes ; then
+	    AC_MSG_WARN([sys/time.h required for POSIX timer])
+	    AC_DEFINE(NEEDS_SYS_TIME_H,1,[Define if sys/time.h is required to get timer definitions])
+	else
+	    AC_MSG_ERROR([Cannot find the definition of CLOCK_REALTIME for the POSIX timer])
+	fi
+    fi
+    ;;
+
+    gettimeofday)
+    MPL_TIMER_TYPE="struct timeval"
+    # We may have already tested for gettimeofday.  If we got a "yes",
+    # we're good to go
+    if test "$ac_cv_func_gettimeofday" != "yes" ; then
+        AC_CHECK_FUNC(gettimeofday,,[
+         AC_MSG_ERROR([Requested timer gettimeofday is not available])
+])
+    fi
+    ;;
+
+    linux86_cycle|linux86_cycle_2)
+    
+# The following AC_TRY_RUN statements are needed because x86_64 compilers
+# usually know about rdtscp but the cpu may or may not actually implement the
+# feature.  This is not cross-compile safe, unfortunately.  In the long run we
+# should allow the user to override this with a configure flag.
+    AC_CACHE_CHECK([that linux86 cycle counter is available],
+        pac_cv_linux86_cycle,
+            AC_TRY_RUN([
+int main()
+{
+    /* rdtscp */
+    long long var, *var_ptr=&var;
+    __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
+    return 0;
+}
+            ],pac_cv_linux86_cycle=rdtscp,
+                AC_TRY_RUN([[
+int main()
+{
+    /* cpuid 64 */
+    long long var, *var_ptr=&var;
+    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
+    return 0;
+}
+                ]],pac_cv_linux86_cycle=cpuid_rdtsc64,
+                    AC_TRY_RUN([[[
+int main()
+{
+    /* cpuid 32 */
+    long long var, *var_ptr=&var;
+    __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
+    return 0;
+}
+                    ]]],pac_cv_linux86_cycle=cpuid_rdtsc32,
+                        AC_TRY_RUN([[[[
+int main()
+{
+    /* simple */
+    long long var, *var_ptr=&var;
+    __asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
+    return 0;
+}
+                        ]]]],pac_cv_linux86_cycle=rdtsc,
+                        pac_cv_linux86_cycle=no)
+                    )
+                ),
+dnl The if-cross-compiling clause from the first AC_TRY_RUN.  Hope that if the
+dnl compiler knows about the instruction then it's supported by the target
+dnl platform.
+                AC_TRY_COMPILE(,[[
+                    long long var, *var_ptr=&var;
+                    __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
+                ]],pac_cv_linux86_cycle=rdtscp,
+                    AC_TRY_COMPILE(,[[[
+                        long long var, *var_ptr=&var;
+                        __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
+                    ]]],pac_cv_linux86_cycle=cpuid_rdtsc64,
+                        AC_TRY_COMPILE(,[[[[
+                            long long var, *var_ptr=&var;
+                            __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
+                        ]]]],pac_cv_linux86_cycle=cpuid_rdtsc32,
+                            AC_TRY_COMPILE(,[[[[[
+                                long long var, *var_ptr=&var;
+                                __asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
+                            ]]]]],pac_cv_linux86_cycle=rdtsc,
+                            pac_cv_linux86_cycle=no)
+                        )
+                    )
+                )
+            )
+    )
+
+    case "$pac_cv_linux86_cycle" in
+        "rdtscp")
+            AC_DEFINE(LINUX86_CYCLE_RDTSCP,1,[Define which x86 cycle counter to use])
+	    ;;
+        "cpuid_rdtsc64")
+            AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC64,1,[Define which x86 cycle counter to use])
+            ;;
+        "cpuid_rdtsc32")
+            AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC32,1,[Define which x86 cycle counter to use])
+	    ;;
+        "rdtsc")
+            AC_DEFINE(LINUX86_CYCLE_RDTSC,1,[Define which x86 cycle counter to use])
+	    ;;
+        *)
+            cpu_gcc_x86_cycle=no
+	    ;;
+    esac
+
+    if test "$cpu_gcc_x86_cycle" = "no" ; then
+        AC_MSG_ERROR([Linux86 cycle counter is not available on this system and or with the $CC compiler])
+    fi
+    MPL_TIMER_TYPE="long long"
+    ;;
+
+    gcc_ia64_cycle)
+    AC_CACHE_CHECK([that IPF timer is available],
+pac_cv_ia64_cycle,[
+    AC_TRY_COMPILE(,[
+    long var, *var_ptr=&var;
+#ifdef __INTEL_COMPILER
+#include "ia64regs.h"
+    var=__getReg(_IA64_REG_AR_ITC);
+#else
+    __asm__ __volatile__("mov %0=ar.itc" : "=r" (var_ptr));
+#endif
+],pac_cv_gcc_ia64_cycle=yes,pac_cv_gcc_ia64_cycle=no)])
+    if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then
+        AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler])
+     fi
+     MPL_TIMER_TYPE="long"
+     ;;
+
+    mach_absolute_time)
+    AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])])
+    AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])])
+    MPL_TIMER_TYPE="uint64_t"
+    ;;
+
+    device)
+    # The device selected should export the datatype for the timer
+    MPL_TIMER_TYPE="void *"
+    ;;
+
+    *)
+    AC_MSG_ERROR([Invalid timer type $timer_type])
+    ;;
+esac
+# Convert timer type to upper case
+timer_type=`echo $timer_type | \
+    tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+MPL_TIMER_KIND=MPL_TIMER_KIND__$timer_type
+AC_SUBST(MPL_TIMER_KIND)
+AC_SUBST(MPL_TIMER_TYPE)
+
+#######################################################################
+## END OF TIMER CODE
+#######################################################################
+
+
+
 ## Enable creation of libtool-style versioning or no versioning
 AC_ARG_ENABLE(versioning,
         [AC_HELP_STRING([--enable-versioning],[Enable library versioning])],,
@@ -202,6 +510,12 @@ if test "$ac_cv_func_strerror" = "yes" ; then
     PAC_FUNC_NEEDS_DECL([#include <string.h>],strerror)
 fi
 
+# Check for usleep
+AC_CHECK_FUNCS(usleep)
+if test "$ac_cv_func_usleep" = "yes" ; then
+    PAC_FUNC_NEEDS_DECL([#include <unistd.h>],usleep)
+fi
+
 AC_CHECK_FUNCS(backtrace_symbols)
 AC_CHECK_LIB(backtrace, backtrace_create_state)
 AC_CHECK_LIB(unwind, unw_backtrace)
@@ -212,5 +526,5 @@ dnl Check for ATTRIBUTE
 PAC_C_GNU_ATTRIBUTE
 
 dnl Final output
-AC_CONFIG_FILES([Makefile localdefs])
+AC_CONFIG_FILES([Makefile localdefs include/mpl_timer.h])
 AC_OUTPUT
diff --git a/src/mpl/include/mpl.h b/src/mpl/include/mpl.h
index e9abd7b..86933e5 100644
--- a/src/mpl/include/mpl.h
+++ b/src/mpl/include/mpl.h
@@ -17,5 +17,6 @@
 #include "mpl_msg.h"
 #include "mpl_iov.h"
 #include "mpl_bt.h"
+#include "mpl_timer.h"
 
 #endif /* !defined(MPL_H_INCLUDED) */
diff --git a/src/util/timers/mpiu_timer.h.in b/src/mpl/include/mpl_timer.h.in
similarity index 53%
rename from src/util/timers/mpiu_timer.h.in
rename to src/mpl/include/mpl_timer.h.in
index 217db41..d284eeb 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/mpl/include/mpl_timer.h.in
@@ -3,21 +3,19 @@
  *  (C) 2001 by Argonne National Laboratory.
  *      See COPYRIGHT in top-level directory.
  */
-#ifndef MPIU_TIMER_H_INCLUDED
-#define MPIU_TIMER_H_INCLUDED
 
-#include "mpichconf.h"
-#include <stdlib.h>
+#if !defined(MPL_TIMER_H_INCLUDED)
+#define MPL_TIMER_H_INCLUDED
 
-#if defined (HAVE_UNISTD_H)
+#include "mplconfig.h"
+
+#if defined (MPL_HAVE_UNISTD_H)
 #include <unistd.h>
-#if defined (NEEDS_USLEEP_DECL)
+#if defined (MPL_NEEDS_USLEEP_DECL)
 int usleep(useconds_t usec);
 #endif
 #endif
 
-#include "mpl.h"
-
 /*
  * This include file provide the definitions that are necessary to use the
  * timer calls, including the definition of the time stamp type and
@@ -27,71 +25,72 @@ int usleep(useconds_t usec);
  * is needed only to build the function versions of the timers.
  */
 /* Include the appropriate files */
-#define MPIU_TIMER_KIND__GETHRTIME               1
-#define MPIU_TIMER_KIND__CLOCK_GETTIME           2
-#define MPIU_TIMER_KIND__GETTIMEOFDAY            3
-#define MPIU_TIMER_KIND__LINUX86_CYCLE           4
-#define MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER 6
-#define MPIU_TIMER_KIND__WIN86_CYCLE             7
-#define MPIU_TIMER_KIND__GCC_IA64_CYCLE          8
-/* The value "MPIU_TIMER_KIND__DEVICE" means that the ADI device provides the timer */
-#define MPIU_TIMER_KIND__DEVICE                  9
-#define MPIU_TIMER_KIND__WIN64_CYCLE             10
-#define MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME      11
-#define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
+#define MPL_TIMER_KIND__GETHRTIME               1
+#define MPL_TIMER_KIND__CLOCK_GETTIME           2
+#define MPL_TIMER_KIND__GETTIMEOFDAY            3
+#define MPL_TIMER_KIND__LINUX86_CYCLE           4
+#define MPL_TIMER_KIND__QUERYPERFORMANCECOUNTER 6
+#define MPL_TIMER_KIND__WIN86_CYCLE             7
+#define MPL_TIMER_KIND__GCC_IA64_CYCLE          8
+/* The value "MPL_TIMER_KIND__DEVICE" means that the ADI device provides the timer */
+#define MPL_TIMER_KIND__DEVICE                  9
+#define MPL_TIMER_KIND__WIN64_CYCLE             10
+#define MPL_TIMER_KIND__MACH_ABSOLUTE_TIME      11
+#define MPL_TIMER_KIND @MPL_TIMER_KIND@
 
 /* Define a time stamp */
-typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
-
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
-#include "mpiu_timer_gethrtime.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
-#include "mpiu_timer_clock_gettime.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
-#include "mpiu_timer_gettimeofday.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
-#include "mpiu_timer_linux86_cycle.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
-#include "mpiu_timer_query_performance_counter.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE || MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE
-#include "mpiu_timer_win86_cycle.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
-#include "mpiu_timer_gcc_ia64_cycle.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
-#include "mpiu_timer_device.h"
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
-#include "mpiu_timer_mach_absolute_time.h"
+typedef @MPL_TIMER_TYPE@ MPL_Time_t;
+
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__GETHRTIME
+#include "mpl_timer_gethrtime.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__CLOCK_GETTIME
+#include "mpl_timer_clock_gettime.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__GETTIMEOFDAY
+#include "mpl_timer_gettimeofday.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__LINUX86_CYCLE
+#include "mpl_timer_linux86_cycle.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__QUERYPERFORMANCECOUNTER
+#include "mpl_timer_query_performance_counter.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__WIN86_CYCLE || MPL_TIMER_KIND == MPL_TIMER_KIND__WIN64_CYCLE
+#include "mpl_timer_win86_cycle.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__GCC_IA64_CYCLE
+#include "mpl_timer_gcc_ia64_cycle.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__DEVICE
+#include "mpl_timer_device.h"
+#elif MPL_TIMER_KIND == MPL_TIMER_KIND__MACH_ABSOLUTE_TIME
+#include "mpl_timer_mach_absolute_time.h"
 #endif
 
 /* The timer code is allowed to return "NOT_INITIALIZED" before the
  * device is initialized.  Once the device is initialized, it must
  * always return SUCCESS, so the upper layers do not need to check for
  * the return code.  */
-#define MPIU_TIMER_SUCCESS                0
-#define MPIU_TIMER_ERR_NOT_INITIALIZED    1
+#define MPL_TIMER_SUCCESS                0
+#define MPL_TIMER_ERR_NOT_INITIALIZED    1
 
 /*
  * Prototypes.  These are defined here so that inlined timer calls can
  * use them, as well as any profiling and timing code that is built into
- * MPICH
+ * MPL
  */
 
-#if defined MPIUI_WTIME_IS_A_FUNCTION
+#if defined MPLI_WTIME_IS_A_FUNCTION
+
 /*@
-  MPIU_Wtime - Return a time stamp
+  MPL_Wtime - Return a time stamp
 
   Output Parameter:
-. timeval - A pointer to an 'MPIU_Wtime_t' variable.
+. timeval - A pointer to an 'MPL_Wtime_t' variable.
 
   Notes:
   This routine returns an `opaque` time value.  This difference between two
-  time values returned by 'MPIU_Wtime' can be converted into an elapsed time
-  in seconds with the routine 'MPIU_Wtime_diff'.
+  time values returned by 'MPL_Wtime' can be converted into an elapsed time
+  in seconds with the routine 'MPL_Wtime_diff'.
 
   This routine is defined this way to simplify its implementation as a macro.
   For example, the for Intel x86 and gcc,
 .vb
-#define MPIU_Wtime(timeval) \
+#define MPL_Wtime(timeval) \
      __asm__ __volatile__("rdtsc" : "=A" (*timeval))
 .ve
 
@@ -111,14 +110,14 @@ typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
   MPI-2 allows 'MPI_Wtime' to be a macro.  We should make that easy; this
   version does not accomplish that.
   @*/
-int MPIU_Wtime(MPIU_Time_t * timeval);
-#endif /* MPIUI_WTIME_IS_A_FUNCTION */
+int MPL_Wtime(MPL_Time_t * timeval);
+#endif /* MPLI_WTIME_IS_A_FUNCTION */
 
 /*@
-  MPIU_Wtime_diff - Compute the difference between two time stamps
+  MPL_Wtime_diff - Compute the difference between two time stamps
 
   Input Parameters:
-. t1, t2 - Two time values set by 'MPIU_Wtime' on this process.
+. t1, t2 - Two time values set by 'MPL_Wtime' on this process.
 
 
   Output Parameter:
@@ -126,21 +125,21 @@ int MPIU_Wtime(MPIU_Time_t * timeval);
 
   Note:
   If 't1' is null, then 't2' is assumed to be differences accumulated with
-  'MPIU_Wtime_acc', and the output value gives the number of seconds that
+  'MPL_Wtime_acc', and the output value gives the number of seconds that
   were accumulated.
 
   Question:
   Instead of handling a null value of 't1', should we have a separate
-  routine 'MPIU_Wtime_todouble' that converts a single timestamp to a
+  routine 'MPL_Wtime_todouble' that converts a single timestamp to a
   double value?
 
   Module:
   Timer
   @*/
-int MPIU_Wtime_diff( MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff );
+int MPL_Wtime_diff( MPL_Time_t *t1, MPL_Time_t *t2, double *diff );
 
 /*@
-  MPIU_Wtime_acc - Accumulate time values
+  MPL_Wtime_acc - Accumulate time values
 
   Input Parameters:
 . t1,t2,t3 - Three time values.  't3' is updated with the difference between
@@ -149,23 +148,23 @@ int MPIU_Wtime_diff( MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff );
   Notes:
   This routine is used to accumulate the time spent with a block of code
   without first converting the time stamps into a particular arithmetic
-  type such as a 'double'.  For example, if the 'MPIU_Wtime' routine accesses
+  type such as a 'double'.  For example, if the 'MPL_Wtime' routine accesses
   a cycle counter, this routine (or macro) can perform the accumulation using
   integer arithmetic.
 
-  To convert a time value accumulated with this routine, use 'MPIU_Wtime_diff'
+  To convert a time value accumulated with this routine, use 'MPL_Wtime_diff'
   with a 't1' of zero.
 
   Module:
   Timer
   @*/
-int MPIU_Wtime_acc( MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3 );
+int MPL_Wtime_acc( MPL_Time_t *t1, MPL_Time_t *t2, MPL_Time_t *t3 );
 
 /*@
-  MPIU_Wtime_todouble - Converts a timestamp to a double
+  MPL_Wtime_todouble - Converts a timestamp to a double
 
   Input Parameter:
-. timeval - 'MPIU_Time_t' time stamp
+. timeval - 'MPL_Time_t' time stamp
 
   Output Parameter:
 . seconds - Time in seconds from an arbitrary (but fixed) time in the past
@@ -175,16 +174,16 @@ int MPIU_Wtime_acc( MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3 );
   suitable for 'MPI_Wtime'.
 
   @*/
-int MPIU_Wtime_todouble( MPIU_Time_t *timeval, double *seconds );
+int MPL_Wtime_todouble( MPL_Time_t *timeval, double *seconds );
 
 /*@
-  MPIU_Wtick - Provide the resolution of the 'MPIU_Wtime' timer
+  MPL_Wtick - Provide the resolution of the 'MPL_Wtime' timer
 
   Return value:
   Resolution of the timer in seconds.  In many cases, this is the
-  time between ticks of the clock that 'MPIU_Wtime' returns.  In other
+  time between ticks of the clock that 'MPL_Wtime' returns.  In other
   words, the minimum significant difference that can be computed by
-  'MPIU_Wtime_diff'.
+  'MPL_Wtime_diff'.
 
   Note that in some cases, the resolution may be estimated.  No application
   should expect either the same estimate in different runs or the same
@@ -193,10 +192,10 @@ int MPIU_Wtime_todouble( MPIU_Time_t *timeval, double *seconds );
   Module:
   Timer
   @*/
-int MPIU_Wtick(double *);
+int MPL_Wtick(double *);
 
 /*@
-  MPIU_Wtime_init - Initialize the timer
+  MPL_Wtime_init - Initialize the timer
 
   Note:
   This routine should perform any steps needed to initialize the timer.
@@ -204,15 +203,11 @@ int MPIU_Wtick(double *);
   if the timer is known to be the same for all processes in 'MPI_COMM_WORLD'
   (the value is zero by default).
 
-  If any operations need to be performed when the MPI program calls
-  'MPI_Finalize' this routine should register a handler with 'MPI_Finalize'
-  (see the MPICH Design Document).
-
   Module:
   Timer
 
   @*/
-int MPIU_Wtime_init(void);
+int MPL_Wtime_init(void);
 
 /*
  * For timers that do not have defined resolutions, compute the resolution
@@ -225,25 +220,25 @@ static void init_wtick(void) ATTRIBUTE((unused));
 static void init_wtick(void)
 {
     double timediff;
-    MPIU_Time_t t1, t2;
+    MPL_Time_t t1, t2;
     int cnt;
     int icnt;
 
     tickval = 1.0e6;
     for (icnt = 0; icnt < 10; icnt++) {
         cnt = 1000;
-        MPIU_Wtime(&t1);
+        MPL_Wtime(&t1);
         do {
-            MPIU_Wtime(&t2);
-            MPIU_Wtime_diff(&t1, &t2, &timediff);
+            MPL_Wtime(&t2);
+            MPL_Wtime_diff(&t1, &t2, &timediff);
             if (timediff > 0)
                 break;
         }
         while (cnt--);
         if (cnt && timediff > 0.0 && timediff < tickval) {
-            MPIU_Wtime_diff(&t1, &t2, &tickval);
+            MPL_Wtime_diff(&t1, &t2, &tickval);
         }
     }
 }
 
-#endif
+#endif  /* !defined(MPL_TIMER_H_INCLUDED) */
diff --git a/src/util/timers/mpiu_timer_clock_gettime.h b/src/mpl/include/mpl_timer_clock_gettime.h
similarity index 74%
rename from src/util/timers/mpiu_timer_clock_gettime.h
rename to src/mpl/include/mpl_timer_clock_gettime.h
index 9b35089..9ae7917 100644
--- a/src/util/timers/mpiu_timer_clock_gettime.h
+++ b/src/mpl/include/mpl_timer_clock_gettime.h
@@ -4,10 +4,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_CLOCK_GETTIME_H_INCLUDED
-#define MPIU_TIMER_CLOCK_GETTIME_H_INCLUDED
+#ifndef MPL_TIMER_CLOCK_GETTIME_H_INCLUDED
+#define MPL_TIMER_CLOCK_GETTIME_H_INCLUDED
 
-#define MPIUI_WTIME_IS_A_FUNCTION
+#define MPLI_WTIME_IS_A_FUNCTION
 
 #include <time.h>
 #ifdef NEEDS_SYS_TIME_H
diff --git a/src/util/timers/mpiu_timer_device.h b/src/mpl/include/mpl_timer_device.h
similarity index 50%
rename from src/util/timers/mpiu_timer_device.h
rename to src/mpl/include/mpl_timer_device.h
index 2b1e375..8c704e0 100644
--- a/src/util/timers/mpiu_timer_device.h
+++ b/src/mpl/include/mpl_timer_device.h
@@ -4,10 +4,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_DEVICE_H_INCLUDED
-#define MPIU_TIMER_DEVICE_H_INCLUDED
+#ifndef MPL_TIMER_DEVICE_H_INCLUDED
+#define MPL_TIMER_DEVICE_H_INCLUDED
 
-#define MPIUI_WTIME_IS_A_FUNCTION
+#define MPLI_WTIME_IS_A_FUNCTION
 
 /*
  * If the timer capability is provided by the device, it would need to
@@ -17,16 +17,16 @@
  *       model would be used by the MPICH internal code, and would
  *       give fast access to the timers.
  *
- *    2. It would expose it through the MPIU_Timer_ function pointers.
+ *    2. It would expose it through the MPL_Timer_ function pointers.
  *       This model would be used by "external" code segments (such as
- *       MPIU) which do not have direct access to the MPICH devices.
+ *       MPL) which do not have direct access to the MPICH devices.
  *       This model might be slightly slower, but would give the same
  *       functionality.
  */
-extern int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval);
-extern int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff);
-extern int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3);
-extern int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds);
-extern int (*MPIU_Wtick_fn)(double *tick);
+extern int (*MPL_Wtime_fn)(MPL_Time_t *timeval);
+extern int (*MPL_Wtime_diff_fn)(MPL_Time_t *t1, MPL_Time_t *t2, double *diff);
+extern int (*MPL_Wtime_acc_fn)(MPL_Time_t *t1, MPL_Time_t *t2, MPL_Time_t *t3);
+extern int (*MPL_Wtime_todouble_fn)(MPL_Time_t *timeval, double *seconds);
+extern int (*MPL_Wtick_fn)(double *tick);
 
 #endif
diff --git a/src/util/timers/mpiu_timer_gcc_ia64_cycle.h b/src/mpl/include/mpl_timer_gcc_ia64_cycle.h
similarity index 63%
rename from src/util/timers/mpiu_timer_gcc_ia64_cycle.h
rename to src/mpl/include/mpl_timer_gcc_ia64_cycle.h
index b825563..0cd121b 100644
--- a/src/util/timers/mpiu_timer_gcc_ia64_cycle.h
+++ b/src/mpl/include/mpl_timer_gcc_ia64_cycle.h
@@ -4,12 +4,12 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_GCC_IA64_CYCLE_H_INCLUDED
-#define MPIU_TIMER_GCC_IA64_CYCLE_H_INCLUDED
+#ifndef MPL_TIMER_GCC_IA64_CYCLE_H_INCLUDED
+#define MPL_TIMER_GCC_IA64_CYCLE_H_INCLUDED
 
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+static inline void MPL_Wtime(MPL_Time_t *timeval)
 {
-    MPIU_Time_t t_val;
+    MPL_Time_t t_val;
 
 #ifdef __INTEL_COMPILER
 #include "ia64regs.h"
@@ -20,7 +20,7 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
 
     *timeval = t_val;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_gethrtime.h b/src/mpl/include/mpl_timer_gethrtime.h
similarity index 60%
rename from src/util/timers/mpiu_timer_gethrtime.h
rename to src/mpl/include/mpl_timer_gethrtime.h
index b06bf4f..3662795 100644
--- a/src/util/timers/mpiu_timer_gethrtime.h
+++ b/src/mpl/include/mpl_timer_gethrtime.h
@@ -4,10 +4,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_GETHRTIME_H_INCLUDED
-#define MPIU_TIMER_GETHRTIME_H_INCLUDED
+#ifndef MPL_TIMER_GETHRTIME_H_INCLUDED
+#define MPL_TIMER_GETHRTIME_H_INCLUDED
 
-#define MPIUI_WTIME_IS_A_FUNCTION
+#define MPLI_WTIME_IS_A_FUNCTION
 
 #include <sys/time.h>
 
diff --git a/src/util/timers/mpiu_timer_gettimeofday.h b/src/mpl/include/mpl_timer_gettimeofday.h
similarity index 62%
rename from src/util/timers/mpiu_timer_gettimeofday.h
rename to src/mpl/include/mpl_timer_gettimeofday.h
index e8020d6..5afdb57 100644
--- a/src/util/timers/mpiu_timer_gettimeofday.h
+++ b/src/mpl/include/mpl_timer_gettimeofday.h
@@ -4,10 +4,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_GETTIMEOFDAY_H_INCLUDED
-#define MPIU_TIMER_GETTIMEOFDAY_H_INCLUDED
+#ifndef MPL_TIMER_GETTIMEOFDAY_H_INCLUDED
+#define MPL_TIMER_GETTIMEOFDAY_H_INCLUDED
 
-#define MPIUI_WTIME_IS_A_FUNCTION
+#define MPLI_WTIME_IS_A_FUNCTION
 
 #include <sys/types.h>
 #include <sys/time.h>
diff --git a/src/util/timers/mpiu_timer_linux86_cycle.h b/src/mpl/include/mpl_timer_linux86_cycle.h
similarity index 89%
rename from src/util/timers/mpiu_timer_linux86_cycle.h
rename to src/mpl/include/mpl_timer_linux86_cycle.h
index c85c296..25b99be 100644
--- a/src/util/timers/mpiu_timer_linux86_cycle.h
+++ b/src/mpl/include/mpl_timer_linux86_cycle.h
@@ -4,10 +4,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_LINUX86_CYCLE_H_INCLUDED
-#define MPIU_TIMER_LINUX86_CYCLE_H_INCLUDED
+#ifndef MPL_TIMER_LINUX86_CYCLE_H_INCLUDED
+#define MPL_TIMER_LINUX86_CYCLE_H_INCLUDED
 
-static inline int MPIU_Wtime(MPIU_Time_t *timeval)
+static inline int MPL_Wtime(MPL_Time_t *timeval)
 {
 /* The rdtsc instruction is not a "serializing" instruction, so the
    processor is free to reorder it.  In order to get more accurate
@@ -38,7 +38,7 @@ static inline int MPIU_Wtime(MPIU_Time_t *timeval)
 #error Dont know which Linux timer to use
 #endif
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_mach_absolute_time.h b/src/mpl/include/mpl_timer_mach_absolute_time.h
similarity index 57%
rename from src/util/timers/mpiu_timer_mach_absolute_time.h
rename to src/mpl/include/mpl_timer_mach_absolute_time.h
index 512b29b..e520f4f 100644
--- a/src/util/timers/mpiu_timer_mach_absolute_time.h
+++ b/src/mpl/include/mpl_timer_mach_absolute_time.h
@@ -4,10 +4,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED
-#define MPIU_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED
+#ifndef MPL_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED
+#define MPL_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED
 
-#define MPIUI_WTIME_IS_A_FUNCTION
+#define MPLI_WTIME_IS_A_FUNCTION
 
 #include <mach/mach_time.h>
 
diff --git a/src/util/timers/mpiu_timer_query_performance_counter.h b/src/mpl/include/mpl_timer_query_performance_counter.h
similarity index 54%
rename from src/util/timers/mpiu_timer_query_performance_counter.h
rename to src/mpl/include/mpl_timer_query_performance_counter.h
index 385e58d..e9b9f81 100644
--- a/src/util/timers/mpiu_timer_query_performance_counter.h
+++ b/src/mpl/include/mpl_timer_query_performance_counter.h
@@ -4,17 +4,17 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_QUERY_PERFORMANCE_COUNTER_H_INCLUDED
-#define MPIU_TIMER_QUERY_PERFORMANCE_COUNTER_H_INCLUDED
+#ifndef MPL_TIMER_QUERY_PERFORMANCE_COUNTER_H_INCLUDED
+#define MPL_TIMER_QUERY_PERFORMANCE_COUNTER_H_INCLUDED
 
 #include <winsock2.h>
 #include <windows.h>
 
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+static inline void MPL_Wtime(MPL_Time_t *timeval)
 {
     QueryPerformanceCounter(timeval);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_win86_cycle.h b/src/mpl/include/mpl_timer_win86_cycle.h
similarity index 68%
rename from src/util/timers/mpiu_timer_win86_cycle.h
rename to src/mpl/include/mpl_timer_win86_cycle.h
index 11d52a4..ca7c172 100644
--- a/src/util/timers/mpiu_timer_win86_cycle.h
+++ b/src/mpl/include/mpl_timer_win86_cycle.h
@@ -4,13 +4,13 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPIU_TIMER_WIN86_CYCLE_H_INCLUDED
-#define MPIU_TIMER_WIN86_CYCLE_H_INCLUDED
+#ifndef MPL_TIMER_WIN86_CYCLE_H_INCLUDED
+#define MPL_TIMER_WIN86_CYCLE_H_INCLUDED
 
 #include <winsock2.h>
 #include <windows.h>
 
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+static inline void MPL_Wtime(MPL_Time_t *timeval)
 {
     register int *f1 = (int*)var_ptr;
     __asm cpuid;
@@ -19,7 +19,7 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
     __asm mov [ecx], eax;
     __asm mov [ecx + TYPE int], edx;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/mpl/src/Makefile.mk b/src/mpl/src/Makefile.mk
index 156dfdd..a5ba236 100644
--- a/src/mpl/src/Makefile.mk
+++ b/src/mpl/src/Makefile.mk
@@ -10,3 +10,4 @@ include src/mem/Makefile.mk
 include src/msg/Makefile.mk
 include src/sock/Makefile.mk
 include src/str/Makefile.mk
+include src/timer/Makefile.mk
diff --git a/src/mpl/src/timer/Makefile.mk b/src/mpl/src/timer/Makefile.mk
new file mode 100644
index 0000000..f7ec9ca
--- /dev/null
+++ b/src/mpl/src/timer/Makefile.mk
@@ -0,0 +1,17 @@
+## -*- Mode: Makefile; -*-
+## vim: set ft=automake :
+##
+## (C) 2011 by Argonne National Laboratory.
+##     See COPYRIGHT in top-level directory.
+##
+
+lib at MPLLIBNAME@_la_SOURCES += \
+	src/timer/mpl_timer_clock_gettime.c \
+	src/timer/mpl_timer_gcc_ia64_cycle.c \
+	src/timer/mpl_timer_gethrtime.c \
+	src/timer/mpl_timer_gettimeofday.c \
+	src/timer/mpl_timer_linux86_cycle.c \
+	src/timer/mpl_timer_mach_absolute_time.c \
+	src/timer/mpl_timer_query_performance_counter.c \
+	src/timer/mpl_timer_win86_cycle.c \
+	src/timer/mpl_timer_device.c
diff --git a/src/util/timers/mpiu_timer_clock_gettime.c b/src/mpl/src/timer/mpl_timer_clock_gettime.c
similarity index 66%
rename from src/util/timers/mpiu_timer_clock_gettime.c
rename to src/mpl/src/timer/mpl_timer_clock_gettime.c
index cb0fb6e..9dc90a2 100644
--- a/src/util/timers/mpiu_timer_clock_gettime.c
+++ b/src/mpl/src/timer/mpl_timer_clock_gettime.c
@@ -4,35 +4,35 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#include "mpiu_timer.h"
+#include "mpl.h"
 
 MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__CLOCK_GETTIME
 
-int MPIU_Wtime(MPIU_Time_t * timeval)
+int MPL_Wtime(MPL_Time_t * timeval)
 {
     /* POSIX timer (14.2.1, page 311) */
     clock_gettime(CLOCK_REALTIME, timeval);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
 {
     *diff = ((double) (t2->tv_sec - t1->tv_sec) + 1.0e-9 * (double) (t2->tv_nsec - t1->tv_nsec));
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPL_Wtime_todouble(MPL_Time_t * t, double *val)
 {
     *val = ((double) t->tv_sec + 1.0e-9 * (double) t->tv_nsec);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
 {
     int nsec, sec;
 
@@ -46,10 +46,10 @@ int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
         t3->tv_sec++;
     }
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtick(double *wtick)
+int MPL_Wtick(double *wtick)
 {
     struct timespec res;
     int rc;
@@ -63,14 +63,14 @@ int MPIU_Wtick(double *wtick)
      * then we need to return the generic tick value */
     *wtick = tickval;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_init(void)
+int MPL_Wtime_init(void)
 {
     init_wtick();
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/mpl/src/timer/mpl_timer_device.c b/src/mpl/src/timer/mpl_timer_device.c
new file mode 100644
index 0000000..48504fa
--- /dev/null
+++ b/src/mpl/src/timer/mpl_timer_device.c
@@ -0,0 +1,54 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpl.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__DEVICE
+
+int (*MPL_Wtime_fn)(MPL_Time_t *timeval) = NULL;
+int (*MPL_Wtime_diff_fn)(MPL_Time_t *t1, MPL_Time_t *t2, double *diff) = NULL;
+int (*MPL_Wtime_acc_fn)(MPL_Time_t *t1, MPL_Time_t *t2, MPL_Time_t *t3) = NULL;
+int (*MPL_Wtime_todouble_fn)(MPL_Time_t *timeval, double *seconds) = NULL;
+int (*MPL_Wtick_fn)(double *tick) = NULL;
+
+int MPL_Wtime(MPL_Time_t *timeval)
+{
+    if (MPL_Wtime_fn == NULL)
+        return MPL_TIMER_ERR_NOT_INITIALIZED;
+    return MPL_Wtime_fn(timeval);
+}
+
+int MPL_Wtime_diff(MPL_Time_t *t1, MPL_Time_t *t2, double *diff)
+{
+    if (MPL_Wtime_diff_fn == NULL)
+        return MPL_TIMER_ERR_NOT_INITIALIZED;
+    return MPL_Wtime_diff_fn(t1, t2, diff);
+}
+
+int MPL_Wtime_todouble(MPL_Time_t *t, double *val)
+{
+    if (MPL_Wtime_todouble_fn == NULL)
+        return MPL_TIMER_ERR_NOT_INITIALIZED;
+    return MPL_Wtime_todouble_fn(t, val);
+}
+
+int MPL_Wtime_acc(MPL_Time_t *t1, MPL_Time_t *t2, MPL_Time_t *t3)
+{
+    if (MPL_Wtime_acc_fn == NULL)
+        return MPL_TIMER_ERR_NOT_INITIALIZED;
+    return MPL_Wtime_acc_fn(t1, t2, t3);
+}
+
+int MPL_Wtick(double *wtick)
+{
+    if (MPL_Wtick_fn == NULL)
+        return MPL_TIMER_ERR_NOT_INITIALIZED;
+    return MPL_Wtick_fn(wtick);
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_linux86_cycle.c b/src/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c
similarity index 65%
rename from src/util/timers/mpiu_timer_linux86_cycle.c
rename to src/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c
index 8bd0e41..01fd0e4 100644
--- a/src/util/timers/mpiu_timer_linux86_cycle.c
+++ b/src/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c
@@ -4,66 +4,66 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#include "mpiu_timer.h"
+#include "mpl.h"
 
 MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__GCC_IA64_CYCLE
 
 #include <sys/time.h>
 
 static double seconds_per_tick = 0.0;
 
-int MPIU_Wtick(double *wtick)
+int MPL_Wtick(double *wtick)
 {
     *wtick = seconds_per_tick;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_init(void)
+int MPL_Wtime_init(void)
 {
     unsigned long long t1, t2;
     struct timeval tv1, tv2;
     double td1, td2;
 
     gettimeofday(&tv1, NULL);
-    MPIU_Wtime(&t1);
+    MPL_Wtime(&t1);
     usleep(250000);
     gettimeofday(&tv2, NULL);
-    MPIU_Wtime(&t2);
+    MPL_Wtime(&t2);
 
     td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
     td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
 
     seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 /* Time stamps created by a macro */
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
 {
     *diff = (double) (*t2 - *t1) * seconds_per_tick;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPL_Wtime_todouble(MPL_Time_t * t, double *val)
 {
     /* This returns the number of cycles as the "time".  This isn't correct
      * for implementing MPI_Wtime, but it does allow us to insert cycle
      * counters into test programs */
     *val = (double) *t * seconds_per_tick;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
 {
     *t3 += (*t2 - *t1);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_gethrtime.c b/src/mpl/src/timer/mpl_timer_gethrtime.c
similarity index 64%
rename from src/util/timers/mpiu_timer_gethrtime.c
rename to src/mpl/src/timer/mpl_timer_gethrtime.c
index 97ddbe7..d971475 100644
--- a/src/util/timers/mpiu_timer_gethrtime.c
+++ b/src/mpl/src/timer/mpl_timer_gethrtime.c
@@ -4,14 +4,14 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#include "mpiu_timer.h"
+#include "mpl.h"
 
 MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__GETHRTIME
 
 /*
- * MPIU_Time_t is hrtime_t, which under Solaris is defined as a 64bit
+ * MPL_Time_t is hrtime_t, which under Solaris is defined as a 64bit
  * longlong_t .  However, the Solaris header files will define
  * longlong_t as a structure in some circumstances, making arithmetic
  * with hrtime_t invalid.  FIXME.
@@ -24,46 +24,46 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
  * supports an 8 byte long long.  We can also cast hrtime_t to long long
  * if long long is available and 8 bytes.
  */
-int MPIU_Wtime(MPIU_Time_t * timeval)
+int MPL_Wtime(MPL_Time_t * timeval)
 {
     *timeval = gethrtime();
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
 {
     *diff = 1.0e-9 * (double) (*t2 - *t1);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPL_Wtime_todouble(MPL_Time_t * t, double *val)
 {
     *val = 1.0e-9 * (*t);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
 {
     *t3 += ((*t2) - (*t1));
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtick(double *wtick)
+int MPL_Wtick(double *wtick)
 {
     /* According to the documentation, ticks should be in nanoseconds.  This
      * is untested */
     *wtick = 1.0e-9;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_init(void)
+int MPL_Wtime_init(void)
 {
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_gettimeofday.c b/src/mpl/src/timer/mpl_timer_gettimeofday.c
similarity index 61%
rename from src/util/timers/mpiu_timer_gettimeofday.c
rename to src/mpl/src/timer/mpl_timer_gettimeofday.c
index f7d9cb9..cf0d6b6 100644
--- a/src/util/timers/mpiu_timer_gettimeofday.c
+++ b/src/mpl/src/timer/mpl_timer_gettimeofday.c
@@ -4,11 +4,11 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#include "mpiu_timer.h"
+#include "mpl.h"
 
 MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__GETTIMEOFDAY
 
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
@@ -16,28 +16,29 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-int MPIU_Wtime(MPIU_Time_t * tval)
+
+int MPL_Wtime(MPL_Time_t * tval)
 {
     gettimeofday(tval, NULL);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
 {
     *diff = ((double) (t2->tv_sec - t1->tv_sec) + .000001 * (double) (t2->tv_usec - t1->tv_usec));
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPL_Wtime_todouble(MPL_Time_t * t, double *val)
 {
     *val = (double) t->tv_sec + .000001 * (double) t->tv_usec;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
 {
     int usec, sec;
 
@@ -51,21 +52,21 @@ int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
         t3->tv_sec++;
     }
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtick(double *wtick)
+int MPL_Wtick(double *wtick)
 {
     *wtick = tickval;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_init(void)
+int MPL_Wtime_init(void)
 {
     init_wtick();
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_gcc_ia64_cycle.c b/src/mpl/src/timer/mpl_timer_linux86_cycle.c
similarity index 65%
rename from src/util/timers/mpiu_timer_gcc_ia64_cycle.c
rename to src/mpl/src/timer/mpl_timer_linux86_cycle.c
index 75b6721..679260b 100644
--- a/src/util/timers/mpiu_timer_gcc_ia64_cycle.c
+++ b/src/mpl/src/timer/mpl_timer_linux86_cycle.c
@@ -4,66 +4,66 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#include "mpiu_timer.h"
+#include "mpl.h"
 
 MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__LINUX86_CYCLE
 
 #include <sys/time.h>
 
 static double seconds_per_tick = 0.0;
 
-int MPIU_Wtick(double *wtick)
+int MPL_Wtick(double *wtick)
 {
     *wtick = seconds_per_tick;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_init(void)
+int MPL_Wtime_init(void)
 {
     unsigned long long t1, t2;
     struct timeval tv1, tv2;
     double td1, td2;
 
     gettimeofday(&tv1, NULL);
-    MPIU_Wtime(&t1);
+    MPL_Wtime(&t1);
     usleep(250000);
     gettimeofday(&tv2, NULL);
-    MPIU_Wtime(&t2);
+    MPL_Wtime(&t2);
 
     td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
     td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
 
     seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 /* Time stamps created by a macro */
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
 {
     *diff = (double) (*t2 - *t1) * seconds_per_tick;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPL_Wtime_todouble(MPL_Time_t * t, double *val)
 {
     /* This returns the number of cycles as the "time".  This isn't correct
      * for implementing MPI_Wtime, but it does allow us to insert cycle
      * counters into test programs */
     *val = (double) *t * seconds_per_tick;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
 {
     *t3 += (*t2 - *t1);
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer_mach_absolute_time.c b/src/mpl/src/timer/mpl_timer_mach_absolute_time.c
similarity index 51%
rename from src/util/timers/mpiu_timer_mach_absolute_time.c
rename to src/mpl/src/timer/mpl_timer_mach_absolute_time.c
index ac19e32..b869d67 100644
--- a/src/util/timers/mpiu_timer_mach_absolute_time.c
+++ b/src/mpl/src/timer/mpl_timer_mach_absolute_time.c
@@ -4,57 +4,57 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#include "mpiu_timer.h"
+#include "mpl.h"
 
 MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__MACH_ABSOLUTE_TIME
 
 static double MPIR_Wtime_mult;
 
-int MPIU_Wtime_init(void)
+int MPL_Wtime_init(void)
 {
     mach_timebase_info_data_t info;
     mach_timebase_info(&info);
     MPIR_Wtime_mult = 1.0e-9 * ((double) info.numer / (double) info.denom);
     init_wtick();
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime(MPIU_Time_t * timeval)
+int MPL_Wtime(MPL_Time_t * timeval)
 {
     *timeval = mach_absolute_time();
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
 {
     *diff = (*t2 - *t1) * MPIR_Wtime_mult;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPL_Wtime_todouble(MPL_Time_t * t, double *val)
 {
     *val = *t * MPIR_Wtime_mult;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
 {
     *t3 += *t2 - *t1;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
-int MPIU_Wtick(double *wtick)
+int MPL_Wtick(double *wtick)
 {
     *wtick = tickval;
 
-    return MPIU_TIMER_SUCCESS;
+    return MPL_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/mpl/src/timer/mpl_timer_query_performance_counter.c b/src/mpl/src/timer/mpl_timer_query_performance_counter.c
new file mode 100644
index 0000000..382b186
--- /dev/null
+++ b/src/mpl/src/timer/mpl_timer_query_performance_counter.c
@@ -0,0 +1,44 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpl.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPL_TIMER_KIND == MPL_TIMER_KIND__QUERYPERFORMANCECOUNTER
+
+double MPL_Seconds_per_tick = 0.0;     /* High performance counter frequency */
+int MPL_Wtime_init(void)
+{
+    LARGE_INTEGER n;
+    QueryPerformanceFrequency(&n);
+    MPL_Seconds_per_tick = 1.0 / (double) n.QuadPart;
+    return 0;
+}
+
+double MPL_Wtick(void)
+{
+    return MPL_Seconds_per_tick;
+}
+
+void MPL_Wtime_todouble(MPL_Time_t * t, double *val)
+{
+    *val = (double) t->QuadPart * MPL_Seconds_per_tick;
+}
+
+void MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
+{
+    LARGE_INTEGER n;
+    n.QuadPart = t2->QuadPart - t1->QuadPart;
+    *diff = (double) n.QuadPart * MPL_Seconds_per_tick;
+}
+
+void MPL_Wtime_acc(MPL_Time_t * t1, MPL_Time_t * t2, MPL_Time_t * t3)
+{
+    t3->QuadPart += ((t2->QuadPart) - (t1->QuadPart));
+}
+
+#endif
diff --git a/src/mpl/src/timer/mpl_timer_win86_cycle.c b/src/mpl/src/timer/mpl_timer_win86_cycle.c
new file mode 100644
index 0000000..b40d474
--- /dev/null
+++ b/src/mpl/src/timer/mpl_timer_win86_cycle.c
@@ -0,0 +1,59 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpl.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if (MPL_TIMER_KIND == MPL_TIMER_KIND__WIN86_CYCLE) || (MPL_TIMER_KIND == MPL_TIMER_KIND__WIN64_CYCLE)
+
+double MPL_Seconds_per_tick = 0.0;
+double MPL_Wtick(void)
+{
+    return MPL_Seconds_per_tick;
+}
+
+void MPL_Wtime_todouble(MPL_Time_t * t, double *d)
+{
+    *d = (double) (__int64) * t * MPL_Seconds_per_tick;
+}
+
+void MPL_Wtime_diff(MPL_Time_t * t1, MPL_Time_t * t2, double *diff)
+{
+    *diff = (double) ((__int64) (*t2 - *t1)) * MPL_Seconds_per_tick;
+}
+
+int MPL_Wtime_init(void)
+{
+    MPL_Time_t t1, t2;
+    DWORD s1, s2;
+    double d;
+    int i;
+
+    MPL_Wtime(&t1);
+    MPL_Wtime(&t1);
+
+    /* time an interval using both timers */
+    s1 = GetTickCount();
+    MPL_Wtime(&t1);
+    /*Sleep(250); *//* Sleep causes power saving cpu's to stop which stops the counter */
+    while (GetTickCount() - s1 < 200) {
+        for (i = 2; i < 1000; i++)
+            d = (double) i / (double) (i - 1);
+    }
+    s2 = GetTickCount();
+    MPL_Wtime(&t2);
+
+    /* calculate the frequency of the assembly cycle counter */
+    MPL_Seconds_per_tick = ((double) (s2 - s1) / 1000.0) / (double) ((__int64) (t2 - t1));
+    /*
+     * printf("t2-t1 %10d\nsystime diff %d\nfrequency %g\n CPU MHz %g\n",
+     * (int)(t2-t1), (int)(s2 - s1), MPL_Seconds_per_tick, MPL_Seconds_per_tick * 1.0e6);
+     */
+    return 0;
+}
+
+#endif
diff --git a/src/util/Makefile.mk b/src/util/Makefile.mk
index b7d54e7..90c7d25 100644
--- a/src/util/Makefile.mk
+++ b/src/util/Makefile.mk
@@ -14,6 +14,5 @@ include $(top_srcdir)/src/util/thread/Makefile.mk
 include $(top_srcdir)/src/util/type/Makefile.mk
 include $(top_srcdir)/src/util/wrappers/Makefile.mk
 include $(top_srcdir)/src/util/assert/Makefile.mk
-include $(top_srcdir)/src/util/timers/Makefile.mk
 include $(top_srcdir)/src/util/pointer/Makefile.mk
 
diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c
index 46c2dbb..0e3aabf 100644
--- a/src/util/dbg/dbg_printf.c
+++ b/src/util/dbg/dbg_printf.c
@@ -427,7 +427,7 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
     char *str, stmp[MPIU_DBG_MAXLINE];
     int  i;
     void *p;
-    MPID_Time_t t;
+    MPL_Time_t t;
     double  curtime;
     unsigned long long int threadID  = 0;
     int pid = -1;
@@ -457,8 +457,8 @@ int MPIU_DBG_Outevent( const char *file, int line, int class, int kind,
         set_fp(dbg_fp);
     }
 
-    MPID_Wtime( &t );
-    MPID_Wtime_todouble( &t, &curtime );
+    MPL_Wtime( &t );
+    MPL_Wtime_todouble( &t, &curtime );
     curtime = curtime - timeOrigin;
 
     /* The kind values are used with the macros to simplify these cases */
@@ -697,7 +697,7 @@ static int MPIU_DBG_ProcessEnv( void )
  */
 int MPIU_DBG_PreInit( int *argc_p, char ***argv_p, int wtimeNotReady )
 {
-    MPID_Time_t t;
+    MPL_Time_t t;
 
     /* if the DBG_MSG system was already initialized, say by the device, then
        return immediately */
@@ -714,8 +714,8 @@ int MPIU_DBG_PreInit( int *argc_p, char ***argv_p, int wtimeNotReady )
     MPIU_DBG_ProcessArgs( argc_p, argv_p );
 
     if (wtimeNotReady == 0) {
-	MPID_Wtime( &t );
-	MPID_Wtime_todouble( &t, &timeOrigin );
+	MPL_Wtime( &t );
+	MPL_Wtime_todouble( &t, &timeOrigin );
 	resetTimeOrigin = 0;
     }
 
@@ -743,9 +743,9 @@ int MPIU_DBG_Init( int *argc_p, char ***argv_p, int has_args, int has_env,
 
     /* We may need to wait until the device is set up to initialize the timer */
     if (resetTimeOrigin) {
-	MPID_Time_t t;
-	MPID_Wtime( &t );
-	MPID_Wtime_todouble( &t, &timeOrigin );
+	MPL_Time_t t;
+	MPL_Wtime( &t );
+	MPL_Wtime_todouble( &t, &timeOrigin );
 	resetTimeOrigin = 0;
     }
     /* Check to see if any debugging was selected.  The order of these
diff --git a/src/util/logging/rlog/rlog.c b/src/util/logging/rlog/rlog.c
index 09b66fd..3f2ff50 100644
--- a/src/util/logging/rlog/rlog.c
+++ b/src/util/logging/rlog/rlog.c
@@ -17,7 +17,7 @@
 
 #include "mpi.h"
 /*#define RLOG_timestamp PMPI_Wtime*/
-#include "mpiu_timer.h"
+
 static double RLOG_timestamp(void)
 {
     double d;
diff --git a/src/util/timers/Makefile.mk b/src/util/timers/Makefile.mk
deleted file mode 100644
index 356d350..0000000
--- a/src/util/timers/Makefile.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-## -*- Mode: Makefile; -*-
-## vim: set ft=automake :
-##
-## (C) 2011 by Argonne National Laboratory.
-##     See COPYRIGHT in top-level directory.
-##
-
-AM_CPPFLAGS += -I$(top_srcdir)/src/util/timers -I$(top_builddir)/src/util/timers
-
-nodist_noinst_HEADERS += \
-	src/util/timers/mpiu_timer.h \
-	src/util/timers/mpiu_timer_clock_gettime.h \
-	src/util/timers/mpiu_timer_gethrtime.h \
-	src/util/timers/mpiu_timer_mach_absolute_time.h \
-	src/util/timers/mpiu_timer_device.h \
-	src/util/timers/mpiu_timer_gettimeofday.h \
-	src/util/timers/mpiu_timer_query_performance_counter.h \
-	src/util/timers/mpiu_timer_gcc_ia64_cycle.h \
-	src/util/timers/mpiu_timer_linux86_cycle.h \
-	src/util/timers/mpiu_timer_win86_cycle.h
-
-mpi_core_sources += \
-	src/util/timers/mpiu_timer_clock_gettime.c \
-	src/util/timers/mpiu_timer_gcc_ia64_cycle.c \
-	src/util/timers/mpiu_timer_gethrtime.c \
-	src/util/timers/mpiu_timer_linux86_cycle.c \
-	src/util/timers/mpiu_timer_mach_absolute_time.c \
-	src/util/timers/mpiu_timer_query_performance_counter.c \
-	src/util/timers/mpiu_timer_win86_cycle.c \
-	src/util/timers/mpiu_timer_device.c
diff --git a/src/util/timers/mpiu_timer_device.c b/src/util/timers/mpiu_timer_device.c
deleted file mode 100644
index fa3261d..0000000
--- a/src/util/timers/mpiu_timer_device.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpiu_timer.h"
-
-MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
-
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
-
-int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval) = NULL;
-int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff) = NULL;
-int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3) = NULL;
-int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds) = NULL;
-int (*MPIU_Wtick_fn)(double *tick) = NULL;
-
-int MPIU_Wtime(MPIU_Time_t *timeval)
-{
-    if (MPIU_Wtime_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_fn(timeval);
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
-{
-    if (MPIU_Wtime_diff_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_diff_fn(t1, t2, diff);
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t *t, double *val)
-{
-    if (MPIU_Wtime_todouble_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_todouble_fn(t, val);
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
-{
-    if (MPIU_Wtime_acc_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_acc_fn(t1, t2, t3);
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    if (MPIU_Wtick_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtick_fn(wtick);
-}
-
-#endif
diff --git a/src/util/timers/mpiu_timer_query_performance_counter.c b/src/util/timers/mpiu_timer_query_performance_counter.c
deleted file mode 100644
index 548a679..0000000
--- a/src/util/timers/mpiu_timer_query_performance_counter.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpiu_timer.h"
-
-MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
-
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
-
-static double seconds_per_tick = 0.0;     /* High performance counter frequency */
-
-int MPIU_Wtime_init(void)
-{
-    LARGE_INTEGER n;
-    QueryPerformanceFrequency(&n);
-    seconds_per_tick = 1.0 / (double) n.QuadPart;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    *val = (double) t->QuadPart * seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    LARGE_INTEGER n;
-    n.QuadPart = t2->QuadPart - t1->QuadPart;
-    *diff = (double) n.QuadPart * seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    t3->QuadPart += ((t2->QuadPart) - (t1->QuadPart));
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-#endif
diff --git a/src/util/timers/mpiu_timer_win86_cycle.c b/src/util/timers/mpiu_timer_win86_cycle.c
deleted file mode 100644
index 2a773bd..0000000
--- a/src/util/timers/mpiu_timer_win86_cycle.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpiu_timer.h"
-
-MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
-
-#if (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE)
-
-static double seconds_per_tick = 0.0;
-
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *d)
-{
-    *d = (double) (__int64) * t * seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = (double) ((__int64) (*t2 - *t1)) * seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    MPIU_Time_t t1, t2;
-    DWORD s1, s2;
-    double d;
-    int i;
-
-    MPIU_Wtime(&t1);
-    MPIU_Wtime(&t1);
-
-    /* time an interval using both timers */
-    s1 = GetTickCount();
-    MPIU_Wtime(&t1);
-    /*Sleep(250); *//* Sleep causes power saving cpu's to stop which stops the counter */
-    while (GetTickCount() - s1 < 200) {
-        for (i = 2; i < 1000; i++)
-            d = (double) i / (double) (i - 1);
-    }
-    s2 = GetTickCount();
-    MPIU_Wtime(&t2);
-
-    /* calculate the frequency of the assembly cycle counter */
-    seconds_per_tick = ((double) (s2 - s1) / 1000.0) / (double) ((__int64) (t2 - t1));
-    /*
-     * printf("t2-t1 %10d\nsystime diff %d\nfrequency %g\n CPU MHz %g\n",
-     * (int)(t2-t1), (int)(s2 - s1), seconds_per_tick, seconds_per_tick * 1.0e6);
-     */
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-#endif

http://git.mpich.org/mpich.git/commitdiff/173b39f23c2fbadd3c24f1172f56c0ae51915268

commit 173b39f23c2fbadd3c24f1172f56c0ae51915268
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Jan 5 03:47:30 2016 -0600

    timers: remove namespacing for local variable.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer_gcc_ia64_cycle.c b/src/util/timers/mpiu_timer_gcc_ia64_cycle.c
index 139c48d..75b6721 100644
--- a/src/util/timers/mpiu_timer_gcc_ia64_cycle.c
+++ b/src/util/timers/mpiu_timer_gcc_ia64_cycle.c
@@ -11,10 +11,12 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
 
 #include <sys/time.h>
-double MPIU_Seconds_per_tick = 0.0;
+
+static double seconds_per_tick = 0.0;
+
 int MPIU_Wtick(double *wtick)
 {
-    *wtick = MPIU_Seconds_per_tick;
+    *wtick = seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -34,7 +36,7 @@ int MPIU_Wtime_init(void)
     td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
     td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
 
-    MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
+    seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -42,7 +44,7 @@ int MPIU_Wtime_init(void)
 /* Time stamps created by a macro */
 int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
-    *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
+    *diff = (double) (*t2 - *t1) * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -52,7 +54,7 @@ int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
     /* This returns the number of cycles as the "time".  This isn't correct
      * for implementing MPI_Wtime, but it does allow us to insert cycle
      * counters into test programs */
-    *val = (double) *t * MPIU_Seconds_per_tick;
+    *val = (double) *t * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
diff --git a/src/util/timers/mpiu_timer_gcc_ia64_cycle.h b/src/util/timers/mpiu_timer_gcc_ia64_cycle.h
index a2da327..b825563 100644
--- a/src/util/timers/mpiu_timer_gcc_ia64_cycle.h
+++ b/src/util/timers/mpiu_timer_gcc_ia64_cycle.h
@@ -23,6 +23,4 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
     return MPIU_TIMER_SUCCESS;
 }
 
-extern double MPIU_Seconds_per_tick;
-
 #endif
diff --git a/src/util/timers/mpiu_timer_linux86_cycle.c b/src/util/timers/mpiu_timer_linux86_cycle.c
index 032a936..8bd0e41 100644
--- a/src/util/timers/mpiu_timer_linux86_cycle.c
+++ b/src/util/timers/mpiu_timer_linux86_cycle.c
@@ -11,10 +11,12 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
 
 #include <sys/time.h>
-double MPIU_Seconds_per_tick = 0.0;
+
+static double seconds_per_tick = 0.0;
+
 int MPIU_Wtick(double *wtick)
 {
-    *wtick = MPIU_Seconds_per_tick;
+    *wtick = seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -34,7 +36,7 @@ int MPIU_Wtime_init(void)
     td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
     td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
 
-    MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
+    seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -42,7 +44,7 @@ int MPIU_Wtime_init(void)
 /* Time stamps created by a macro */
 int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
-    *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
+    *diff = (double) (*t2 - *t1) * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -52,7 +54,7 @@ int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
     /* This returns the number of cycles as the "time".  This isn't correct
      * for implementing MPI_Wtime, but it does allow us to insert cycle
      * counters into test programs */
-    *val = (double) *t * MPIU_Seconds_per_tick;
+    *val = (double) *t * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
diff --git a/src/util/timers/mpiu_timer_linux86_cycle.h b/src/util/timers/mpiu_timer_linux86_cycle.h
index c9cf5b7..c85c296 100644
--- a/src/util/timers/mpiu_timer_linux86_cycle.h
+++ b/src/util/timers/mpiu_timer_linux86_cycle.h
@@ -41,6 +41,4 @@ static inline int MPIU_Wtime(MPIU_Time_t *timeval)
     return MPIU_TIMER_SUCCESS;
 }
 
-extern double MPIU_Seconds_per_tick;
-
 #endif
diff --git a/src/util/timers/mpiu_timer_query_performance_counter.c b/src/util/timers/mpiu_timer_query_performance_counter.c
index 684226a..548a679 100644
--- a/src/util/timers/mpiu_timer_query_performance_counter.c
+++ b/src/util/timers/mpiu_timer_query_performance_counter.c
@@ -10,26 +10,27 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
 
-double MPIU_Seconds_per_tick = 0.0;     /* High performance counter frequency */
+static double seconds_per_tick = 0.0;     /* High performance counter frequency */
+
 int MPIU_Wtime_init(void)
 {
     LARGE_INTEGER n;
     QueryPerformanceFrequency(&n);
-    MPIU_Seconds_per_tick = 1.0 / (double) n.QuadPart;
+    seconds_per_tick = 1.0 / (double) n.QuadPart;
 
     return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtick(double *wtick)
 {
-    *wtick = MPIU_Seconds_per_tick;
+    *wtick = seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
-    *val = (double) t->QuadPart * MPIU_Seconds_per_tick;
+    *val = (double) t->QuadPart * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -38,7 +39,7 @@ int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     LARGE_INTEGER n;
     n.QuadPart = t2->QuadPart - t1->QuadPart;
-    *diff = (double) n.QuadPart * MPIU_Seconds_per_tick;
+    *diff = (double) n.QuadPart * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
diff --git a/src/util/timers/mpiu_timer_query_performance_counter.h b/src/util/timers/mpiu_timer_query_performance_counter.h
index 482ad0a..385e58d 100644
--- a/src/util/timers/mpiu_timer_query_performance_counter.h
+++ b/src/util/timers/mpiu_timer_query_performance_counter.h
@@ -17,6 +17,4 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
     return MPIU_TIMER_SUCCESS;
 }
 
-extern double MPIU_Seconds_per_tick;
-
 #endif
diff --git a/src/util/timers/mpiu_timer_win86_cycle.c b/src/util/timers/mpiu_timer_win86_cycle.c
index 3a7a3a6..2a773bd 100644
--- a/src/util/timers/mpiu_timer_win86_cycle.c
+++ b/src/util/timers/mpiu_timer_win86_cycle.c
@@ -10,24 +10,25 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
 
 #if (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE)
 
-double MPIU_Seconds_per_tick = 0.0;
+static double seconds_per_tick = 0.0;
+
 int MPIU_Wtick(double *wtick)
 {
-    *wtick = MPIU_Seconds_per_tick;
+    *wtick = seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_todouble(MPIU_Time_t * t, double *d)
 {
-    *d = (double) (__int64) * t * MPIU_Seconds_per_tick;
+    *d = (double) (__int64) * t * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
-    *diff = (double) ((__int64) (*t2 - *t1)) * MPIU_Seconds_per_tick;
+    *diff = (double) ((__int64) (*t2 - *t1)) * seconds_per_tick;
 
     return MPIU_TIMER_SUCCESS;
 }
@@ -54,10 +55,10 @@ int MPIU_Wtime_init(void)
     MPIU_Wtime(&t2);
 
     /* calculate the frequency of the assembly cycle counter */
-    MPIU_Seconds_per_tick = ((double) (s2 - s1) / 1000.0) / (double) ((__int64) (t2 - t1));
+    seconds_per_tick = ((double) (s2 - s1) / 1000.0) / (double) ((__int64) (t2 - t1));
     /*
      * printf("t2-t1 %10d\nsystime diff %d\nfrequency %g\n CPU MHz %g\n",
-     * (int)(t2-t1), (int)(s2 - s1), MPIU_Seconds_per_tick, MPIU_Seconds_per_tick * 1.0e6);
+     * (int)(t2-t1), (int)(s2 - s1), seconds_per_tick, seconds_per_tick * 1.0e6);
      */
 
     return MPIU_TIMER_SUCCESS;
diff --git a/src/util/timers/mpiu_timer_win86_cycle.h b/src/util/timers/mpiu_timer_win86_cycle.h
index d7d0988..11d52a4 100644
--- a/src/util/timers/mpiu_timer_win86_cycle.h
+++ b/src/util/timers/mpiu_timer_win86_cycle.h
@@ -22,6 +22,4 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
     return MPIU_TIMER_SUCCESS;
 }
 
-extern double MPIU_Seconds_per_tick;
-
 #endif

http://git.mpich.org/mpich.git/commitdiff/104dde567acc45d7d070e059adf34b1bebf6fa67

commit 104dde567acc45d7d070e059adf34b1bebf6fa67
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Jan 5 01:22:50 2016 -0600

    timers: split timers into different files.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/Makefile.mk b/src/util/timers/Makefile.mk
index dc4e728..356d350 100644
--- a/src/util/timers/Makefile.mk
+++ b/src/util/timers/Makefile.mk
@@ -5,6 +5,26 @@
 ##     See COPYRIGHT in top-level directory.
 ##
 
-AM_CPPFLAGS += -I$(top_builddir)/src/util/timers
-nodist_noinst_HEADERS += src/util/timers/mpiu_timer.h
-mpi_core_sources += src/util/timers/mpiu_timer.c
+AM_CPPFLAGS += -I$(top_srcdir)/src/util/timers -I$(top_builddir)/src/util/timers
+
+nodist_noinst_HEADERS += \
+	src/util/timers/mpiu_timer.h \
+	src/util/timers/mpiu_timer_clock_gettime.h \
+	src/util/timers/mpiu_timer_gethrtime.h \
+	src/util/timers/mpiu_timer_mach_absolute_time.h \
+	src/util/timers/mpiu_timer_device.h \
+	src/util/timers/mpiu_timer_gettimeofday.h \
+	src/util/timers/mpiu_timer_query_performance_counter.h \
+	src/util/timers/mpiu_timer_gcc_ia64_cycle.h \
+	src/util/timers/mpiu_timer_linux86_cycle.h \
+	src/util/timers/mpiu_timer_win86_cycle.h
+
+mpi_core_sources += \
+	src/util/timers/mpiu_timer_clock_gettime.c \
+	src/util/timers/mpiu_timer_gcc_ia64_cycle.c \
+	src/util/timers/mpiu_timer_gethrtime.c \
+	src/util/timers/mpiu_timer_linux86_cycle.c \
+	src/util/timers/mpiu_timer_mach_absolute_time.c \
+	src/util/timers/mpiu_timer_query_performance_counter.c \
+	src/util/timers/mpiu_timer_win86_cycle.c \
+	src/util/timers/mpiu_timer_device.c
diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
deleted file mode 100644
index afaf1db..0000000
--- a/src/util/timers/mpiu_timer.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpiu_timer.h"
-
-/*
- * For timers that do not have defined resolutions, compute the resolution
- * by sampling the clock itself.
- *
- */
-static double tickval = -1.0;
-
-static void init_wtick(void) ATTRIBUTE((unused));
-static void init_wtick(void)
-{
-    double timediff;
-    MPIU_Time_t t1, t2;
-    int cnt;
-    int icnt;
-
-    tickval = 1.0e6;
-    for (icnt = 0; icnt < 10; icnt++) {
-        cnt = 1000;
-        MPIU_Wtime(&t1);
-        do {
-            MPIU_Wtime(&t2);
-            MPIU_Wtime_diff(&t1, &t2, &timediff);
-            if (timediff > 0)
-                break;
-        }
-        while (cnt--);
-        if (cnt && timediff > 0.0 && timediff < tickval) {
-            MPIU_Wtime_diff(&t1, &t2, &tickval);
-        }
-    }
-}
-
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
-/*
- * MPIU_Time_t is hrtime_t, which under Solaris is defined as a 64bit
- * longlong_t .  However, the Solaris header files will define
- * longlong_t as a structure in some circumstances, making arithmetic
- * with hrtime_t invalid.  FIXME.
- * To fix this, we'll need to test hrtime_t arithmetic in the configure
- * program, and if it fails, check for the Solaris defintions (
- * union { double _d; int32_t _l[2]; }.  Alternately, we may decide that
- * if hrtime_t is not supported, then neither is gethrtime.
- *
- * Note that the Solaris sys/types.h file *assumes* that no other compiler
- * supports an 8 byte long long.  We can also cast hrtime_t to long long
- * if long long is available and 8 bytes.
- */
-int MPIU_Wtime(MPIU_Time_t * timeval)
-{
-    *timeval = gethrtime();
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = 1.0e-9 * (double) (*t2 - *t1);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    *val = 1.0e-9 * (*t);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    *t3 += ((*t2) - (*t1));
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    /* According to the documentation, ticks should be in nanoseconds.  This
-     * is untested */
-    *wtick = 1.0e-9;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    return MPIU_TIMER_SUCCESS;
-}
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
-int MPIU_Wtime(MPIU_Time_t * timeval)
-{
-    /* POSIX timer (14.2.1, page 311) */
-    clock_gettime(CLOCK_REALTIME, timeval);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = ((double) (t2->tv_sec - t1->tv_sec) + 1.0e-9 * (double) (t2->tv_nsec - t1->tv_nsec));
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    *val = ((double) t->tv_sec + 1.0e-9 * (double) t->tv_nsec);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    int nsec, sec;
-
-    nsec = t2->tv_nsec - t1->tv_nsec;
-    sec = t2->tv_sec - t1->tv_sec;
-
-    t3->tv_sec += sec;
-    t3->tv_nsec += nsec;
-    while (t3->tv_nsec > 1000000000) {
-        t3->tv_nsec -= 1000000000;
-        t3->tv_sec++;
-    }
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    struct timespec res;
-    int rc;
-
-    rc = clock_getres(CLOCK_REALTIME, &res);
-    if (!rc)
-        /* May return -1 for unimplemented ! */
-        *wtick = res.tv_sec + 1.0e-9 * res.tv_nsec;
-
-    /* Sigh.  If not implemented (POSIX allows that),
-     * then we need to return the generic tick value */
-    *wtick = tickval;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    init_wtick();
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int MPIU_Wtime(MPIU_Time_t * tval)
-{
-    gettimeofday(tval, NULL);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = ((double) (t2->tv_sec - t1->tv_sec) + .000001 * (double) (t2->tv_usec - t1->tv_usec));
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    *val = (double) t->tv_sec + .000001 * (double) t->tv_usec;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    int usec, sec;
-
-    usec = t2->tv_usec - t1->tv_usec;
-    sec = t2->tv_sec - t1->tv_sec;
-    t3->tv_usec += usec;
-    t3->tv_sec += sec;
-    /* Handle carry to the integer seconds field */
-    while (t3->tv_usec > 1000000) {
-        t3->tv_usec -= 1000000;
-        t3->tv_sec++;
-    }
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = tickval;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    init_wtick();
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
-#include <sys/time.h>
-double MPIU_Seconds_per_tick = 0.0;
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    unsigned long long t1, t2;
-    struct timeval tv1, tv2;
-    double td1, td2;
-
-    gettimeofday(&tv1, NULL);
-    MPIU_Wtime(&t1);
-    usleep(250000);
-    gettimeofday(&tv2, NULL);
-    MPIU_Wtime(&t2);
-
-    td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
-    td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
-
-    MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-/* Time stamps created by a macro */
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    /* This returns the number of cycles as the "time".  This isn't correct
-     * for implementing MPI_Wtime, but it does allow us to insert cycle
-     * counters into test programs */
-    *val = (double) *t * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    *t3 += (*t2 - *t1);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
-#include <sys/time.h>
-double MPIU_Seconds_per_tick = 0.0;
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    unsigned long long t1, t2;
-    struct timeval tv1, tv2;
-    double td1, td2;
-
-    gettimeofday(&tv1, NULL);
-    MPIU_Wtime(&t1);
-    usleep(250000);
-    gettimeofday(&tv2, NULL);
-    MPIU_Wtime(&t2);
-
-    td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
-    td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
-
-    MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-/* Time stamps created by a macro */
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    /* This returns the number of cycles as the "time".  This isn't correct
-     * for implementing MPI_Wtime, but it does allow us to insert cycle
-     * counters into test programs */
-    *val = (double) *t * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    *t3 += (*t2 - *t1);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-#elif (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE)
-double MPIU_Seconds_per_tick = 0.0;
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *d)
-{
-    *d = (double) (__int64) * t * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = (double) ((__int64) (*t2 - *t1)) * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_init(void)
-{
-    MPIU_Time_t t1, t2;
-    DWORD s1, s2;
-    double d;
-    int i;
-
-    MPIU_Wtime(&t1);
-    MPIU_Wtime(&t1);
-
-    /* time an interval using both timers */
-    s1 = GetTickCount();
-    MPIU_Wtime(&t1);
-    /*Sleep(250); *//* Sleep causes power saving cpu's to stop which stops the counter */
-    while (GetTickCount() - s1 < 200) {
-        for (i = 2; i < 1000; i++)
-            d = (double) i / (double) (i - 1);
-    }
-    s2 = GetTickCount();
-    MPIU_Wtime(&t2);
-
-    /* calculate the frequency of the assembly cycle counter */
-    MPIU_Seconds_per_tick = ((double) (s2 - s1) / 1000.0) / (double) ((__int64) (t2 - t1));
-    /*
-     * printf("t2-t1 %10d\nsystime diff %d\nfrequency %g\n CPU MHz %g\n",
-     * (int)(t2-t1), (int)(s2 - s1), MPIU_Seconds_per_tick, MPIU_Seconds_per_tick * 1.0e6);
-     */
-
-    return MPIU_TIMER_SUCCESS;
-}
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
-double MPIU_Seconds_per_tick = 0.0;     /* High performance counter frequency */
-int MPIU_Wtime_init(void)
-{
-    LARGE_INTEGER n;
-    QueryPerformanceFrequency(&n);
-    MPIU_Seconds_per_tick = 1.0 / (double) n.QuadPart;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    *val = (double) t->QuadPart * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    LARGE_INTEGER n;
-    n.QuadPart = t2->QuadPart - t1->QuadPart;
-    *diff = (double) n.QuadPart * MPIU_Seconds_per_tick;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    t3->QuadPart += ((t2->QuadPart) - (t1->QuadPart));
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
-static double MPIR_Wtime_mult;
-
-int MPIU_Wtime_init(void)
-{
-    mach_timebase_info_data_t info;
-    mach_timebase_info(&info);
-    MPIR_Wtime_mult = 1.0e-9 * ((double) info.numer / (double) info.denom);
-    init_wtick();
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime(MPIU_Time_t * timeval)
-{
-    *timeval = mach_absolute_time();
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
-{
-    *diff = (*t2 - *t1) * MPIR_Wtime_mult;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
-{
-    *val = *t * MPIR_Wtime_mult;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
-{
-    *t3 += *t2 - *t1;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    *wtick = tickval;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
-
-int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval) = NULL;
-int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff) = NULL;
-int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3) = NULL;
-int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds) = NULL;
-int (*MPIU_Wtick_fn)(double *tick) = NULL;
-
-int MPIU_Wtime(MPIU_Time_t *timeval)
-{
-    if (MPIU_Wtime_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_fn(timeval);
-}
-
-int MPIU_Wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
-{
-    if (MPIU_Wtime_diff_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_diff_fn(t1, t2, diff);
-}
-
-int MPIU_Wtime_todouble(MPIU_Time_t *t, double *val)
-{
-    if (MPIU_Wtime_todouble_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_todouble_fn(t, val);
-}
-
-int MPIU_Wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
-{
-    if (MPIU_Wtime_acc_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtime_acc_fn(t1, t2, t3);
-}
-
-int MPIU_Wtick(double *wtick)
-{
-    if (MPIU_Wtick_fn == NULL)
-        return MPIU_TIMER_ERR_NOT_INITIALIZED;
-    return MPIU_Wtick_fn(wtick);
-}
-
-#endif
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 688ea21..217db41 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -40,28 +40,27 @@ int usleep(useconds_t usec);
 #define MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME      11
 #define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
 
+/* Define a time stamp */
+typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
+
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
-#include <sys/time.h>
+#include "mpiu_timer_gethrtime.h"
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
-#include <time.h>
-#ifdef NEEDS_SYS_TIME_H
-/* Some OS'es mistakenly require sys/time.h to get the definition of
-   CLOCK_REALTIME (POSIX requires the definition to be in time.h) */
-#include <sys/time.h>
-#endif
+#include "mpiu_timer_clock_gettime.h"
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
-#include <sys/types.h>
-#include <sys/time.h>
+#include "mpiu_timer_gettimeofday.h"
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
+#include "mpiu_timer_linux86_cycle.h"
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
-#include <winsock2.h>
-#include <windows.h>
+#include "mpiu_timer_query_performance_counter.h"
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE || MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE
+#include "mpiu_timer_win86_cycle.h"
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
+#include "mpiu_timer_gcc_ia64_cycle.h"
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
+#include "mpiu_timer_device.h"
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
-#include <mach/mach_time.h>
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE
-#include <winsock2.h>
-#include <windows.h>
+#include "mpiu_timer_mach_absolute_time.h"
 #endif
 
 /* The timer code is allowed to return "NOT_INITIALIZED" before the
@@ -72,36 +71,49 @@ int usleep(useconds_t usec);
 #define MPIU_TIMER_ERR_NOT_INITIALIZED    1
 
 /*
- * If the timer capability is provided by the device, it would need to
- * expose it in two ways:
- *
- *    1. It would expose it through the MPID_ functionality.  This
- *       model would be used by the MPICH internal code, and would
- *       give fast access to the timers.
- *
- *    2. It would expose it through the MPIU_Timer_ function pointers.
- *       This model would be used by "external" code segments (such as
- *       MPIU) which do not have direct access to the MPICH devices.
- *       This model might be slightly slower, but would give the same
- *       functionality.
- */
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
-typedef void * MPIU_Time_t;
-extern int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval);
-extern int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff);
-extern int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3);
-extern int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds);
-extern int (*MPIU_Wtick_fn)(double *tick);
-#else
-/* Define a time stamp */
-typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
-#endif
-
-/*
  * Prototypes.  These are defined here so that inlined timer calls can
  * use them, as well as any profiling and timing code that is built into
  * MPICH
  */
+
+#if defined MPIUI_WTIME_IS_A_FUNCTION
+/*@
+  MPIU_Wtime - Return a time stamp
+
+  Output Parameter:
+. timeval - A pointer to an 'MPIU_Wtime_t' variable.
+
+  Notes:
+  This routine returns an `opaque` time value.  This difference between two
+  time values returned by 'MPIU_Wtime' can be converted into an elapsed time
+  in seconds with the routine 'MPIU_Wtime_diff'.
+
+  This routine is defined this way to simplify its implementation as a macro.
+  For example, the for Intel x86 and gcc,
+.vb
+#define MPIU_Wtime(timeval) \
+     __asm__ __volatile__("rdtsc" : "=A" (*timeval))
+.ve
+
+  For some purposes, it is important
+  that the timer calls change the timing of the code as little as possible.
+  This form of a timer routine provides for a very fast timer that has
+  minimal impact on the rest of the code.
+
+  From a semantic standpoint, this format emphasizes that any particular
+  timer value has no meaning; only the difference between two values is
+  meaningful.
+
+  Module:
+  Timer
+
+  Question:
+  MPI-2 allows 'MPI_Wtime' to be a macro.  We should make that easy; this
+  version does not accomplish that.
+  @*/
+int MPIU_Wtime(MPIU_Time_t * timeval);
+#endif /* MPIUI_WTIME_IS_A_FUNCTION */
+
 /*@
   MPIU_Wtime_diff - Compute the difference between two time stamps
 
@@ -202,138 +214,36 @@ int MPIU_Wtick(double *);
   @*/
 int MPIU_Wtime_init(void);
 
-/* Inlined timers.  Note that any definition of one of the functions
-   prototyped above in terms of a macro will simply cause the compiler
-   to use the macro instead of the function definition.
-
-   Currently, all except the Windows performance counter timers
-   define MPIU_Wtime_init as null; by default, the value of
-   MPI_WTIME_IS_GLOBAL is false.
+/*
+ * For timers that do not have defined resolutions, compute the resolution
+ * by sampling the clock itself.
+ *
  */
+static double tickval = -1.0;
 
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
-
-static inline int MPIU_Wtime(MPIU_Time_t *timeval)
+static void init_wtick(void) ATTRIBUTE((unused));
+static void init_wtick(void)
 {
-/* The rdtsc instruction is not a "serializing" instruction, so the
-   processor is free to reorder it.  In order to get more accurate
-   timing numbers with rdtsc, we need to put a serializing
-   instruction, like cpuid, before rdtsc.  X86_64 architectures have
-   the rdtscp instruction which is synchronizing, we use this when we
-   can. */
-#ifdef LINUX86_CYCLE_RDTSCP
-    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*timeval) : : "ecx", "rdx");
-
-#elif defined(LINUX86_CYCLE_CPUID_RDTSC64)
-/* Here we have to save the rbx register for when the compiler is
-   generating position independent code (e.g., when it's generating
-   shared libraries) */
-    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx" : "=A" (*timeval) : : "ecx");
-
-#elif defined(LINUX86_CYCLE_CPUID_RDTSC32)
-/* Here we have to save the ebx register for when the compiler is
-   generating position independent code (e.g., when it's generating
-   shared libraries) */
-    __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*timeval) : : "ecx");
-
-#elif defined(LINUX86_CYCLE_RDTSC)
-/* The configure test using cpuid must have failed, try just rdtsc by itself */
-    __asm__ __volatile__("rdtsc" : "=A" (*timeval));
-
-#else
-#error Dont know which Linux timer to use
-#endif
-
-    return MPIU_TIMER_SUCCESS;
+    double timediff;
+    MPIU_Time_t t1, t2;
+    int cnt;
+    int icnt;
+
+    tickval = 1.0e6;
+    for (icnt = 0; icnt < 10; icnt++) {
+        cnt = 1000;
+        MPIU_Wtime(&t1);
+        do {
+            MPIU_Wtime(&t2);
+            MPIU_Wtime_diff(&t1, &t2, &timediff);
+            if (timediff > 0)
+                break;
+        }
+        while (cnt--);
+        if (cnt && timediff > 0.0 && timediff < tickval) {
+            MPIU_Wtime_diff(&t1, &t2, &tickval);
+        }
+    }
 }
 
-extern double MPIU_Seconds_per_tick;
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
-
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
-{
-    MPIU_Time_t t_val;
-
-#ifdef __INTEL_COMPILER
-#include "ia64regs.h"
-    t_val = __getReg(_IA64_REG_AR_ITC);
-#else
-    __asm__ __volatile__("mov %0=ar.itc" : "=r" (t_val));
-#endif
-
-    *timeval = t_val;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-extern double MPIU_Seconds_per_tick;
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
-
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
-{
-    QueryPerformanceCounter(timeval);
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-extern double MPIU_Seconds_per_tick;
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE
-
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
-{
-    register int *f1 = (int*)var_ptr;
-    __asm cpuid;
-    __asm rdtsc;
-    __asm mov ecx, f1;
-    __asm mov [ecx], eax;
-    __asm mov [ecx + TYPE int], edx;
-
-    return MPIU_TIMER_SUCCESS;
-}
-
-extern double MPIU_Seconds_per_tick;
-
-#else
-
-/*@
-  MPIU_Wtime - Return a time stamp
-
-  Output Parameter:
-. timeval - A pointer to an 'MPIU_Wtime_t' variable.
-
-  Notes:
-  This routine returns an `opaque` time value.  This difference between two
-  time values returned by 'MPIU_Wtime' can be converted into an elapsed time
-  in seconds with the routine 'MPIU_Wtime_diff'.
-
-  This routine is defined this way to simplify its implementation as a macro.
-  For example, the for Intel x86 and gcc,
-.vb
-#define MPIU_Wtime(timeval) \
-     __asm__ __volatile__("rdtsc" : "=A" (*timeval))
-.ve
-
-  For some purposes, it is important
-  that the timer calls change the timing of the code as little as possible.
-  This form of a timer routine provides for a very fast timer that has
-  minimal impact on the rest of the code.
-
-  From a semantic standpoint, this format emphasizes that any particular
-  timer value has no meaning; only the difference between two values is
-  meaningful.
-
-  Module:
-  Timer
-
-  Question:
-  MPI-2 allows 'MPI_Wtime' to be a macro.  We should make that easy; this
-  version does not accomplish that.
-  @*/
-int MPIU_Wtime(MPIU_Time_t * timeval);
-
-#endif
-
 #endif
diff --git a/src/util/timers/mpiu_timer_clock_gettime.c b/src/util/timers/mpiu_timer_clock_gettime.c
new file mode 100644
index 0000000..cb0fb6e
--- /dev/null
+++ b/src/util/timers/mpiu_timer_clock_gettime.c
@@ -0,0 +1,76 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
+
+int MPIU_Wtime(MPIU_Time_t * timeval)
+{
+    /* POSIX timer (14.2.1, page 311) */
+    clock_gettime(CLOCK_REALTIME, timeval);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = ((double) (t2->tv_sec - t1->tv_sec) + 1.0e-9 * (double) (t2->tv_nsec - t1->tv_nsec));
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    *val = ((double) t->tv_sec + 1.0e-9 * (double) t->tv_nsec);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    int nsec, sec;
+
+    nsec = t2->tv_nsec - t1->tv_nsec;
+    sec = t2->tv_sec - t1->tv_sec;
+
+    t3->tv_sec += sec;
+    t3->tv_nsec += nsec;
+    while (t3->tv_nsec > 1000000000) {
+        t3->tv_nsec -= 1000000000;
+        t3->tv_sec++;
+    }
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    struct timespec res;
+    int rc;
+
+    rc = clock_getres(CLOCK_REALTIME, &res);
+    if (!rc)
+        /* May return -1 for unimplemented ! */
+        *wtick = res.tv_sec + 1.0e-9 * res.tv_nsec;
+
+    /* Sigh.  If not implemented (POSIX allows that),
+     * then we need to return the generic tick value */
+    *wtick = tickval;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_init(void)
+{
+    init_wtick();
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_clock_gettime.h b/src/util/timers/mpiu_timer_clock_gettime.h
new file mode 100644
index 0000000..9b35089
--- /dev/null
+++ b/src/util/timers/mpiu_timer_clock_gettime.h
@@ -0,0 +1,19 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_CLOCK_GETTIME_H_INCLUDED
+#define MPIU_TIMER_CLOCK_GETTIME_H_INCLUDED
+
+#define MPIUI_WTIME_IS_A_FUNCTION
+
+#include <time.h>
+#ifdef NEEDS_SYS_TIME_H
+/* Some OS'es mistakenly require sys/time.h to get the definition of
+   CLOCK_REALTIME (POSIX requires the definition to be in time.h) */
+#include <sys/time.h>
+#endif
+
+#endif
diff --git a/src/util/timers/mpiu_timer_device.c b/src/util/timers/mpiu_timer_device.c
new file mode 100644
index 0000000..fa3261d
--- /dev/null
+++ b/src/util/timers/mpiu_timer_device.c
@@ -0,0 +1,54 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
+
+int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval) = NULL;
+int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff) = NULL;
+int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3) = NULL;
+int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds) = NULL;
+int (*MPIU_Wtick_fn)(double *tick) = NULL;
+
+int MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    if (MPIU_Wtime_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_fn(timeval);
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
+{
+    if (MPIU_Wtime_diff_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_diff_fn(t1, t2, diff);
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t *t, double *val)
+{
+    if (MPIU_Wtime_todouble_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_todouble_fn(t, val);
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
+{
+    if (MPIU_Wtime_acc_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_acc_fn(t1, t2, t3);
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    if (MPIU_Wtick_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtick_fn(wtick);
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_device.h b/src/util/timers/mpiu_timer_device.h
new file mode 100644
index 0000000..2b1e375
--- /dev/null
+++ b/src/util/timers/mpiu_timer_device.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_DEVICE_H_INCLUDED
+#define MPIU_TIMER_DEVICE_H_INCLUDED
+
+#define MPIUI_WTIME_IS_A_FUNCTION
+
+/*
+ * If the timer capability is provided by the device, it would need to
+ * expose it in two ways:
+ *
+ *    1. It would expose it through the MPID_ functionality.  This
+ *       model would be used by the MPICH internal code, and would
+ *       give fast access to the timers.
+ *
+ *    2. It would expose it through the MPIU_Timer_ function pointers.
+ *       This model would be used by "external" code segments (such as
+ *       MPIU) which do not have direct access to the MPICH devices.
+ *       This model might be slightly slower, but would give the same
+ *       functionality.
+ */
+extern int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval);
+extern int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff);
+extern int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3);
+extern int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds);
+extern int (*MPIU_Wtick_fn)(double *tick);
+
+#endif
diff --git a/src/util/timers/mpiu_timer_gcc_ia64_cycle.c b/src/util/timers/mpiu_timer_gcc_ia64_cycle.c
new file mode 100644
index 0000000..139c48d
--- /dev/null
+++ b/src/util/timers/mpiu_timer_gcc_ia64_cycle.c
@@ -0,0 +1,67 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
+
+#include <sys/time.h>
+double MPIU_Seconds_per_tick = 0.0;
+int MPIU_Wtick(double *wtick)
+{
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_init(void)
+{
+    unsigned long long t1, t2;
+    struct timeval tv1, tv2;
+    double td1, td2;
+
+    gettimeofday(&tv1, NULL);
+    MPIU_Wtime(&t1);
+    usleep(250000);
+    gettimeofday(&tv2, NULL);
+    MPIU_Wtime(&t2);
+
+    td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
+    td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
+
+    MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+/* Time stamps created by a macro */
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    /* This returns the number of cycles as the "time".  This isn't correct
+     * for implementing MPI_Wtime, but it does allow us to insert cycle
+     * counters into test programs */
+    *val = (double) *t * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    *t3 += (*t2 - *t1);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_gcc_ia64_cycle.h b/src/util/timers/mpiu_timer_gcc_ia64_cycle.h
new file mode 100644
index 0000000..a2da327
--- /dev/null
+++ b/src/util/timers/mpiu_timer_gcc_ia64_cycle.h
@@ -0,0 +1,28 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_GCC_IA64_CYCLE_H_INCLUDED
+#define MPIU_TIMER_GCC_IA64_CYCLE_H_INCLUDED
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    MPIU_Time_t t_val;
+
+#ifdef __INTEL_COMPILER
+#include "ia64regs.h"
+    t_val = __getReg(_IA64_REG_AR_ITC);
+#else
+    __asm__ __volatile__("mov %0=ar.itc" : "=r" (t_val));
+#endif
+
+    *timeval = t_val;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+extern double MPIU_Seconds_per_tick;
+
+#endif
diff --git a/src/util/timers/mpiu_timer_gethrtime.c b/src/util/timers/mpiu_timer_gethrtime.c
new file mode 100644
index 0000000..97ddbe7
--- /dev/null
+++ b/src/util/timers/mpiu_timer_gethrtime.c
@@ -0,0 +1,69 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
+
+/*
+ * MPIU_Time_t is hrtime_t, which under Solaris is defined as a 64bit
+ * longlong_t .  However, the Solaris header files will define
+ * longlong_t as a structure in some circumstances, making arithmetic
+ * with hrtime_t invalid.  FIXME.
+ * To fix this, we'll need to test hrtime_t arithmetic in the configure
+ * program, and if it fails, check for the Solaris defintions (
+ * union { double _d; int32_t _l[2]; }.  Alternately, we may decide that
+ * if hrtime_t is not supported, then neither is gethrtime.
+ *
+ * Note that the Solaris sys/types.h file *assumes* that no other compiler
+ * supports an 8 byte long long.  We can also cast hrtime_t to long long
+ * if long long is available and 8 bytes.
+ */
+int MPIU_Wtime(MPIU_Time_t * timeval)
+{
+    *timeval = gethrtime();
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = 1.0e-9 * (double) (*t2 - *t1);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    *val = 1.0e-9 * (*t);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    *t3 += ((*t2) - (*t1));
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    /* According to the documentation, ticks should be in nanoseconds.  This
+     * is untested */
+    *wtick = 1.0e-9;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_init(void)
+{
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_gethrtime.h b/src/util/timers/mpiu_timer_gethrtime.h
new file mode 100644
index 0000000..b06bf4f
--- /dev/null
+++ b/src/util/timers/mpiu_timer_gethrtime.h
@@ -0,0 +1,14 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_GETHRTIME_H_INCLUDED
+#define MPIU_TIMER_GETHRTIME_H_INCLUDED
+
+#define MPIUI_WTIME_IS_A_FUNCTION
+
+#include <sys/time.h>
+
+#endif
diff --git a/src/util/timers/mpiu_timer_gettimeofday.c b/src/util/timers/mpiu_timer_gettimeofday.c
new file mode 100644
index 0000000..f7d9cb9
--- /dev/null
+++ b/src/util/timers/mpiu_timer_gettimeofday.c
@@ -0,0 +1,71 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+int MPIU_Wtime(MPIU_Time_t * tval)
+{
+    gettimeofday(tval, NULL);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = ((double) (t2->tv_sec - t1->tv_sec) + .000001 * (double) (t2->tv_usec - t1->tv_usec));
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    *val = (double) t->tv_sec + .000001 * (double) t->tv_usec;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    int usec, sec;
+
+    usec = t2->tv_usec - t1->tv_usec;
+    sec = t2->tv_sec - t1->tv_sec;
+    t3->tv_usec += usec;
+    t3->tv_sec += sec;
+    /* Handle carry to the integer seconds field */
+    while (t3->tv_usec > 1000000) {
+        t3->tv_usec -= 1000000;
+        t3->tv_sec++;
+    }
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    *wtick = tickval;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_init(void)
+{
+    init_wtick();
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_gettimeofday.h b/src/util/timers/mpiu_timer_gettimeofday.h
new file mode 100644
index 0000000..e8020d6
--- /dev/null
+++ b/src/util/timers/mpiu_timer_gettimeofday.h
@@ -0,0 +1,15 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_GETTIMEOFDAY_H_INCLUDED
+#define MPIU_TIMER_GETTIMEOFDAY_H_INCLUDED
+
+#define MPIUI_WTIME_IS_A_FUNCTION
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+#endif
diff --git a/src/util/timers/mpiu_timer_linux86_cycle.c b/src/util/timers/mpiu_timer_linux86_cycle.c
new file mode 100644
index 0000000..032a936
--- /dev/null
+++ b/src/util/timers/mpiu_timer_linux86_cycle.c
@@ -0,0 +1,67 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
+
+#include <sys/time.h>
+double MPIU_Seconds_per_tick = 0.0;
+int MPIU_Wtick(double *wtick)
+{
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_init(void)
+{
+    unsigned long long t1, t2;
+    struct timeval tv1, tv2;
+    double td1, td2;
+
+    gettimeofday(&tv1, NULL);
+    MPIU_Wtime(&t1);
+    usleep(250000);
+    gettimeofday(&tv2, NULL);
+    MPIU_Wtime(&t2);
+
+    td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0;
+    td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
+
+    MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+/* Time stamps created by a macro */
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    /* This returns the number of cycles as the "time".  This isn't correct
+     * for implementing MPI_Wtime, but it does allow us to insert cycle
+     * counters into test programs */
+    *val = (double) *t * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    *t3 += (*t2 - *t1);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_linux86_cycle.h b/src/util/timers/mpiu_timer_linux86_cycle.h
new file mode 100644
index 0000000..c9cf5b7
--- /dev/null
+++ b/src/util/timers/mpiu_timer_linux86_cycle.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_LINUX86_CYCLE_H_INCLUDED
+#define MPIU_TIMER_LINUX86_CYCLE_H_INCLUDED
+
+static inline int MPIU_Wtime(MPIU_Time_t *timeval)
+{
+/* The rdtsc instruction is not a "serializing" instruction, so the
+   processor is free to reorder it.  In order to get more accurate
+   timing numbers with rdtsc, we need to put a serializing
+   instruction, like cpuid, before rdtsc.  X86_64 architectures have
+   the rdtscp instruction which is synchronizing, we use this when we
+   can. */
+#ifdef LINUX86_CYCLE_RDTSCP
+    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*timeval) : : "ecx", "rdx");
+
+#elif defined(LINUX86_CYCLE_CPUID_RDTSC64)
+/* Here we have to save the rbx register for when the compiler is
+   generating position independent code (e.g., when it's generating
+   shared libraries) */
+    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx" : "=A" (*timeval) : : "ecx");
+
+#elif defined(LINUX86_CYCLE_CPUID_RDTSC32)
+/* Here we have to save the ebx register for when the compiler is
+   generating position independent code (e.g., when it's generating
+   shared libraries) */
+    __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*timeval) : : "ecx");
+
+#elif defined(LINUX86_CYCLE_RDTSC)
+/* The configure test using cpuid must have failed, try just rdtsc by itself */
+    __asm__ __volatile__("rdtsc" : "=A" (*timeval));
+
+#else
+#error Dont know which Linux timer to use
+#endif
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+extern double MPIU_Seconds_per_tick;
+
+#endif
diff --git a/src/util/timers/mpiu_timer_mach_absolute_time.c b/src/util/timers/mpiu_timer_mach_absolute_time.c
new file mode 100644
index 0000000..ac19e32
--- /dev/null
+++ b/src/util/timers/mpiu_timer_mach_absolute_time.c
@@ -0,0 +1,60 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
+
+static double MPIR_Wtime_mult;
+
+int MPIU_Wtime_init(void)
+{
+    mach_timebase_info_data_t info;
+    mach_timebase_info(&info);
+    MPIR_Wtime_mult = 1.0e-9 * ((double) info.numer / (double) info.denom);
+    init_wtick();
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime(MPIU_Time_t * timeval)
+{
+    *timeval = mach_absolute_time();
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = (*t2 - *t1) * MPIR_Wtime_mult;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    *val = *t * MPIR_Wtime_mult;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    *t3 += *t2 - *t1;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    *wtick = tickval;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_mach_absolute_time.h b/src/util/timers/mpiu_timer_mach_absolute_time.h
new file mode 100644
index 0000000..512b29b
--- /dev/null
+++ b/src/util/timers/mpiu_timer_mach_absolute_time.h
@@ -0,0 +1,14 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED
+#define MPIU_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED
+
+#define MPIUI_WTIME_IS_A_FUNCTION
+
+#include <mach/mach_time.h>
+
+#endif
diff --git a/src/util/timers/mpiu_timer_query_performance_counter.c b/src/util/timers/mpiu_timer_query_performance_counter.c
new file mode 100644
index 0000000..684226a
--- /dev/null
+++ b/src/util/timers/mpiu_timer_query_performance_counter.c
@@ -0,0 +1,53 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
+
+double MPIU_Seconds_per_tick = 0.0;     /* High performance counter frequency */
+int MPIU_Wtime_init(void)
+{
+    LARGE_INTEGER n;
+    QueryPerformanceFrequency(&n);
+    MPIU_Seconds_per_tick = 1.0 / (double) n.QuadPart;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+{
+    *val = (double) t->QuadPart * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    LARGE_INTEGER n;
+    n.QuadPart = t2->QuadPart - t1->QuadPart;
+    *diff = (double) n.QuadPart * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+{
+    t3->QuadPart += ((t2->QuadPart) - (t1->QuadPart));
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_query_performance_counter.h b/src/util/timers/mpiu_timer_query_performance_counter.h
new file mode 100644
index 0000000..482ad0a
--- /dev/null
+++ b/src/util/timers/mpiu_timer_query_performance_counter.h
@@ -0,0 +1,22 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_QUERY_PERFORMANCE_COUNTER_H_INCLUDED
+#define MPIU_TIMER_QUERY_PERFORMANCE_COUNTER_H_INCLUDED
+
+#include <winsock2.h>
+#include <windows.h>
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    QueryPerformanceCounter(timeval);
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+extern double MPIU_Seconds_per_tick;
+
+#endif
diff --git a/src/util/timers/mpiu_timer_win86_cycle.c b/src/util/timers/mpiu_timer_win86_cycle.c
new file mode 100644
index 0000000..3a7a3a6
--- /dev/null
+++ b/src/util/timers/mpiu_timer_win86_cycle.c
@@ -0,0 +1,66 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiu_timer.h"
+
+MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
+
+#if (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE)
+
+double MPIU_Seconds_per_tick = 0.0;
+int MPIU_Wtick(double *wtick)
+{
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *d)
+{
+    *d = (double) (__int64) * t * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+{
+    *diff = (double) ((__int64) (*t2 - *t1)) * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+int MPIU_Wtime_init(void)
+{
+    MPIU_Time_t t1, t2;
+    DWORD s1, s2;
+    double d;
+    int i;
+
+    MPIU_Wtime(&t1);
+    MPIU_Wtime(&t1);
+
+    /* time an interval using both timers */
+    s1 = GetTickCount();
+    MPIU_Wtime(&t1);
+    /*Sleep(250); *//* Sleep causes power saving cpu's to stop which stops the counter */
+    while (GetTickCount() - s1 < 200) {
+        for (i = 2; i < 1000; i++)
+            d = (double) i / (double) (i - 1);
+    }
+    s2 = GetTickCount();
+    MPIU_Wtime(&t2);
+
+    /* calculate the frequency of the assembly cycle counter */
+    MPIU_Seconds_per_tick = ((double) (s2 - s1) / 1000.0) / (double) ((__int64) (t2 - t1));
+    /*
+     * printf("t2-t1 %10d\nsystime diff %d\nfrequency %g\n CPU MHz %g\n",
+     * (int)(t2-t1), (int)(s2 - s1), MPIU_Seconds_per_tick, MPIU_Seconds_per_tick * 1.0e6);
+     */
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+#endif
diff --git a/src/util/timers/mpiu_timer_win86_cycle.h b/src/util/timers/mpiu_timer_win86_cycle.h
new file mode 100644
index 0000000..d7d0988
--- /dev/null
+++ b/src/util/timers/mpiu_timer_win86_cycle.h
@@ -0,0 +1,27 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIU_TIMER_WIN86_CYCLE_H_INCLUDED
+#define MPIU_TIMER_WIN86_CYCLE_H_INCLUDED
+
+#include <winsock2.h>
+#include <windows.h>
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    register int *f1 = (int*)var_ptr;
+    __asm cpuid;
+    __asm rdtsc;
+    __asm mov ecx, f1;
+    __asm mov [ecx], eax;
+    __asm mov [ecx + TYPE int], edx;
+
+    return MPIU_TIMER_SUCCESS;
+}
+
+extern double MPIU_Seconds_per_tick;
+
+#endif

http://git.mpich.org/mpich.git/commitdiff/59f54e37435a6512721cd618a907c2eee9678fbb

commit 59f54e37435a6512721cd618a907c2eee9678fbb
Author: Pavan Balaji <balaji at anl.gov>
Date:   Mon Jan 4 20:45:40 2016 -0600

    timers: added function pointers for the device model.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/configure.ac b/configure.ac
index 04aef75..681246a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4721,7 +4721,7 @@ AC_SUBST(MPICH_TIMER_TYPE)
 
 # If the device specified a timer type, use that by default.  Else,
 # try to detect a type that works on this system.
-if test -n "$MPID_DEVICE_TIMER_TYPE" ; then
+if test -n "$MPID_DEVICE_DEFINES_TIMER" ; then
    default_timer_type=device
 else
    default_timer_type=
@@ -5001,10 +5001,7 @@ pac_cv_ia64_cycle,[
 
     device)
     # The device selected should export the datatype for the timer
-    # in MPID_DEVICE_TIMER_TYPE if something other than long is needed
-    if test -n "$MPID_DEVICE_TIMER_TYPE" ; then
-       MPICH_TIMER_TYPE=$MPID_DEVICE_TIMER_TYPE
-    fi
+    MPICH_TIMER_TYPE="void *"
     ;;
 
     *)
@@ -5198,16 +5195,6 @@ BSEND_OVERHEAD=$ac_cv_sizeof_MPIR_Bsend_data_t
 export BSEND_OVERHEAD
 AC_SUBST(BSEND_OVERHEAD)
 
-#
-# See if we need to update the timer type (which was converted to uppercase)
-if test "$timer_type" = "DEVICE" ; then
-    # The device selected should export the datatype for the timer
-    # in MPID_DEVICE_TIMER_TYPE if something other than long is needed
-    if test -n "$MPID_DEVICE_TIMER_TYPE" ; then 
-       MPICH_TIMER_TYPE=$MPID_DEVICE_TIMER_TYPE
-    fi
-fi
-
 dnl Configure any subdirectories.  Note that config.status will *not* 
 dnl reexecute these!
 dnl 
diff --git a/src/mpid/pamid/include/mpidpre.h b/src/mpid/pamid/include/mpidpre.h
index cec81d3..27765c2 100644
--- a/src/mpid/pamid/include/mpidpre.h
+++ b/src/mpid/pamid/include/mpidpre.h
@@ -57,6 +57,15 @@
 #define MPID_TIMER_SUCCESS              MPIU_TIMER_SUCCESS
 #define MPID_TIMER_ERR_NOT_INITIALIZED  MPIU_TIMER_ERR_NOT_INITIALIZED
 
+typedef double MPID_Time_t;
+
+int MPID_Wtime(MPID_Time_t *tval);
+int MPID_Wtick(double *wtick);
+int MPID_Wtime_diff(MPID_Time_t *t1, MPID_Time_t *t2, double *diff);
+int MPID_Wtime_todouble(MPID_Time_t *t, double *val);
+int MPID_Wtime_acc(MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3);
+int MPID_Wtime_init(void);
+
 #include "mpidi_platform.h"
 
 #include "mpidi_constants.h"
diff --git a/src/mpid/pamid/src/mpid_time.c b/src/mpid/pamid/src/mpid_time.c
index e65ffff..e714dec 100644
--- a/src/mpid/pamid/src/mpid_time.c
+++ b/src/mpid/pamid/src/mpid_time.c
@@ -29,54 +29,89 @@
 
 int MPIDI_PAMID_Timer_is_ready = 0;
 
-int MPID_Wtime( MPID_Time_t *tval )
+static int wtime(MPIU_Time_t *tval)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
-        *tval = PAMI_Wtime(MPIDI_Client);
+        *((MPID_Time_t *) tval) = PAMI_Wtime(MPIDI_Client);
         return MPID_TIMER_SUCCESS;
     }
     else
         return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-int MPID_Wtick(double *wtick)
+
+int MPID_Wtime(MPID_Time_t *tval)
+{
+    return wtime((MPIU_Time_t *) tval);
+}
+
+static int wtick(double *wtick)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
-        *wtick = PAMIX_Client_query(MPIDI_Client, PAMI_CLIENT_WTICK).value.doubleval;
+        *((double *) wtick) = PAMIX_Client_query(MPIDI_Client, PAMI_CLIENT_WTICK).value.doubleval;
         return MPID_TIMER_SUCCESS;
     }
     else
         return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-int MPID_Wtime_diff( MPID_Time_t *t1, MPID_Time_t *t2, double *diff )
+
+int MPID_Wtick(double *tick)
+{
+    return wtick((MPIU_Time_t *) tick);
+}
+
+static int wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
-        *diff = *t2 - *t1;
+        *diff = *((MPID_Time_t *) t2) - *((MPID_Time_t *) t1);
         return MPID_TIMER_SUCCESS;
     }
     else
         return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-int MPID_Wtime_todouble( MPID_Time_t *t, double *val )
+
+int MPID_Wtime_diff(MPID_Time_t *t1, MPID_Time_t *t2, double *diff)
+{
+    return wtime_diff((MPIU_Time_t *) t1, (MPIU_Time_t *) t2, diff);
+}
+
+static int wtime_todouble(MPIU_Time_t *t, double *val)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
-        *val = *t;
+        *val = *((MPID_Time_t *) t);
         return MPID_TIMER_SUCCESS;
     }
     else
         return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-int MPID_Wtime_acc( MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3 )
+
+int MPID_Wtime_todouble(MPID_Time_t *t, double *val)
+{
+    return wtime_todouble((MPIU_Time_t *) t, val);
+}
+
+static int wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
 {
     if (MPIDI_PAMID_Timer_is_ready) {
-        *t3 += *t1 - *t2;
+        *((MPID_Time_t *) t3) += *((MPID_Time_t *) t1) - *((MPID_Time_t *) t2);
         return MPID_TIMER_SUCCESS;
     }
     else
         return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
 
+int MPID_Wtime_acc(MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3)
+{
+    return wtime_acc((MPIU_Time_t *) t1, (MPIU_Time_t *) t2, (MPIU_Time_t *) t3);
+}
+
 int MPID_Wtime_init( void )
 {
+    MPIU_Wtime_fn = wtime;
+    MPIU_Wtick_fn = wtick;
+    MPIU_Wtime_diff_fn = wtime_diff;
+    MPIU_Wtime_todouble_fn = wtime_todouble;
+    MPIU_Wtime_acc_fn = wtime_acc;
+
     return MPID_TIMER_SUCCESS;
 }
 
diff --git a/src/mpid/pamid/subconfigure.m4 b/src/mpid/pamid/subconfigure.m4
index f67f86e..93bbe4f 100644
--- a/src/mpid/pamid/subconfigure.m4
+++ b/src/mpid/pamid/subconfigure.m4
@@ -62,7 +62,7 @@ elif test "${pamid_platform}" = "BGQ" ; then
   MPID_DEFAULT_PM=no
 fi
 
-MPID_DEVICE_TIMER_TYPE=double
+MPID_DEVICE_DEFINES_TIMER
 MPID_MAX_THREAD_LEVEL=MPI_THREAD_MULTIPLE
 
 dnl the PAMID device depends on the common NBC scheduler code
diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
index ee5abe2..afaf1db 100644
--- a/src/util/timers/mpiu_timer.c
+++ b/src/util/timers/mpiu_timer.c
@@ -474,4 +474,47 @@ int MPIU_Wtick(double *wtick)
     return MPIU_TIMER_SUCCESS;
 }
 
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
+
+int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval) = NULL;
+int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff) = NULL;
+int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3) = NULL;
+int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds) = NULL;
+int (*MPIU_Wtick_fn)(double *tick) = NULL;
+
+int MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    if (MPIU_Wtime_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_fn(timeval);
+}
+
+int MPIU_Wtime_diff(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff)
+{
+    if (MPIU_Wtime_diff_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_diff_fn(t1, t2, diff);
+}
+
+int MPIU_Wtime_todouble(MPIU_Time_t *t, double *val)
+{
+    if (MPIU_Wtime_todouble_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_todouble_fn(t, val);
+}
+
+int MPIU_Wtime_acc(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3)
+{
+    if (MPIU_Wtime_acc_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtime_acc_fn(t1, t2, t3);
+}
+
+int MPIU_Wtick(double *wtick)
+{
+    if (MPIU_Wtick_fn == NULL)
+        return MPIU_TIMER_ERR_NOT_INITIALIZED;
+    return MPIU_Wtick_fn(wtick);
+}
+
 #endif
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index abfb5d1..688ea21 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -64,9 +64,6 @@ int usleep(useconds_t usec);
 #include <windows.h>
 #endif
 
-/* Define a time stamp */
-typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
-
 /* The timer code is allowed to return "NOT_INITIALIZED" before the
  * device is initialized.  Once the device is initialized, it must
  * always return SUCCESS, so the upper layers do not need to check for
@@ -75,6 +72,32 @@ typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
 #define MPIU_TIMER_ERR_NOT_INITIALIZED    1
 
 /*
+ * If the timer capability is provided by the device, it would need to
+ * expose it in two ways:
+ *
+ *    1. It would expose it through the MPID_ functionality.  This
+ *       model would be used by the MPICH internal code, and would
+ *       give fast access to the timers.
+ *
+ *    2. It would expose it through the MPIU_Timer_ function pointers.
+ *       This model would be used by "external" code segments (such as
+ *       MPIU) which do not have direct access to the MPICH devices.
+ *       This model might be slightly slower, but would give the same
+ *       functionality.
+ */
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__DEVICE
+typedef void * MPIU_Time_t;
+extern int (*MPIU_Wtime_fn)(MPIU_Time_t *timeval);
+extern int (*MPIU_Wtime_diff_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff);
+extern int (*MPIU_Wtime_acc_fn)(MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3);
+extern int (*MPIU_Wtime_todouble_fn)(MPIU_Time_t *timeval, double *seconds);
+extern int (*MPIU_Wtick_fn)(double *tick);
+#else
+/* Define a time stamp */
+typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
+#endif
+
+/*
  * Prototypes.  These are defined here so that inlined timer calls can
  * use them, as well as any profiling and timing code that is built into
  * MPICH

http://git.mpich.org/mpich.git/commitdiff/9057dd75ef0690642b4b6704130fa6c2c2d7e216

commit 9057dd75ef0690642b4b6704130fa6c2c2d7e216
Author: Pavan Balaji <balaji at anl.gov>
Date:   Mon Jan 4 19:43:24 2016 -0600

    timers: update timer code to return errors.
    
    Allow the timer code to return errors if they are not yet initialized.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/timer/wtick.c b/src/mpi/timer/wtick.c
index 1aff3c2..b3f056c 100644
--- a/src/mpi/timer/wtick.c
+++ b/src/mpi/timer/wtick.c
@@ -49,7 +49,7 @@ double MPI_Wtick( void )
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WTICK);
-    tick = MPID_Wtick();
+    MPID_Wtick(&tick);
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WTICK);
 
     return tick;
diff --git a/src/mpid/pamid/include/mpidimpl.h b/src/mpid/pamid/include/mpidimpl.h
index 3e131e4..65a88dd 100644
--- a/src/mpid/pamid/include/mpidimpl.h
+++ b/src/mpid/pamid/include/mpidimpl.h
@@ -28,7 +28,7 @@
 #include "pamix.h"
 #include <mpix.h>
 
-
+extern int MPIDI_PAMID_Timer_is_ready;
 
 static inline void MPIDI_coll_check_in_place(void* src, void** dst)
 {
diff --git a/src/mpid/pamid/include/mpidpre.h b/src/mpid/pamid/include/mpidpre.h
index 25e1bab..cec81d3 100644
--- a/src/mpid/pamid/include/mpidpre.h
+++ b/src/mpid/pamid/include/mpidpre.h
@@ -50,6 +50,12 @@
 #define MPID_assert(x)        assert(x) /**< \brief Tests for likely problems--may not be active in performance code */
 #endif
 
+/* The timer code is allowed to return "NOT_INITIALIZED" before the
+ * device is initialized.  Once the device is initialized, it must
+ * always return SUCCESS, so the upper layers do not need to check for
+ * the return code.  */
+#define MPID_TIMER_SUCCESS              MPIU_TIMER_SUCCESS
+#define MPID_TIMER_ERR_NOT_INITIALIZED  MPIU_TIMER_ERR_NOT_INITIALIZED
 
 #include "mpidi_platform.h"
 
diff --git a/src/mpid/pamid/src/mpid_init.c b/src/mpid/pamid/src/mpid_init.c
index 1ea26bb..743c66c 100644
--- a/src/mpid/pamid/src/mpid_init.c
+++ b/src/mpid/pamid/src/mpid_init.c
@@ -1382,8 +1382,7 @@ int MPID_Init(int * argc,
   /* ------------------------------- */
   /* Initialize timer data           */
   /* ------------------------------- */
-  MPID_Wtime_init();
-
+  MPIDI_PAMID_Timer_is_ready = 1;
 
   /* ------------------------------- */
   /* ???                             */
diff --git a/src/mpid/pamid/src/mpid_time.c b/src/mpid/pamid/src/mpid_time.c
index ef9dd10..e65ffff 100644
--- a/src/mpid/pamid/src/mpid_time.c
+++ b/src/mpid/pamid/src/mpid_time.c
@@ -27,36 +27,57 @@
 #error "Not using DEVICE TIMEBASE"
 #else
 
+int MPIDI_PAMID_Timer_is_ready = 0;
 
-void MPID_Wtime( MPID_Time_t *tval )
+int MPID_Wtime( MPID_Time_t *tval )
 {
-  *tval = PAMI_Wtime(MPIDI_Client);
+    if (MPIDI_PAMID_Timer_is_ready) {
+        *tval = PAMI_Wtime(MPIDI_Client);
+        return MPID_TIMER_SUCCESS;
+    }
+    else
+        return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-double MPID_Wtick()
+int MPID_Wtick(double *wtick)
 {
-  return PAMIX_Client_query(MPIDI_Client, PAMI_CLIENT_WTICK).value.doubleval;
+    if (MPIDI_PAMID_Timer_is_ready) {
+        *wtick = PAMIX_Client_query(MPIDI_Client, PAMI_CLIENT_WTICK).value.doubleval;
+        return MPID_TIMER_SUCCESS;
+    }
+    else
+        return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-void MPID_Wtime_diff( MPID_Time_t *t1, MPID_Time_t *t2, double *diff )
+int MPID_Wtime_diff( MPID_Time_t *t1, MPID_Time_t *t2, double *diff )
 {
-  *diff = *t2 - *t1;
+    if (MPIDI_PAMID_Timer_is_ready) {
+        *diff = *t2 - *t1;
+        return MPID_TIMER_SUCCESS;
+    }
+    else
+        return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-void MPID_Wtime_todouble( MPID_Time_t *t, double *val )
+int MPID_Wtime_todouble( MPID_Time_t *t, double *val )
 {
-  *val = *t;
+    if (MPIDI_PAMID_Timer_is_ready) {
+        *val = *t;
+        return MPID_TIMER_SUCCESS;
+    }
+    else
+        return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-void MPID_Wtime_acc( MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3 )
+int MPID_Wtime_acc( MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3 )
 {
-  *t3 += *t1 - *t2;
+    if (MPIDI_PAMID_Timer_is_ready) {
+        *t3 += *t1 - *t2;
+        return MPID_TIMER_SUCCESS;
+    }
+    else
+        return MPID_TIMER_ERR_NOT_INITIALIZED;
 }
-/*
-  Return Values:
-  0 on success.  -1 on Failure.  1 means that the timer may not be used
-  until after MPID_Init completes.  This allows the device to set up the
-  timer (first needed for Blue Gene support).
-*/
+
 int MPID_Wtime_init( void )
 {
-  return 1;
+    return MPID_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
index ffe490d..ee5abe2 100644
--- a/src/util/timers/mpiu_timer.c
+++ b/src/util/timers/mpiu_timer.c
@@ -53,56 +53,72 @@ static void init_wtick(void)
  * supports an 8 byte long long.  We can also cast hrtime_t to long long
  * if long long is available and 8 bytes.
  */
-void MPIU_Wtime(MPIU_Time_t * timeval)
+int MPIU_Wtime(MPIU_Time_t * timeval)
 {
     *timeval = gethrtime();
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = 1.0e-9 * (double) (*t2 - *t1);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     *val = 1.0e-9 * (*t);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     *t3 += ((*t2) - (*t1));
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
     /* According to the documentation, ticks should be in nanoseconds.  This
      * is untested */
-    return 1.0e-9;
+    *wtick = 1.0e-9;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_init(void)
 {
-    return 0;
+    return MPIU_TIMER_SUCCESS;
 }
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
-void MPIU_Wtime(MPIU_Time_t * timeval)
+int MPIU_Wtime(MPIU_Time_t * timeval)
 {
     /* POSIX timer (14.2.1, page 311) */
     clock_gettime(CLOCK_REALTIME, timeval);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = ((double) (t2->tv_sec - t1->tv_sec) + 1.0e-9 * (double) (t2->tv_nsec - t1->tv_nsec));
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     *val = ((double) t->tv_sec + 1.0e-9 * (double) t->tv_nsec);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     int nsec, sec;
 
@@ -115,9 +131,11 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
         t3->tv_nsec -= 1000000000;
         t3->tv_sec++;
     }
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
     struct timespec res;
     int rc;
@@ -125,17 +143,20 @@ double MPIU_Wtick(void)
     rc = clock_getres(CLOCK_REALTIME, &res);
     if (!rc)
         /* May return -1 for unimplemented ! */
-        return res.tv_sec + 1.0e-9 * res.tv_nsec;
+        *wtick = res.tv_sec + 1.0e-9 * res.tv_nsec;
 
     /* Sigh.  If not implemented (POSIX allows that),
      * then we need to return the generic tick value */
-    return tickval;
+    *wtick = tickval;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_init(void)
 {
     init_wtick();
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 
@@ -146,22 +167,28 @@ int MPIU_Wtime_init(void)
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-void MPIU_Wtime(MPIU_Time_t * tval)
+int MPIU_Wtime(MPIU_Time_t * tval)
 {
     gettimeofday(tval, NULL);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = ((double) (t2->tv_sec - t1->tv_sec) + .000001 * (double) (t2->tv_usec - t1->tv_usec));
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     *val = (double) t->tv_sec + .000001 * (double) t->tv_usec;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     int usec, sec;
 
@@ -174,26 +201,33 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
         t3->tv_usec -= 1000000;
         t3->tv_sec++;
     }
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
-    return tickval;
+    *wtick = tickval;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_init(void)
 {
     init_wtick();
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
 #include <sys/time.h>
 double MPIU_Seconds_per_tick = 0.0;
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
-    return MPIU_Seconds_per_tick;
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_init(void)
@@ -212,35 +246,44 @@ int MPIU_Wtime_init(void)
     td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
 
     MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 /* Time stamps created by a macro */
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     /* This returns the number of cycles as the "time".  This isn't correct
      * for implementing MPI_Wtime, but it does allow us to insert cycle
      * counters into test programs */
     *val = (double) *t * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     *t3 += (*t2 - *t1);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
 #include <sys/time.h>
 double MPIU_Seconds_per_tick = 0.0;
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
-    return MPIU_Seconds_per_tick;
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_init(void)
@@ -259,43 +302,56 @@ int MPIU_Wtime_init(void)
     td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0;
 
     MPIU_Seconds_per_tick = (td2 - td1) / (double) (t2 - t1);
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 /* Time stamps created by a macro */
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = (double) (*t2 - *t1) * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     /* This returns the number of cycles as the "time".  This isn't correct
      * for implementing MPI_Wtime, but it does allow us to insert cycle
      * counters into test programs */
     *val = (double) *t * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     *t3 += (*t2 - *t1);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 #elif (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE)
 double MPIU_Seconds_per_tick = 0.0;
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
-    return MPIU_Seconds_per_tick;
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *d)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *d)
 {
     *d = (double) (__int64) * t * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = (double) ((__int64) (*t2 - *t1)) * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 int MPIU_Wtime_init(void)
@@ -325,7 +381,8 @@ int MPIU_Wtime_init(void)
      * printf("t2-t1 %10d\nsystime diff %d\nfrequency %g\n CPU MHz %g\n",
      * (int)(t2-t1), (int)(s2 - s1), MPIU_Seconds_per_tick, MPIU_Seconds_per_tick * 1.0e6);
      */
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
 double MPIU_Seconds_per_tick = 0.0;     /* High performance counter frequency */
@@ -334,29 +391,38 @@ int MPIU_Wtime_init(void)
     LARGE_INTEGER n;
     QueryPerformanceFrequency(&n);
     MPIU_Seconds_per_tick = 1.0 / (double) n.QuadPart;
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
-    return MPIU_Seconds_per_tick;
+    *wtick = MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     *val = (double) t->QuadPart * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     LARGE_INTEGER n;
     n.QuadPart = t2->QuadPart - t1->QuadPart;
     *diff = (double) n.QuadPart * MPIU_Seconds_per_tick;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     t3->QuadPart += ((t2->QuadPart) - (t1->QuadPart));
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 
@@ -369,32 +435,43 @@ int MPIU_Wtime_init(void)
     mach_timebase_info(&info);
     MPIR_Wtime_mult = 1.0e-9 * ((double) info.numer / (double) info.denom);
     init_wtick();
-    return 0;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime(MPIU_Time_t * timeval)
+int MPIU_Wtime(MPIU_Time_t * timeval)
 {
     *timeval = mach_absolute_time();
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
+int MPIU_Wtime_diff(MPIU_Time_t * t1, MPIU_Time_t * t2, double *diff)
 {
     *diff = (*t2 - *t1) * MPIR_Wtime_mult;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
+int MPIU_Wtime_todouble(MPIU_Time_t * t, double *val)
 {
     *val = *t * MPIR_Wtime_mult;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
+int MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 {
     *t3 += *t2 - *t1;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
-double MPIU_Wtick(void)
+int MPIU_Wtick(double *wtick)
 {
-    return tickval;
+    *wtick = tickval;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 #endif
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index e92e000..abfb5d1 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -67,6 +67,13 @@ int usleep(useconds_t usec);
 /* Define a time stamp */
 typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
 
+/* The timer code is allowed to return "NOT_INITIALIZED" before the
+ * device is initialized.  Once the device is initialized, it must
+ * always return SUCCESS, so the upper layers do not need to check for
+ * the return code.  */
+#define MPIU_TIMER_SUCCESS                0
+#define MPIU_TIMER_ERR_NOT_INITIALIZED    1
+
 /*
  * Prototypes.  These are defined here so that inlined timer calls can
  * use them, as well as any profiling and timing code that is built into
@@ -95,7 +102,7 @@ typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
   Module:
   Timer
   @*/
-void MPIU_Wtime_diff( MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff );
+int MPIU_Wtime_diff( MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff );
 
 /*@
   MPIU_Wtime_acc - Accumulate time values
@@ -117,7 +124,7 @@ void MPIU_Wtime_diff( MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff );
   Module:
   Timer
   @*/
-void MPIU_Wtime_acc( MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3 );
+int MPIU_Wtime_acc( MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3 );
 
 /*@
   MPIU_Wtime_todouble - Converts a timestamp to a double
@@ -133,7 +140,7 @@ void MPIU_Wtime_acc( MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3 );
   suitable for 'MPI_Wtime'.
 
   @*/
-void MPIU_Wtime_todouble( MPIU_Time_t *timeval, double *seconds );
+int MPIU_Wtime_todouble( MPIU_Time_t *timeval, double *seconds );
 
 /*@
   MPIU_Wtick - Provide the resolution of the 'MPIU_Wtime' timer
@@ -151,7 +158,7 @@ void MPIU_Wtime_todouble( MPIU_Time_t *timeval, double *seconds );
   Module:
   Timer
   @*/
-double MPIU_Wtick( void );
+int MPIU_Wtick(double *);
 
 /*@
   MPIU_Wtime_init - Initialize the timer
@@ -166,11 +173,6 @@ double MPIU_Wtick( void );
   'MPI_Finalize' this routine should register a handler with 'MPI_Finalize'
   (see the MPICH Design Document).
 
-  Return Values:
-  0 on success.  -1 on Failure.  1 means that the timer may not be used
-  until after MPIU_Init completes.  This allows the device to set up the
-  timer (first needed for Blue Gene support).
-
   Module:
   Timer
 
@@ -188,7 +190,7 @@ int MPIU_Wtime_init(void);
 
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
 
-static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+static inline int MPIU_Wtime(MPIU_Time_t *timeval)
 {
 /* The rdtsc instruction is not a "serializing" instruction, so the
    processor is free to reorder it.  In order to get more accurate
@@ -218,6 +220,8 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
 #else
 #error Dont know which Linux timer to use
 #endif
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 extern double MPIU_Seconds_per_tick;
@@ -236,6 +240,8 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
 #endif
 
     *timeval = t_val;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 extern double MPIU_Seconds_per_tick;
@@ -245,6 +251,8 @@ extern double MPIU_Seconds_per_tick;
 static inline void MPIU_Wtime(MPIU_Time_t *timeval)
 {
     QueryPerformanceCounter(timeval);
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 extern double MPIU_Seconds_per_tick;
@@ -259,6 +267,8 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
     __asm mov ecx, f1;
     __asm mov [ecx], eax;
     __asm mov [ecx + TYPE int], edx;
+
+    return MPIU_TIMER_SUCCESS;
 }
 
 extern double MPIU_Seconds_per_tick;
@@ -299,7 +309,7 @@ extern double MPIU_Seconds_per_tick;
   MPI-2 allows 'MPI_Wtime' to be a macro.  We should make that easy; this
   version does not accomplish that.
   @*/
-void MPIU_Wtime(MPIU_Time_t * timeval);
+int MPIU_Wtime(MPIU_Time_t * timeval);
 
 #endif
 

http://git.mpich.org/mpich.git/commitdiff/d195e8fed40d68dbe5162ad4add4e986b508ab0e

commit d195e8fed40d68dbe5162ad4add4e986b508ab0e
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Jan 5 02:14:57 2016 -0600

    timers: define the MPIU_Wtime prototype if there is no static code.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 31652a3..e92e000 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -73,42 +73,6 @@ typedef @MPICH_TIMER_TYPE@ MPIU_Time_t;
  * MPICH
  */
 /*@
-  MPIU_Wtime - Return a time stamp
-
-  Output Parameter:
-. timeval - A pointer to an 'MPIU_Wtime_t' variable.
-
-  Notes:
-  This routine returns an `opaque` time value.  This difference between two
-  time values returned by 'MPIU_Wtime' can be converted into an elapsed time
-  in seconds with the routine 'MPIU_Wtime_diff'.
-
-  This routine is defined this way to simplify its implementation as a macro.
-  For example, the for Intel x86 and gcc,
-.vb
-#define MPIU_Wtime(timeval) \
-     __asm__ __volatile__("rdtsc" : "=A" (*timeval))
-.ve
-
-  For some purposes, it is important
-  that the timer calls change the timing of the code as little as possible.
-  This form of a timer routine provides for a very fast timer that has
-  minimal impact on the rest of the code.
-
-  From a semantic standpoint, this format emphasizes that any particular
-  timer value has no meaning; only the difference between two values is
-  meaningful.
-
-  Module:
-  Timer
-
-  Question:
-  MPI-2 allows 'MPI_Wtime' to be a macro.  We should make that easy; this
-  version does not accomplish that.
-  @*/
-void MPIU_Wtime( MPIU_Time_t * timeval);
-
-/*@
   MPIU_Wtime_diff - Compute the difference between two time stamps
 
   Input Parameters:
@@ -299,6 +263,44 @@ static inline void MPIU_Wtime(MPIU_Time_t *timeval)
 
 extern double MPIU_Seconds_per_tick;
 
+#else
+
+/*@
+  MPIU_Wtime - Return a time stamp
+
+  Output Parameter:
+. timeval - A pointer to an 'MPIU_Wtime_t' variable.
+
+  Notes:
+  This routine returns an `opaque` time value.  This difference between two
+  time values returned by 'MPIU_Wtime' can be converted into an elapsed time
+  in seconds with the routine 'MPIU_Wtime_diff'.
+
+  This routine is defined this way to simplify its implementation as a macro.
+  For example, the for Intel x86 and gcc,
+.vb
+#define MPIU_Wtime(timeval) \
+     __asm__ __volatile__("rdtsc" : "=A" (*timeval))
+.ve
+
+  For some purposes, it is important
+  that the timer calls change the timing of the code as little as possible.
+  This form of a timer routine provides for a very fast timer that has
+  minimal impact on the rest of the code.
+
+  From a semantic standpoint, this format emphasizes that any particular
+  timer value has no meaning; only the difference between two values is
+  meaningful.
+
+  Module:
+  Timer
+
+  Question:
+  MPI-2 allows 'MPI_Wtime' to be a macro.  We should make that easy; this
+  version does not accomplish that.
+  @*/
+void MPIU_Wtime(MPIU_Time_t * timeval);
+
 #endif
 
 #endif

http://git.mpich.org/mpich.git/commitdiff/64d8f81d254382cbf7842b040854009066dee268

commit 64d8f81d254382cbf7842b040854009066dee268
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Jan 5 02:13:54 2016 -0600

    timers: change macros to static inline.
    
    static inlines behave the same way as macros, but with the added
    advantage that they can return a value, unlike macros.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 17f06f0..31652a3 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -223,6 +223,9 @@ int MPIU_Wtime_init(void);
  */
 
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
 /* The rdtsc instruction is not a "serializing" instruction, so the
    processor is free to reorder it.  In order to get more accurate
    timing numbers with rdtsc, we need to put a serializing
@@ -230,54 +233,70 @@ int MPIU_Wtime_init(void);
    the rdtscp instruction which is synchronizing, we use this when we
    can. */
 #ifdef LINUX86_CYCLE_RDTSCP
-#define MPIU_Wtime(var_ptr) \
-    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx")
+    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*timeval) : : "ecx", "rdx");
+
 #elif defined(LINUX86_CYCLE_CPUID_RDTSC64)
 /* Here we have to save the rbx register for when the compiler is
    generating position independent code (e.g., when it's generating
    shared libraries) */
-#define MPIU_Wtime(var_ptr)                                                                     \
-     __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx" : "=A" (*var_ptr) : : "ecx")
+    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx" : "=A" (*timeval) : : "ecx");
+
 #elif defined(LINUX86_CYCLE_CPUID_RDTSC32)
 /* Here we have to save the ebx register for when the compiler is
    generating position independent code (e.g., when it's generating
    shared libraries) */
-#define MPIU_Wtime(var_ptr)                                                                     \
-     __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx")
+    __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*timeval) : : "ecx");
+
 #elif defined(LINUX86_CYCLE_RDTSC)
 /* The configure test using cpuid must have failed, try just rdtsc by itself */
-#define MPIU_Wtime(var_ptr) __asm__ __volatile__("rdtsc" : "=A" (*var_ptr))
+    __asm__ __volatile__("rdtsc" : "=A" (*timeval));
+
 #else
 #error Dont know which Linux timer to use
 #endif
+}
 
 extern double MPIU_Seconds_per_tick;
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    MPIU_Time_t t_val;
+
 #ifdef __INTEL_COMPILER
 #include "ia64regs.h"
-#define MPIU_Wtime(var_ptr) { MPIU_Time_t t_val;\
-	t_val=__getReg(_IA64_REG_AR_ITC); *var_ptr=t_val;}
+    t_val = __getReg(_IA64_REG_AR_ITC);
 #else
-#define MPIU_Wtime(var_ptr) { MPIU_Time_t t_val;\
-	__asm__ __volatile__("mov %0=ar.itc" : "=r" (t_val)); *var_ptr=t_val;}
+    __asm__ __volatile__("mov %0=ar.itc" : "=r" (t_val));
 #endif
+
+    *timeval = t_val;
+}
+
 extern double MPIU_Seconds_per_tick;
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
-#define MPIU_Wtime(var) QueryPerformanceCounter(var)
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    QueryPerformanceCounter(timeval);
+}
+
 extern double MPIU_Seconds_per_tick;
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE
-#define MPIU_Wtime(var_ptr) \
-{ \
-    register int *f1 = (int*)var_ptr; \
-    __asm cpuid \
-    __asm rdtsc \
-    __asm mov ecx, f1 \
-    __asm mov [ecx], eax \
-    __asm mov [ecx + TYPE int], edx \
+
+static inline void MPIU_Wtime(MPIU_Time_t *timeval)
+{
+    register int *f1 = (int*)var_ptr;
+    __asm cpuid;
+    __asm rdtsc;
+    __asm mov ecx, f1;
+    __asm mov [ecx], eax;
+    __asm mov [ecx + TYPE int], edx;
 }
+
 extern double MPIU_Seconds_per_tick;
 
 #endif

http://git.mpich.org/mpich.git/commitdiff/9a6ec66b2cd6c271a45a9c022dddcebb6f37875c

commit 9a6ec66b2cd6c271a45a9c022dddcebb6f37875c
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Jan 5 01:45:34 2016 -0600

    timers: remove unused functionality.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 1b714b3..17f06f0 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -222,24 +222,7 @@ int MPIU_Wtime_init(void);
    MPI_WTIME_IS_GLOBAL is false.
  */
 
-/* MPIUM_Wtime_todouble() is a hack to get a macro version
-   of the todouble function.
-
-   The logging library should save the native MPIU_Timer_t
-   structure to disk and use the todouble function in the
-   post-processsing step to convert the values to doubles.
-   */
-
-#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
-#define MPIUM_Wtime_todouble MPIU_Wtime_todouble
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
-#define MPIUM_Wtime_todouble MPIU_Wtime_todouble
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
-#define MPIUM_Wtime_todouble MPIU_Wtime_todouble
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
 /* The rdtsc instruction is not a "serializing" instruction, so the
    processor is free to reorder it.  In order to get more accurate
    timing numbers with rdtsc, we need to put a serializing
@@ -269,7 +252,6 @@ int MPIU_Wtime_init(void);
 #endif
 
 extern double MPIU_Seconds_per_tick;
-#define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
 #ifdef __INTEL_COMPILER
@@ -281,13 +263,10 @@ extern double MPIU_Seconds_per_tick;
 	__asm__ __volatile__("mov %0=ar.itc" : "=r" (t_val)); *var_ptr=t_val;}
 #endif
 extern double MPIU_Seconds_per_tick;
-#define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
 #define MPIU_Wtime(var) QueryPerformanceCounter(var)
 extern double MPIU_Seconds_per_tick;
-#define MPIUM_Wtime_todouble( t, d ) \
-  *d = (double)t->QuadPart * MPIU_Seconds_per_tick /* convert to seconds */
 
 #elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE
 #define MPIU_Wtime(var_ptr) \
@@ -300,11 +279,6 @@ extern double MPIU_Seconds_per_tick;
     __asm mov [ecx + TYPE int], edx \
 }
 extern double MPIU_Seconds_per_tick;
-#define MPIUM_Wtime_todouble(t, d) *d = (double)(__int64)*t * MPIU_Seconds_per_tick
-#define MPIUM_Wtime_diff(t1,t2,diff) *diff = (double)((__int64)( *t2 - *t1 )) * MPIU_Seconds_per_tick
-
-#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
-#define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
 #endif
 

http://git.mpich.org/mpich.git/commitdiff/58c78800485d40f94c34a88195f130c04f1ee774

commit 58c78800485d40f94c34a88195f130c04f1ee774
Author: Pavan Balaji <balaji at anl.gov>
Date:   Mon Jan 4 19:16:38 2016 -0600

    timers: get rid of duplicate definition.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 63b90e6..1b714b3 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -230,9 +230,6 @@ int MPIU_Wtime_init(void);
    post-processsing step to convert the values to doubles.
    */
 
-/* The timer kind is set using AC_SUBST in the MPICH configure */
-#define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
-
 #if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 

http://git.mpich.org/mpich.git/commitdiff/a37dd821d80ad900b5758e8a01bb86304dceb1b8

commit a37dd821d80ad900b5758e8a01bb86304dceb1b8
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Jan 5 00:10:58 2016 -0600

    timers: pamid used the wrong macro check for timer kind.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpid/pamid/src/mpid_time.c b/src/mpid/pamid/src/mpid_time.c
index db687f4..ef9dd10 100644
--- a/src/mpid/pamid/src/mpid_time.c
+++ b/src/mpid/pamid/src/mpid_time.c
@@ -23,7 +23,7 @@
 
 #if MPICH_TIMER_KIND == USE_GETTIMEOFDAY
 #warning Compiling mpid/pamid/src/mpid_time.c when MPICH_TIMER_KIND == USE_GETTIMEOFDAY
-#elif MPICH_TIMER_KIND != USE_DEVICE
+#elif MPICH_TIMER_KIND != MPIU_TIMER_KIND__DEVICE
 #error "Not using DEVICE TIMEBASE"
 #else
 

http://git.mpich.org/mpich.git/commitdiff/fb8fefd26d516b978c3cfe1e2d3d562a69515c69

commit fb8fefd26d516b978c3cfe1e2d3d562a69515c69
Author: Pavan Balaji <balaji at anl.gov>
Date:   Mon Jan 4 19:05:37 2016 -0600

    timers: cleanup timer kind naming.
    
    Rename timer kinds to cleanly show that they are different timer
    kinds.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/configure.ac b/configure.ac
index 78837f7..04aef75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5014,7 +5014,7 @@ esac
 # Convert timer type to upper case
 timer_type=`echo $timer_type | \
     tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-MPICH_TIMER_KIND=MPIU_$timer_type
+MPICH_TIMER_KIND=MPIU_TIMER_KIND__$timer_type
 AC_SUBST(MPICH_TIMER_KIND)
 # ----------------------------------------------------------------------------
 # End of code for timer support (except for ac_ OUTPUT)
diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
index 1fc59c1..ffe490d 100644
--- a/src/util/timers/mpiu_timer.c
+++ b/src/util/timers/mpiu_timer.c
@@ -38,7 +38,7 @@ static void init_wtick(void)
     }
 }
 
-#if MPICH_TIMER_KIND == MPIU_GETHRTIME
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
 /*
  * MPIU_Time_t is hrtime_t, which under Solaris is defined as a 64bit
  * longlong_t .  However, the Solaris header files will define
@@ -85,7 +85,7 @@ int MPIU_Wtime_init(void)
     return 0;
 }
 
-#elif MPICH_TIMER_KIND == MPIU_CLOCK_GETTIME
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
 void MPIU_Wtime(MPIU_Time_t * timeval)
 {
     /* POSIX timer (14.2.1, page 311) */
@@ -139,7 +139,7 @@ int MPIU_Wtime_init(void)
 }
 
 
-#elif MPICH_TIMER_KIND == MPIU_GETTIMEOFDAY
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -188,7 +188,7 @@ int MPIU_Wtime_init(void)
 }
 
 
-#elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
 #include <sys/time.h>
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
@@ -235,7 +235,7 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 }
 
 
-#elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
 #include <sys/time.h>
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
@@ -281,7 +281,7 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     *t3 += (*t2 - *t1);
 }
 
-#elif (MPICH_TIMER_KIND == MPIU_WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_WIN64_CYCLE)
+#elif (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN64_CYCLE)
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
 {
@@ -327,7 +327,7 @@ int MPIU_Wtime_init(void)
      */
     return 0;
 }
-#elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
 double MPIU_Seconds_per_tick = 0.0;     /* High performance counter frequency */
 int MPIU_Wtime_init(void)
 {
@@ -360,7 +360,7 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 }
 
 
-#elif MPICH_TIMER_KIND == MPIU_MACH_ABSOLUTE_TIME
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
 static double MPIR_Wtime_mult;
 
 int MPIU_Wtime_init(void)
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 2261f02..63b90e6 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -27,39 +27,39 @@ int usleep(useconds_t usec);
  * is needed only to build the function versions of the timers.
  */
 /* Include the appropriate files */
-#define MPIU_GETHRTIME               1
-#define MPIU_CLOCK_GETTIME           2
-#define MPIU_GETTIMEOFDAY            3
-#define MPIU_LINUX86_CYCLE           4
-#define MPIU_QUERYPERFORMANCECOUNTER 6
-#define MPIU_WIN86_CYCLE             7
-#define MPIU_GCC_IA64_CYCLE          8
-/* The value "MPIU_DEVICE" means that the ADI device provides the timer */
-#define MPIU_DEVICE                  9
-#define MPIU_WIN64_CYCLE             10
-#define MPIU_MACH_ABSOLUTE_TIME      11
+#define MPIU_TIMER_KIND__GETHRTIME               1
+#define MPIU_TIMER_KIND__CLOCK_GETTIME           2
+#define MPIU_TIMER_KIND__GETTIMEOFDAY            3
+#define MPIU_TIMER_KIND__LINUX86_CYCLE           4
+#define MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER 6
+#define MPIU_TIMER_KIND__WIN86_CYCLE             7
+#define MPIU_TIMER_KIND__GCC_IA64_CYCLE          8
+/* The value "MPIU_TIMER_KIND__DEVICE" means that the ADI device provides the timer */
+#define MPIU_TIMER_KIND__DEVICE                  9
+#define MPIU_TIMER_KIND__WIN64_CYCLE             10
+#define MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME      11
 #define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
 
-#if MPICH_TIMER_KIND == MPIU_GETHRTIME
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
 #include <sys/time.h>
-#elif MPICH_TIMER_KIND == MPIU_CLOCK_GETTIME
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
 #include <time.h>
 #ifdef NEEDS_SYS_TIME_H
 /* Some OS'es mistakenly require sys/time.h to get the definition of
    CLOCK_REALTIME (POSIX requires the definition to be in time.h) */
 #include <sys/time.h>
 #endif
-#elif MPICH_TIMER_KIND == MPIU_GETTIMEOFDAY
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
 #include <sys/types.h>
 #include <sys/time.h>
-#elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
-#elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
-#elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
 #include <winsock2.h>
 #include <windows.h>
-#elif MPICH_TIMER_KIND == MPIU_MACH_ABSOLUTE_TIME
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
 #include <mach/mach_time.h>
-#elif MPICH_TIMER_KIND == MPIU_WIN86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE
 #include <winsock2.h>
 #include <windows.h>
 #endif
@@ -233,16 +233,16 @@ int MPIU_Wtime_init(void);
 /* The timer kind is set using AC_SUBST in the MPICH configure */
 #define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
 
-#if MPICH_TIMER_KIND == MPIU_GETHRTIME
+#if MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETHRTIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == MPIU_CLOCK_GETTIME
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__CLOCK_GETTIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == MPIU_GETTIMEOFDAY
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GETTIMEOFDAY
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__LINUX86_CYCLE
 /* The rdtsc instruction is not a "serializing" instruction, so the
    processor is free to reorder it.  In order to get more accurate
    timing numbers with rdtsc, we need to put a serializing
@@ -274,7 +274,7 @@ int MPIU_Wtime_init(void);
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__GCC_IA64_CYCLE
 #ifdef __INTEL_COMPILER
 #include "ia64regs.h"
 #define MPIU_Wtime(var_ptr) { MPIU_Time_t t_val;\
@@ -286,13 +286,13 @@ extern double MPIU_Seconds_per_tick;
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__QUERYPERFORMANCECOUNTER
 #define MPIU_Wtime(var) QueryPerformanceCounter(var)
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble( t, d ) \
   *d = (double)t->QuadPart * MPIU_Seconds_per_tick /* convert to seconds */
 
-#elif MPICH_TIMER_KIND == MPIU_WIN86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__WIN86_CYCLE
 #define MPIU_Wtime(var_ptr) \
 { \
     register int *f1 = (int*)var_ptr; \
@@ -306,7 +306,7 @@ extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)(__int64)*t * MPIU_Seconds_per_tick
 #define MPIUM_Wtime_diff(t1,t2,diff) *diff = (double)((__int64)( *t2 - *t1 )) * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == MPIU_MACH_ABSOLUTE_TIME
+#elif MPICH_TIMER_KIND == MPIU_TIMER_KIND__MACH_ABSOLUTE_TIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
 #endif

http://git.mpich.org/mpich.git/commitdiff/844d364c8d4ff0704ba5b765a12e15c3ead84bc3

commit 844d364c8d4ff0704ba5b765a12e15c3ead84bc3
Author: Pavan Balaji <balaji at anl.gov>
Date:   Sun Jan 3 13:10:27 2016 -0600

    timers: fix misleading comment
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 7a5c474..2261f02 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -156,7 +156,7 @@ void MPIU_Wtime_diff( MPIU_Time_t *t1, MPIU_Time_t *t2, double *diff );
 void MPIU_Wtime_acc( MPIU_Time_t *t1, MPIU_Time_t *t2, MPIU_Time_t *t3 );
 
 /*@
-  MPIU_Wtime_todouble - Converts an MPID timestamp to a double
+  MPIU_Wtime_todouble - Converts a timestamp to a double
 
   Input Parameter:
 . timeval - 'MPIU_Time_t' time stamp

http://git.mpich.org/mpich.git/commitdiff/3090f0c6478d2fee42c28762f3fea0992bb93c66

commit 3090f0c6478d2fee42c28762f3fea0992bb93c66
Author: Pavan Balaji <balaji at anl.gov>
Date:   Sun Jan 3 12:15:36 2016 -0600

    timers: linuxalpha_cycle is no longer supported.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/configure.ac b/configure.ac
index ffb233e..78837f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4760,8 +4760,6 @@ AC_ARG_ENABLE(timer-type,
         developers for internal low-level timing.  Normal users should
         not use these as they are not guaranteed to be accurate in
         certain situations.
-
-        linuxalpha_cycle is no longer supported.
 ],timer_type=$enable_timer_type,timer_type=${default_timer_type})
 
 if test -z "$timer_type" ; then 
@@ -4995,10 +4993,6 @@ pac_cv_ia64_cycle,[
      MPICH_TIMER_TYPE="long"
      ;;
 
-    linuxalpha_cycle)
-    AC_MSG_ERROR([linuxalpha_cycle is no longer supported])
-    ;;
-
     mach_absolute_time)
     AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])])
     AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])])
diff --git a/maint/checkbuilds.in b/maint/checkbuilds.in
index ad8ca1b..0793a1c 100644
--- a/maint/checkbuilds.in
+++ b/maint/checkbuilds.in
@@ -50,7 +50,7 @@ $hasDemon   = 0;
 @enable_array = ( 
 		  'error-checking;no;runtime;all', 
 		  'error-messages;all;generic;class;none',
-		  'timer-type;linux86_cycle;gethrtime;clock_gettime;gettimeofday;linuxalpha_cycle',
+		  'timer-type;linux86_cycle;gethrtime;clock_gettime;gettimeofday',
 		  'timing;none;all;runtime;log;log_detailed',
 		  'g;none;all;handle;dbg;log;meminit;handlealloc;instr;mem;mutex;mutexnesting;memarena',
 		  'fast;nochkmsg;notiming;ndebug;all',
diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
index ad4760b..1fc59c1 100644
--- a/src/util/timers/mpiu_timer.c
+++ b/src/util/timers/mpiu_timer.c
@@ -281,11 +281,6 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     *t3 += (*t2 - *t1);
 }
 
-#elif MPICH_TIMER_KIND == MPIU_LINUXALPHA_CYCLE
-/* FIXME: This should have been fixed in the configure, rather than as a
-   make-time error message */
-#error "LinuxAlpha cycle counter not supported"
-
 #elif (MPICH_TIMER_KIND == MPIU_WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_WIN64_CYCLE)
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index 7980e10..7a5c474 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -31,7 +31,6 @@ int usleep(useconds_t usec);
 #define MPIU_CLOCK_GETTIME           2
 #define MPIU_GETTIMEOFDAY            3
 #define MPIU_LINUX86_CYCLE           4
-#define MPIU_LINUXALPHA_CYCLE        5
 #define MPIU_QUERYPERFORMANCECOUNTER 6
 #define MPIU_WIN86_CYCLE             7
 #define MPIU_GCC_IA64_CYCLE          8
@@ -55,7 +54,6 @@ int usleep(useconds_t usec);
 #include <sys/time.h>
 #elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
 #elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
-#elif MPICH_TIMER_KIND == MPIU_LINUXALPHA_CYCLE
 #elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
 #include <winsock2.h>
 #include <windows.h>
@@ -288,9 +286,6 @@ extern double MPIU_Seconds_per_tick;
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == MPIU_LINUXALPHA_CYCLE
-#define MPIUM_Wtime_todouble MPIU_Wtime_todouble
-
 #elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
 #define MPIU_Wtime(var) QueryPerformanceCounter(var)
 extern double MPIU_Seconds_per_tick;

http://git.mpich.org/mpich.git/commitdiff/06dc24dcea1318edabd2f0b25e70604abf3a9a8f

commit 06dc24dcea1318edabd2f0b25e70604abf3a9a8f
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Dec 29 23:27:22 2015 -0600

    MPL: remove fallback MPICH_ environment variables.
    
    These are mostly unused, but we retained them for several years anyway
    for backward compatibility.  It's time to remove them.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpl/src/mem/mpl_trmem.c b/src/mpl/src/mem/mpl_trmem.c
index 0537189..0da22e9 100644
--- a/src/mpl/src/mem/mpl_trmem.c
+++ b/src/mpl/src/mem/mpl_trmem.c
@@ -185,26 +185,6 @@ void MPL_trinit(int rank)
     /* FIXME: We should use generalized parameter handling here
      * to allow use of the command line as well as environment
      * variables */
-    /* these should properly only be "MPL_" parameters, but for backwards
-     * compatibility we also support "MPICH_" parameters. */
-    s = getenv("MPICH_TRMEM_INIT");
-    if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) {
-        TRSetBytes = 1;
-    }
-    s = getenv("MPICH_TRMEM_VALIDATE");
-    if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) {
-        TRdebugLevel = 1;
-    }
-    s = getenv("MPICH_TRMEM_INITZERO");
-    if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) {
-        TRDefaultByte = 0;
-        TRFreedByte = 0;
-    }
-    s = getenv("MPICH_TRMEM_MAX_OVERHEAD");
-    if (s && *s) {
-        long l = atol(s);
-        TRMaxOverhead = (size_t)l;
-    }
     s = getenv("MPL_TRMEM_INIT");
     if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) {
         TRSetBytes = 1;

http://git.mpich.org/mpich.git/commitdiff/43b2945e53fa8fc0d8be487a96164d77a0632660

commit 43b2945e53fa8fc0d8be487a96164d77a0632660
Author: Pavan Balaji <balaji at anl.gov>
Date:   Tue Dec 29 23:28:24 2015 -0600

    MPL: minor code reformatting.
    
    Move static function to the top of the file.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpl/src/mem/mpl_trmem.c b/src/mpl/src/mem/mpl_trmem.c
index 3c9686f..0537189 100644
--- a/src/mpl/src/mem/mpl_trmem.c
+++ b/src/mpl/src/mem/mpl_trmem.c
@@ -150,7 +150,27 @@ static volatile size_t TRMaxMemAllow = 0;
 /* 8 bytes = 16 hex chars + 0x (2 chars) + the null is 19 */
 #define MAX_ADDRESS_CHARS 19
 
-static void addrToHex(void *addr, char string[MAX_ADDRESS_CHARS]);
+static void addrToHex(void *addr, char string[MAX_ADDRESS_CHARS])
+{
+    int i;
+    static char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
+        '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+    };
+    /* The following construction is used to keep compilers from issuing
+     * a warning message about casting a pointer to an integer type */
+    intptr_t iaddr = (intptr_t) ((char *) addr - (char *) 0);
+
+    /* Initial location */
+    i = sizeof(void *) * 2;
+    string[i + 2] = 0;
+    while (i) {
+        string[i + 1] = hex[iaddr & 0xF];
+        iaddr >>= 4;
+        i--;
+    }
+    string[0] = '0';
+    string[1] = 'x';
+}
 
 /*+C
    MPL_trinit - Setup the space package.  Only needed for
@@ -1048,25 +1068,3 @@ void MPL_TrSetMaxMem(size_t size)
 {
     TRMaxMemAllow = size;
 }
-
-static void addrToHex(void *addr, char string[MAX_ADDRESS_CHARS])
-{
-    int i;
-    static char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
-        '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
-    };
-    /* The following construction is used to keep compilers from issuing
-     * a warning message about casting a pointer to an integer type */
-    intptr_t iaddr = (intptr_t) ((char *) addr - (char *) 0);
-
-    /* Initial location */
-    i = sizeof(void *) * 2;
-    string[i + 2] = 0;
-    while (i) {
-        string[i + 1] = hex[iaddr & 0xF];
-        iaddr >>= 4;
-        i--;
-    }
-    string[0] = '0';
-    string[1] = 'x';
-}

http://git.mpich.org/mpich.git/commitdiff/980cf8a0862ce4dc6aa57272e0ad9407ea6b802f

commit 980cf8a0862ce4dc6aa57272e0ad9407ea6b802f
Author: Pavan Balaji <balaji at anl.gov>
Date:   Sun Jan 3 16:08:39 2016 -0600

    MPL: make include file protection consistent.
    
    No reviewer.

diff --git a/src/mpl/include/mpl.h b/src/mpl/include/mpl.h
index f9d5fd0..e9abd7b 100644
--- a/src/mpl/include/mpl.h
+++ b/src/mpl/include/mpl.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_H_INCLUDED
+#if !defined(MPL_H_INCLUDED)
 #define MPL_H_INCLUDED
 
 #include "mpl_base.h"
@@ -18,4 +18,4 @@
 #include "mpl_iov.h"
 #include "mpl_bt.h"
 
-#endif /* MPL_H_INCLUDED */
+#endif /* !defined(MPL_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_base.h b/src/mpl/include/mpl_base.h
index 01859de..5ca0103 100644
--- a/src/mpl/include/mpl_base.h
+++ b/src/mpl/include/mpl_base.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_BASE_H_INCLUDED
+#if !defined(MPL_BASE_H_INCLUDED)
 #define MPL_BASE_H_INCLUDED
 
 /* this file splits off the base functionality in MPL, which does not
@@ -100,4 +100,4 @@
 #define MPL_UNIQUE_IMPL2_(prefix_,line_) MPL_UNIQUE_IMPL3_(prefix_,line_)
 #define MPL_UNIQUE_IMPL3_(prefix_,line_) prefix_##line_
 
-#endif /* MPL_H_INCLUDED */
+#endif /* !defined(MPL_BASE_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_bt.h b/src/mpl/include/mpl_bt.h
index 6c6c6ed..7021067 100644
--- a/src/mpl/include/mpl_bt.h
+++ b/src/mpl/include/mpl_bt.h
@@ -5,7 +5,7 @@
  */
 
 
-#ifndef MPL_BT_H_INCLUDED
+#if !defined(MPL_BT_H_INCLUDED)
 #define MPL_BT_H_INCLUDED
 
 #include "mplconfig.h"
@@ -35,4 +35,4 @@ void MPL_backtrace_show(FILE *output);
 }
 #endif
 
-#endif  /* MPL_BT_H_INCLUDED */
+#endif  /* !defined(MPL_BT_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_env.h b/src/mpl/include/mpl_env.h
index e68d4f0..1fce2bd 100644
--- a/src/mpl/include/mpl_env.h
+++ b/src/mpl/include/mpl_env.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_ENV_H_INCLUDED
+#if !defined(MPL_ENV_H_INCLUDED)
 #define MPL_ENV_H_INCLUDED
 
 #include "mplconfig.h"
@@ -33,4 +33,4 @@ int MPL_putenv(char *name_val);
 #endif
 /* *INDENT-OFF* */
 
-#endif /* MPL_ENV_H_INCLUDED */
+#endif /* !defined(MPL_ENV_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_iov.h b/src/mpl/include/mpl_iov.h
index 9d52f6b..88ee1da 100644
--- a/src/mpl/include/mpl_iov.h
+++ b/src/mpl/include/mpl_iov.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_IOV_H_INCLUDED
+#if !defined(MPL_IOV_H_INCLUDED)
 #define MPL_IOV_H_INCLUDED
 
 #include <stdio.h>
@@ -35,4 +35,4 @@
 /* FIXME: How is IOV_LIMIT chosen? */
 #define MPL_IOV_LIMIT   16
 
-#endif  /* MPL_IOV_H_INCLUDED */
+#endif  /* !defined(MPL_IOV_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_msg.h b/src/mpl/include/mpl_msg.h
index 0019da3..35265f8 100644
--- a/src/mpl/include/mpl_msg.h
+++ b/src/mpl/include/mpl_msg.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_MSG_H_INCLUDED
+#if !defined(MPL_MSG_H_INCLUDED)
 #define MPL_MSG_H_INCLUDED
 
 #include "mpl.h"
@@ -35,4 +35,4 @@ int MPL_internal_sys_error_printf(mpl_const char *, int, mpl_const char *str,
                                   ...) ATTRIBUTE((format(printf, 3, 4)));
 void MPL_exit(int);
 
-#endif /* MPL_MSG_H_INCLUDED */
+#endif /* !defined(MPL_MSG_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_sock.h b/src/mpl/include/mpl_sock.h
index 593b1ae..470b2bd 100644
--- a/src/mpl/include/mpl_sock.h
+++ b/src/mpl/include/mpl_sock.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_SOCK_H_INCLUDED
+#if !defined(MPL_SOCK_H_INCLUDED)
 #define MPL_SOCK_H_INCLUDED
 
 #include "mplconfig.h"
@@ -43,4 +43,4 @@ ssize_t MPL_large_readv(int fd, const struct iovec *iov, int iovcnt);
 #endif
 /* *INDENT-OFF* */
 
-#endif /* MPL_SOCK_H_INCLUDED */
+#endif /* !defined(MPL_SOCK_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_str.h b/src/mpl/include/mpl_str.h
index 86e771a..102811a 100644
--- a/src/mpl/include/mpl_str.h
+++ b/src/mpl/include/mpl_str.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_STR_H_INCLUDED
+#if !defined(MPL_STR_H_INCLUDED)
 #define MPL_STR_H_INCLUDED
 
 #include "mplconfig.h"
@@ -63,4 +63,4 @@ char *MPL_strerror(int errnum);
 #endif
 /* *INDENT-OFF* */
 
-#endif /* MPL_STR_H_INCLUDED */
+#endif /* !defined(MPL_STR_H_INCLUDED) */
diff --git a/src/mpl/include/mpl_trmem.h b/src/mpl/include/mpl_trmem.h
index 228cdf5..2c8766e 100644
--- a/src/mpl/include/mpl_trmem.h
+++ b/src/mpl/include/mpl_trmem.h
@@ -4,7 +4,7 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_TRMEM_H_INCLUDED
+#if !defined(MPL_TRMEM_H_INCLUDED)
 #define MPL_TRMEM_H_INCLUDED
 
 /* FIXME: Consider an option of specifying __attribute__((malloc)) for
diff --git a/src/mpl/include/mpl_utlist.h b/src/mpl/include/mpl_utlist.h
index eb5ea0c..7035fd5 100644
--- a/src/mpl/include/mpl_utlist.h
+++ b/src/mpl/include/mpl_utlist.h
@@ -53,8 +53,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef MPL_UTLIST_H
-#define MPL_UTLIST_H
+#if !defined(MPL_UTLIST_H_INCLUDED)
+#define MPL_UTLIST_H_INCLUDED
 
 #define MPL_UTLIST_VERSION 1.9.5
 
@@ -573,5 +573,5 @@ do {
     }                                                                                          \
 } while(0)
 
-#endif /* MPL_UTLIST_H */
+#endif /* !defined(MPL_UTLIST_H_INCLUDED) */
 
diff --git a/src/mpl/include/mpl_valgrind.h b/src/mpl/include/mpl_valgrind.h
index 2006ada..ca83df8 100644
--- a/src/mpl/include/mpl_valgrind.h
+++ b/src/mpl/include/mpl_valgrind.h
@@ -27,7 +27,7 @@
    preprocessor token "MPL_VG_AVAILABLE".
 
  */
-#ifndef MPL_VALGRIND_H_INCLUDED
+#if !defined(MPL_VALGRIND_H_INCLUDED)
 #define MPL_VALGRIND_H_INCLUDED
 
 #undef MPL_VG_AVAILABLE

http://git.mpich.org/mpich.git/commitdiff/626e541120b16ee581e4a7bda879d1308cbfd80a

commit 626e541120b16ee581e4a7bda879d1308cbfd80a
Author: Pavan Balaji <balaji at anl.gov>
Date:   Sun Jan 3 15:50:03 2016 -0600

    MPL: split mpl.h into a separate mpl_base.h.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpl/Makefile.am b/src/mpl/Makefile.am
index 6110e8b..1985d44 100644
--- a/src/mpl/Makefile.am
+++ b/src/mpl/Makefile.am
@@ -20,6 +20,7 @@ strsep_LDADD = lib at MPLLIBNAME@.la
 
 mpl_headers =               \
     include/mpl.h           \
+    include/mpl_base.h      \
     include/mplconfig.h     \
     include/mpl_utlist.h    \
     include/mpl_valgrind.h  \
diff --git a/src/mpl/include/mpl.h b/src/mpl/include/mpl.h
index 269f2ce..f9d5fd0 100644
--- a/src/mpl/include/mpl.h
+++ b/src/mpl/include/mpl.h
@@ -7,108 +7,7 @@
 #ifndef MPL_H_INCLUDED
 #define MPL_H_INCLUDED
 
-#include "mplconfig.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdint.h>
-
-#if defined _mpl_restrict
-#define mpl_restrict _mpl_restrict
-#else
-#define mpl_restrict restrict
-#endif /* _mpl_restrict */
-
-#if defined _mpl_const
-#define mpl_const _mpl_const
-#else
-#define mpl_const const
-#endif /* _mpl_const */
-
-#if defined _mpl_inline
-#define mpl_inline _mpl_inline
-#else
-#define mpl_inline inline
-#endif /* _mpl_inline */
-
-#if defined MPL_HAVE_CTYPE_H
-#include <ctype.h>
-#endif /* MPL_HAVE_CTYPE_H */
-
-#if defined(MPL_HAVE_INTTYPES_H)
-#include <inttypes.h>
-#endif /* MPL_HAVE_INTTYPES_H */
-
-#if !defined ATTRIBUTE
-#  if defined MPL_HAVE_GCC_ATTRIBUTE
-#    define ATTRIBUTE(a_) __attribute__(a_)
-#  else /* MPL_HAVE_GCC_ATTRIBUTE */
-#    define ATTRIBUTE(a_)
-#  endif /* MPL_HAVE_GCC_ATTRIBUTE */
-#endif /* ATTRIBUTE */
-
-#if defined(MPL_HAVE_MACRO_VA_ARGS)
-#define MPL_error_printf(...) fprintf(stderr,__VA_ARGS__)
-#else
-#define MPL_error_printf printf
-#endif
-
-/* These likely/unlikely macros provide static branch prediction hints to the
- * compiler, if such hints are available.  Simply wrap the relevant expression in
- * the macro, like this:
- *
- * if (unlikely(ptr == NULL)) {
- *     // ... some unlikely code path ...
- * }
- *
- * They should be used sparingly, especially in upper-level code.  It's easy to
- * incorrectly estimate branching likelihood, while the compiler can often do a
- * decent job if left to its own devices.
- *
- * These macros are not namespaced because the namespacing is cumbersome.
- */
-#ifdef HAVE_BUILTIN_EXPECT
-#  define unlikely(x_) __builtin_expect(!!(x_),0)
-#  define likely(x_)   __builtin_expect(!!(x_),1)
-#else
-#  define unlikely(x_) (x_)
-#  define likely(x_)   (x_)
-#endif
-
-
-/* -------------------------------------------------------------------------- */
-/*
- * Basic utility macros
- */
-#define MPL_QUOTE(A) MPL_QUOTE2(A)
-#define MPL_QUOTE2(A) #A
-
-#define MPL_MAX(a,b)    (((a) > (b)) ? (a) : (b))
-#define MPL_MIN(a,b)    (((a) < (b)) ? (a) : (b))
-
-/* This macro is used to silence warnings from the Mac OS X linker when
- * an object file "has no symbols".  The unused attribute prevents a
- * warning about the unused dummy variable while the used attribute
- * prevents the compiler from discarding the symbol altogether.  This
- * macro should be used at the top of any file that might not define any
- * other variables or functions (perhaps due to conditional compilation
- * via the preprocessor).  A semicolon is expected after each invocation
- * of this macro. */
-#define MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING \
-    static int MPL_UNIQUE_SYMBOL_NAME(dummy) ATTRIBUTE((unused,used)) = 0
-
-/* we jump through a couple of extra macro hoops to append the line
- * number to the variable name in order to reduce the chance of a name
- * collision with headers that might be included in the translation
- * unit */
-#define MPL_UNIQUE_SYMBOL_NAME(prefix_) MPL_UNIQUE_IMPL1_(prefix_##_unique_L,__LINE__)
-#define MPL_UNIQUE_IMPL1_(prefix_,line_) MPL_UNIQUE_IMPL2_(prefix_,line_)
-#define MPL_UNIQUE_IMPL2_(prefix_,line_) MPL_UNIQUE_IMPL3_(prefix_,line_)
-#define MPL_UNIQUE_IMPL3_(prefix_,line_) prefix_##line_
-
-
+#include "mpl_base.h"
 /* must come before mpltrmem.h */
 #include "mpl_valgrind.h"
 #include "mpl_str.h"
diff --git a/src/mpl/include/mpl.h b/src/mpl/include/mpl_base.h
similarity index 85%
copy from src/mpl/include/mpl.h
copy to src/mpl/include/mpl_base.h
index 269f2ce..01859de 100644
--- a/src/mpl/include/mpl.h
+++ b/src/mpl/include/mpl_base.h
@@ -4,8 +4,11 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPL_H_INCLUDED
-#define MPL_H_INCLUDED
+#ifndef MPL_BASE_H_INCLUDED
+#define MPL_BASE_H_INCLUDED
+
+/* this file splits off the base functionality in MPL, which does not
+ * depend on any of the exposed features. */
 
 #include "mplconfig.h"
 
@@ -49,12 +52,6 @@
 #  endif /* MPL_HAVE_GCC_ATTRIBUTE */
 #endif /* ATTRIBUTE */
 
-#if defined(MPL_HAVE_MACRO_VA_ARGS)
-#define MPL_error_printf(...) fprintf(stderr,__VA_ARGS__)
-#else
-#define MPL_error_printf printf
-#endif
-
 /* These likely/unlikely macros provide static branch prediction hints to the
  * compiler, if such hints are available.  Simply wrap the relevant expression in
  * the macro, like this:
@@ -77,11 +74,6 @@
 #  define likely(x_)   (x_)
 #endif
 
-
-/* -------------------------------------------------------------------------- */
-/*
- * Basic utility macros
- */
 #define MPL_QUOTE(A) MPL_QUOTE2(A)
 #define MPL_QUOTE2(A) #A
 
@@ -108,15 +100,4 @@
 #define MPL_UNIQUE_IMPL2_(prefix_,line_) MPL_UNIQUE_IMPL3_(prefix_,line_)
 #define MPL_UNIQUE_IMPL3_(prefix_,line_) prefix_##line_
 
-
-/* must come before mpltrmem.h */
-#include "mpl_valgrind.h"
-#include "mpl_str.h"
-#include "mpl_trmem.h"
-#include "mpl_env.h"
-#include "mpl_sock.h"
-#include "mpl_msg.h"
-#include "mpl_iov.h"
-#include "mpl_bt.h"
-
 #endif /* MPL_H_INCLUDED */
diff --git a/src/mpl/include/mpl_msg.h b/src/mpl/include/mpl_msg.h
index 802d129..0019da3 100644
--- a/src/mpl/include/mpl_msg.h
+++ b/src/mpl/include/mpl_msg.h
@@ -19,6 +19,12 @@
 #define MPL_DBG_INLINE_KEYWORD inline
 #endif
 
+#if defined(MPL_HAVE_MACRO_VA_ARGS)
+#define MPL_error_printf(...) fprintf(stderr,__VA_ARGS__)
+#else
+#define MPL_error_printf printf
+#endif
+
 /* These routines are used to ensure that messages are sent to the
  * appropriate output and (eventually) are properly
  * internationalized */

http://git.mpich.org/mpich.git/commitdiff/12c912ec6372b241891cf41754faf04f2dc23136

commit 12c912ec6372b241891cf41754faf04f2dc23136
Author: Pavan Balaji <balaji at anl.gov>
Date:   Sun Jan 3 13:42:41 2016 -0600

    MPL: better organize MPL source and header files.
    
    Separate out different "features" into different directories.  Rename
    files to match the naming convention.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpl/Makefile.am b/src/mpl/Makefile.am
index 50a18f1..6110e8b 100644
--- a/src/mpl/Makefile.am
+++ b/src/mpl/Makefile.am
@@ -7,33 +7,29 @@
 ACLOCAL_AMFLAGS = -I confdb
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 
-lib at MPLLIBNAME@_la_SOURCES = \
-	src/mplstr.c \
-	src/mpltrmem.c \
-	src/mplenv.c \
-	src/mplmsg.c \
-	src/mplsock.c \
-	src/mplutil.c
+lib at MPLLIBNAME@_la_SOURCES =
 lib at MPLLIBNAME@_la_LDFLAGS = ${lib at MPLLIBNAME@_so_versionflags}
 
+include src/Makefile.mk
+
 MPL_TESTS = strsep
 TESTS = $(MPL_TESTS)
 check_PROGRAMS = $(MPL_TESTS)
 strsep_SOURCES = test/strsep.c
 strsep_LDADD = lib at MPLLIBNAME@.la
 
-mpl_headers =              \
-    include/mpl.h          \
-    include/mpl_utlist.h   \
-    include/mpl_valgrind.h \
-    include/mplconfig.h    \
-    include/mplenv.h       \
-    include/mplstr.h       \
-    include/mpltrmem.h     \
-    include/mplmsg.h       \
-    include/mpliov.h       \
-    include/mplsock.h      \
-    include/mplutil.h
+mpl_headers =               \
+    include/mpl.h           \
+    include/mplconfig.h     \
+    include/mpl_utlist.h    \
+    include/mpl_valgrind.h  \
+    include/mpl_env.h       \
+    include/mpl_str.h       \
+    include/mpl_trmem.h     \
+    include/mpl_msg.h       \
+    include/mpl_sock.h      \
+    include/mpl_iov.h       \
+    include/mpl_bt.h
 
 if MPL_EMBEDDED_MODE
 noinst_HEADERS = $(mpl_headers)
diff --git a/src/mpl/configure.ac b/src/mpl/configure.ac
index aa4cf7f..a8c3c63 100644
--- a/src/mpl/configure.ac
+++ b/src/mpl/configure.ac
@@ -7,7 +7,7 @@ AC_PREREQ(2.63)
 AC_INIT([MPL], [0.1])
 
 # sanity check that --srcdir was specified correctly
-AC_CONFIG_SRCDIR([src/mplstr.c])
+AC_CONFIG_SRCDIR([src/str/mpl_str.c])
 
 AC_CONFIG_AUX_DIR(confdb)
 AC_CONFIG_MACRO_DIR(confdb)
diff --git a/src/mpl/include/mpl.h b/src/mpl/include/mpl.h
index 66f603a..269f2ce 100644
--- a/src/mpl/include/mpl.h
+++ b/src/mpl/include/mpl.h
@@ -111,12 +111,12 @@
 
 /* must come before mpltrmem.h */
 #include "mpl_valgrind.h"
-#include "mplstr.h"
-#include "mpltrmem.h"
-#include "mplenv.h"
-#include "mplsock.h"
-#include "mplmsg.h"
-#include "mpliov.h"
-#include "mplutil.h"
+#include "mpl_str.h"
+#include "mpl_trmem.h"
+#include "mpl_env.h"
+#include "mpl_sock.h"
+#include "mpl_msg.h"
+#include "mpl_iov.h"
+#include "mpl_bt.h"
 
 #endif /* MPL_H_INCLUDED */
diff --git a/src/mpl/include/mplutil.h b/src/mpl/include/mpl_bt.h
similarity index 91%
rename from src/mpl/include/mplutil.h
rename to src/mpl/include/mpl_bt.h
index 0873175..6c6c6ed 100644
--- a/src/mpl/include/mplutil.h
+++ b/src/mpl/include/mpl_bt.h
@@ -5,8 +5,8 @@
  */
 
 
-#ifndef MPLUTIL_H_INCLUDED
-#define MPLUTIL_H_INCLUDED
+#ifndef MPL_BT_H_INCLUDED
+#define MPL_BT_H_INCLUDED
 
 #include "mplconfig.h"
 #if defined(__cplusplus)
@@ -35,4 +35,4 @@ void MPL_backtrace_show(FILE *output);
 }
 #endif
 
-#endif
+#endif  /* MPL_BT_H_INCLUDED */
diff --git a/src/mpl/include/mplenv.h b/src/mpl/include/mpl_env.h
similarity index 90%
rename from src/mpl/include/mplenv.h
rename to src/mpl/include/mpl_env.h
index 8021fc1..e68d4f0 100644
--- a/src/mpl/include/mplenv.h
+++ b/src/mpl/include/mpl_env.h
@@ -4,8 +4,8 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPLENV_H_INCLUDED
-#define MPLENV_H_INCLUDED
+#ifndef MPL_ENV_H_INCLUDED
+#define MPL_ENV_H_INCLUDED
 
 #include "mplconfig.h"
 
@@ -33,4 +33,4 @@ int MPL_putenv(char *name_val);
 #endif
 /* *INDENT-OFF* */
 
-#endif /* MPLENV_H_INCLUDED */
+#endif /* MPL_ENV_H_INCLUDED */
diff --git a/src/mpl/include/mpliov.h b/src/mpl/include/mpl_iov.h
similarity index 90%
rename from src/mpl/include/mpliov.h
rename to src/mpl/include/mpl_iov.h
index da3f250..9d52f6b 100644
--- a/src/mpl/include/mpliov.h
+++ b/src/mpl/include/mpl_iov.h
@@ -4,8 +4,8 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPLIOV_H_INCLUDED
-#define MPLIOV_H_INCLUDED
+#ifndef MPL_IOV_H_INCLUDED
+#define MPL_IOV_H_INCLUDED
 
 #include <stdio.h>
 
@@ -35,4 +35,4 @@
 /* FIXME: How is IOV_LIMIT chosen? */
 #define MPL_IOV_LIMIT   16
 
-#endif  /* MPLIOV_H_INCLUDED */
+#endif  /* MPL_IOV_H_INCLUDED */
diff --git a/src/mpl/include/mplmsg.h b/src/mpl/include/mpl_msg.h
similarity index 92%
rename from src/mpl/include/mplmsg.h
rename to src/mpl/include/mpl_msg.h
index 650b6e8..802d129 100644
--- a/src/mpl/include/mplmsg.h
+++ b/src/mpl/include/mpl_msg.h
@@ -4,8 +4,8 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPLMSG_H_INCLUDED
-#define MPLMSG_H_INCLUDED
+#ifndef MPL_MSG_H_INCLUDED
+#define MPL_MSG_H_INCLUDED
 
 #include "mpl.h"
 
@@ -29,4 +29,4 @@ int MPL_internal_sys_error_printf(mpl_const char *, int, mpl_const char *str,
                                   ...) ATTRIBUTE((format(printf, 3, 4)));
 void MPL_exit(int);
 
-#endif /* MPLMSG_H_INCLUDED */
+#endif /* MPL_MSG_H_INCLUDED */
diff --git a/src/mpl/include/mplsock.h b/src/mpl/include/mpl_sock.h
similarity index 90%
rename from src/mpl/include/mplsock.h
rename to src/mpl/include/mpl_sock.h
index fc4155f..593b1ae 100644
--- a/src/mpl/include/mplsock.h
+++ b/src/mpl/include/mpl_sock.h
@@ -4,8 +4,8 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPLSOCK_H_INCLUDED
-#define MPLSOCK_H_INCLUDED
+#ifndef MPL_SOCK_H_INCLUDED
+#define MPL_SOCK_H_INCLUDED
 
 #include "mplconfig.h"
 
@@ -43,4 +43,4 @@ ssize_t MPL_large_readv(int fd, const struct iovec *iov, int iovcnt);
 #endif
 /* *INDENT-OFF* */
 
-#endif /* MPLSOCK_H_INCLUDED */
+#endif /* MPL_SOCK_H_INCLUDED */
diff --git a/src/mpl/include/mplstr.h b/src/mpl/include/mpl_str.h
similarity index 94%
rename from src/mpl/include/mplstr.h
rename to src/mpl/include/mpl_str.h
index 26cecb6..86e771a 100644
--- a/src/mpl/include/mplstr.h
+++ b/src/mpl/include/mpl_str.h
@@ -4,8 +4,8 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPLSTR_H_INCLUDED
-#define MPLSTR_H_INCLUDED
+#ifndef MPL_STR_H_INCLUDED
+#define MPL_STR_H_INCLUDED
 
 #include "mplconfig.h"
 
@@ -63,4 +63,4 @@ char *MPL_strerror(int errnum);
 #endif
 /* *INDENT-OFF* */
 
-#endif /* MPLSTR_H_INCLUDED */
+#endif /* MPL_STR_H_INCLUDED */
diff --git a/src/mpl/include/mpltrmem.h b/src/mpl/include/mpl_trmem.h
similarity index 90%
rename from src/mpl/include/mpltrmem.h
rename to src/mpl/include/mpl_trmem.h
index 4253bac..228cdf5 100644
--- a/src/mpl/include/mpltrmem.h
+++ b/src/mpl/include/mpl_trmem.h
@@ -4,8 +4,8 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-#ifndef MPLTRMEM_H_INCLUDED
-#define MPLTRMEM_H_INCLUDED
+#ifndef MPL_TRMEM_H_INCLUDED
+#define MPL_TRMEM_H_INCLUDED
 
 /* FIXME: Consider an option of specifying __attribute__((malloc)) for
    gcc - this lets gcc-style compilers know that the returned pointer
@@ -31,4 +31,4 @@ void MPL_trdump(FILE *, int);
 void MPL_trSummary(FILE *, int);
 void MPL_trdumpGrouped(FILE *, int);
 
-#endif /* !defined(MPLTRMEM_H_INCLUDED) */
+#endif /* !defined(MPL_TRMEM_H_INCLUDED) */
diff --git a/src/mpl/src/Makefile.mk b/src/mpl/src/Makefile.mk
new file mode 100644
index 0000000..156dfdd
--- /dev/null
+++ b/src/mpl/src/Makefile.mk
@@ -0,0 +1,12 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+include src/bt/Makefile.mk
+include src/env/Makefile.mk
+include src/mem/Makefile.mk
+include src/msg/Makefile.mk
+include src/sock/Makefile.mk
+include src/str/Makefile.mk
diff --git a/src/mpl/src/bt/Makefile.mk b/src/mpl/src/bt/Makefile.mk
new file mode 100644
index 0000000..f34457d
--- /dev/null
+++ b/src/mpl/src/bt/Makefile.mk
@@ -0,0 +1,7 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+lib at MPLLIBNAME@_la_SOURCES += src/bt/mpl_bt.c
diff --git a/src/mpl/src/mplutil.c b/src/mpl/src/bt/mpl_bt.c
similarity index 100%
rename from src/mpl/src/mplutil.c
rename to src/mpl/src/bt/mpl_bt.c
diff --git a/src/mpl/src/env/Makefile.mk b/src/mpl/src/env/Makefile.mk
new file mode 100644
index 0000000..cf3beeb
--- /dev/null
+++ b/src/mpl/src/env/Makefile.mk
@@ -0,0 +1,7 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+lib at MPLLIBNAME@_la_SOURCES += src/env/mpl_env.c
diff --git a/src/mpl/src/mplenv.c b/src/mpl/src/env/mpl_env.c
similarity index 100%
rename from src/mpl/src/mplenv.c
rename to src/mpl/src/env/mpl_env.c
diff --git a/src/mpl/src/mem/Makefile.mk b/src/mpl/src/mem/Makefile.mk
new file mode 100644
index 0000000..26d285c
--- /dev/null
+++ b/src/mpl/src/mem/Makefile.mk
@@ -0,0 +1,7 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+lib at MPLLIBNAME@_la_SOURCES += src/mem/mpl_trmem.c
diff --git a/src/mpl/src/mpltrmem.c b/src/mpl/src/mem/mpl_trmem.c
similarity index 100%
rename from src/mpl/src/mpltrmem.c
rename to src/mpl/src/mem/mpl_trmem.c
diff --git a/src/mpl/src/msg/Makefile.mk b/src/mpl/src/msg/Makefile.mk
new file mode 100644
index 0000000..6589783
--- /dev/null
+++ b/src/mpl/src/msg/Makefile.mk
@@ -0,0 +1,7 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+lib at MPLLIBNAME@_la_SOURCES += src/msg/mpl_msg.c
diff --git a/src/mpl/src/mplmsg.c b/src/mpl/src/msg/mpl_msg.c
similarity index 100%
rename from src/mpl/src/mplmsg.c
rename to src/mpl/src/msg/mpl_msg.c
diff --git a/src/mpl/src/sock/Makefile.mk b/src/mpl/src/sock/Makefile.mk
new file mode 100644
index 0000000..b636a08
--- /dev/null
+++ b/src/mpl/src/sock/Makefile.mk
@@ -0,0 +1,7 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+lib at MPLLIBNAME@_la_SOURCES += src/sock/mpl_sock.c
diff --git a/src/mpl/src/mplsock.c b/src/mpl/src/sock/mpl_sock.c
similarity index 100%
rename from src/mpl/src/mplsock.c
rename to src/mpl/src/sock/mpl_sock.c
diff --git a/src/mpl/src/str/Makefile.mk b/src/mpl/src/str/Makefile.mk
new file mode 100644
index 0000000..c4177b8
--- /dev/null
+++ b/src/mpl/src/str/Makefile.mk
@@ -0,0 +1,7 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+lib at MPLLIBNAME@_la_SOURCES += src/str/mpl_str.c
diff --git a/src/mpl/src/mplstr.c b/src/mpl/src/str/mpl_str.c
similarity index 100%
rename from src/mpl/src/mplstr.c
rename to src/mpl/src/str/mpl_str.c

http://git.mpich.org/mpich.git/commitdiff/ecdaac2c9163747f73c5793a9e21432bdf80f9e0

commit ecdaac2c9163747f73c5793a9e21432bdf80f9e0
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Jan 1 23:17:31 2016 -0600

    warning squash
    
    No reviewer.

diff --git a/src/mpi/coll/ibcast.c b/src/mpi/coll/ibcast.c
index aa13dbd..54f7545 100644
--- a/src/mpi/coll/ibcast.c
+++ b/src/mpi/coll/ibcast.c
@@ -27,6 +27,12 @@ struct MPIR_Ibcast_status{
 };
 /* Add some functions for asynchronous error detection */
 
+/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
+   the MPI routines */
+#ifndef MPICH_MPI_FROM_PMPI
+#undef MPI_Ibcast
+#define MPI_Ibcast PMPI_Ibcast
+
 #undef FUNCNAME
 #define FUNCNAME sched_test_length
 #undef FCNAME
@@ -79,11 +85,6 @@ static int sched_add_length(MPID_Comm * comm, int tag, void *state)
     status->curr_bytes+= recv_size;
     return mpi_errno;
 }
-/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
-   the MPI routines */
-#ifndef MPICH_MPI_FROM_PMPI
-#undef MPI_Ibcast
-#define MPI_Ibcast PMPI_Ibcast
 
 /* any non-MPI functions go here, especially non-static ones */
 
diff --git a/src/mpid/common/sched/mpid_sched.c b/src/mpid/common/sched/mpid_sched.c
index dc96a4d..b3c14c8 100644
--- a/src/mpid/common/sched/mpid_sched.c
+++ b/src/mpid/common/sched/mpid_sched.c
@@ -734,10 +734,10 @@ int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype,
         MPID_Datatype_get_size_macro(intype, intype_size);
         MPID_Datatype_get_size_macro(outtype, outtype_size);
         if (incount * intype_size > outcount * outtype_size) {
-            MPL_error_printf("truncation: intype=%#x, intype_size=%lld, incount=%lld, outtype=%#x, outtype_size=%lld outcount=%d\n",
-                              intype, (long long)intype_size,
-			      (long long)incount, outtype,
-			      (long long)outtype_size, outcount);
+            MPL_error_printf("truncation: intype=%#x, intype_size=" MPI_AINT_FMT_DEC_SPEC ", incount=" MPI_AINT_FMT_DEC_SPEC ", outtype=%#x, outtype_size=" MPI_AINT_FMT_DEC_SPEC " outcount=" MPI_AINT_FMT_DEC_SPEC "\n",
+                              intype, intype_size,
+			      incount, outtype,
+			      outtype_size, outcount);
         }
     }
 #endif

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    4 +-
 configure.ac                                       |  353 -------
 maint/checkbuilds.in                               |    2 +-
 src/binding/fortran/mpif_h/buildiface              |    4 -
 src/include/mpihandlemem.h                         |    4 -
 src/include/mpiimpl.h                              |   27 -
 src/include/mpimem.h                               |   35 +-
 src/include/mpiutil.h                              |    1 -
 src/include/rlog_macros.h                          |    1 -
 src/mpi/coll/ibcast.c                              |   11 +-
 src/mpi/comm/comm_get_name.c                       |    2 +-
 src/mpi/comm/comm_set_name.c                       |    2 +-
 src/mpi/datatype/type_get_name.c                   |    6 +-
 src/mpi/datatype/type_set_name.c                   |    2 +-
 src/mpi/errhan/dynerrutil.c                        |    2 +-
 src/mpi/errhan/errutil.c                           |   72 +-
 src/mpi/info/info_get.c                            |    2 +-
 src/mpi/info/info_getnth.c                         |    2 +-
 src/mpi/init/initthread.c                          |   10 +-
 src/mpi/rma/win_get_name.c                         |    2 +-
 src/mpi/rma/win_set_name.c                         |    2 +-
 src/mpi/spawn/comm_get_parent.c                    |    2 -
 src/mpi/timer/wtick.c                              |    2 +-
 src/mpi_t/cvar_read.c                              |    2 +-
 src/mpi_t/cvar_write.c                             |    2 +-
 .../ch3/channels/nemesis/include/mpidi_ch3_impl.h  |    2 +-
 .../ch3/channels/nemesis/include/mpidi_ch3_pre.h   |   30 +-
 .../ch3/channels/nemesis/netmod/mxm/mxm_impl.h     |    4 +-
 .../ch3/channels/nemesis/netmod/tcp/tcp_getip.c    |    2 +-
 .../ch3/channels/nemesis/netmod/tcp/tcp_init.c     |    2 +-
 src/mpid/ch3/channels/nemesis/src/ch3_isend.c      |    2 +-
 src/mpid/ch3/channels/nemesis/src/ch3_isendv.c     |    2 +-
 src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c  |    2 +-
 src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c |    2 +-
 .../ch3/channels/nemesis/src/ch3i_eagernoncontig.c |    2 +-
 src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c |   10 +-
 src/mpid/ch3/include/mpidimpl.h                    |   21 +-
 src/mpid/ch3/src/ch3u_comm_spawn_multiple.c        |    2 +-
 src/mpid/ch3/src/ch3u_eager.c                      |   42 +-
 src/mpid/ch3/src/ch3u_eagersync.c                  |   18 +-
 src/mpid/ch3/src/ch3u_handle_connection.c          |    4 +-
 src/mpid/ch3/src/ch3u_port.c                       |   20 +-
 src/mpid/ch3/src/ch3u_recvq.c                      |    4 +-
 src/mpid/ch3/src/ch3u_rma_pkthandler.c             |   76 +-
 src/mpid/ch3/src/ch3u_rndv.c                       |   26 +-
 src/mpid/ch3/src/mpid_cancel_send.c                |   16 +-
 src/mpid/ch3/src/mpid_getpname.c                   |    4 +-
 src/mpid/ch3/src/mpid_init.c                       |    4 +-
 src/mpid/ch3/src/mpid_port.c                       |    2 +-
 src/mpid/ch3/src/mpidi_pg.c                        |    2 +-
 src/mpid/ch3/src/mpidi_printf.c                    |   98 +--
 src/mpid/ch3/util/ftb/ftb.c                        |    8 +-
 src/mpid/ch3/util/sock/ch3u_getinterfaces.c        |    2 +-
 src/mpid/ch3/util/sock/findinterfaces.c            |    2 +-
 src/mpid/common/datatype/dataloop/dataloop.c       |   68 +-
 src/mpid/common/datatype/dataloop/segment.c        |   54 +-
 src/mpid/common/datatype/dataloop/segment_count.c  |    4 +-
 .../common/datatype/dataloop/segment_flatten.c     |    8 +-
 src/mpid/common/datatype/mpid_dataloop.h           |    3 -
 src/mpid/common/datatype/mpid_segment.c            |   12 +-
 src/mpid/common/datatype/mpid_type_commit.c        |    4 +-
 src/mpid/common/sched/mpid_sched.c                 |    8 +-
 src/mpid/common/sock/iocp/sock.c                   |  116 ++--
 src/mpid/common/sock/poll/sock_misc.i              |   36 +-
 src/mpid/common/timers/mpid_timers_fallback.h      |   14 +-
 src/mpid/pamid/include/mpidimpl.h                  |    2 +-
 src/mpid/pamid/include/mpidpre.h                   |   15 +
 src/mpid/pamid/src/dyntask/mpidi_pg.c              |    2 +-
 src/mpid/pamid/src/mpid_init.c                     |    7 +-
 src/mpid/pamid/src/mpid_time.c                     |   94 ++-
 src/mpid/pamid/subconfigure.m4                     |    1 -
 src/mpl/Makefile.am                                |   35 +-
 src/mpl/configure.ac                               |  320 ++++++-
 src/mpl/include/mpl.h                              |  124 +--
 src/mpl/include/mpl_base.h                         |  103 ++
 src/mpl/include/mpl_bt.h                           |   38 +
 src/mpl/include/mpl_env.h                          |   36 +
 src/mpl/include/mpl_iov.h                          |   38 +
 src/mpl/include/mpl_msg.h                          |   38 +
 src/mpl/include/mpl_sock.h                         |   46 +
 src/mpl/include/mpl_str.h                          |   68 ++
 src/mpl/include/mpl_timer.h.in                     |  244 +++++
 src/mpl/include/mpl_timer_clock_gettime.h          |   19 +
 src/mpl/include/mpl_timer_device.h                 |   32 +
 src/mpl/include/mpl_timer_gcc_ia64_cycle.h         |   26 +
 src/mpl/include/mpl_timer_gethrtime.h              |   14 +
 src/mpl/include/mpl_timer_gettimeofday.h           |   15 +
 src/mpl/include/mpl_timer_linux86_cycle.h          |   44 +
 src/mpl/include/mpl_timer_mach_absolute_time.h     |   14 +
 .../include/mpl_timer_query_performance_counter.h  |   20 +
 src/mpl/include/mpl_timer_win86_cycle.h            |   25 +
 src/mpl/include/mpl_trmem.h                        |   27 +
 src/mpl/include/mpl_utlist.h                       |    6 +-
 src/mpl/include/mpl_valgrind.h                     |    2 +-
 src/mpl/include/mplenv.h                           |   36 -
 src/mpl/include/mpliov.h                           |   38 -
 src/mpl/include/mplmsg.h                           |   32 -
 src/mpl/include/mplsock.h                          |   46 -
 src/mpl/include/mplstr.h                           |   66 --
 src/mpl/include/mpltrmem.h                         |   34 -
 src/mpl/include/mplutil.h                          |   38 -
 src/mpl/src/Makefile.mk                            |   13 +
 src/mpl/src/bt/Makefile.mk                         |    7 +
 src/mpl/src/{mplutil.c => bt/mpl_bt.c}             |    0
 src/mpl/src/env/Makefile.mk                        |    7 +
 src/mpl/src/{mplenv.c => env/mpl_env.c}            |    0
 src/mpl/src/mem/Makefile.mk                        |    7 +
 src/mpl/src/mem/mpl_trmem.c                        |  714 +++++++++++++
 src/mpl/src/mplstr.c                               |  314 ------
 src/mpl/src/mpltrmem.c                             | 1072 --------------------
 src/mpl/src/msg/Makefile.mk                        |    7 +
 src/mpl/src/{mplmsg.c => msg/mpl_msg.c}            |    0
 src/mpl/src/sock/Makefile.mk                       |    7 +
 src/mpl/src/{mplsock.c => sock/mpl_sock.c}         |    0
 src/mpl/src/str/Makefile.mk                        |    7 +
 src/mpl/src/str/mpl_str.c                          |  366 +++++++
 src/mpl/src/timer/Makefile.mk                      |   17 +
 src/mpl/src/timer/mpl_timer_clock_gettime.c        |   76 ++
 src/mpl/src/timer/mpl_timer_device.c               |   54 +
 src/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c       |   69 ++
 src/mpl/src/timer/mpl_timer_gethrtime.c            |   69 ++
 src/mpl/src/timer/mpl_timer_gettimeofday.c         |   72 ++
 src/mpl/src/timer/mpl_timer_linux86_cycle.c        |   69 ++
 src/mpl/src/timer/mpl_timer_mach_absolute_time.c   |   60 ++
 .../timer/mpl_timer_query_performance_counter.c    |   44 +
 src/mpl/src/timer/mpl_timer_win86_cycle.c          |   59 ++
 src/nameserv/file/file_nameserv.c                  |   16 +-
 src/nameserv/pmi/pmi_nameserv.c                    |    2 +-
 src/pm/gforker/mpiexec.c                           |    4 +-
 src/pm/remshell/mpiexec.c                          |    8 +-
 src/pm/util/Makefile.mk                            |    5 +-
 src/pm/util/env.c                                  |    6 +-
 src/pm/util/labelout.c                             |   10 +-
 src/pm/util/pmiserv.c                              |   22 +-
 src/pm/util/pmutil.h                               |    4 +-
 src/pm/util/process.c                              |    2 +-
 src/pm/util/rm.c                                   |    6 +-
 src/pm/util/safestr2.c                             |  135 ---
 src/pm/util/simple_pmiutil2.c                      |   12 +-
 src/pmi/pmi2/simple/pmi2compat.h                   |    3 +-
 src/pmi/simple/simple_pmi.c                        |   24 +-
 src/pmi/simple/simple_pmiutil.c                    |   12 +-
 src/util/Makefile.mk                               |    1 -
 src/util/assert/assert.c                           |    6 +-
 src/util/dbg/dbg_printf.c                          |  598 +++--------
 src/util/dbg/mpidbg.h                              |   72 +-
 src/util/logging/rlog/irlog2rlog.c                 |    2 +-
 src/util/logging/rlog/rlog.c                       |    6 +-
 src/util/mem/Makefile.mk                           |    1 -
 src/util/mem/argstr.c                              |  183 ----
 src/util/mem/check.c                               |   29 -
 src/util/mem/handlemem.c                           |  135 +--
 src/util/mem/safestr.c                             |  195 ----
 src/util/mem/strerror.c                            |    3 -
 src/util/mem/trmem.c                               |   36 -
 src/util/timers/Makefile.mk                        |   10 -
 src/util/timers/mpiu_timer.c                       |  405 --------
 src/util/timers/mpiu_timer.h.in                    |  319 ------
 158 files changed, 3694 insertions(+), 4725 deletions(-)
 create mode 100644 src/mpl/include/mpl_base.h
 create mode 100644 src/mpl/include/mpl_bt.h
 create mode 100644 src/mpl/include/mpl_env.h
 create mode 100644 src/mpl/include/mpl_iov.h
 create mode 100644 src/mpl/include/mpl_msg.h
 create mode 100644 src/mpl/include/mpl_sock.h
 create mode 100644 src/mpl/include/mpl_str.h
 create mode 100644 src/mpl/include/mpl_timer.h.in
 create mode 100644 src/mpl/include/mpl_timer_clock_gettime.h
 create mode 100644 src/mpl/include/mpl_timer_device.h
 create mode 100644 src/mpl/include/mpl_timer_gcc_ia64_cycle.h
 create mode 100644 src/mpl/include/mpl_timer_gethrtime.h
 create mode 100644 src/mpl/include/mpl_timer_gettimeofday.h
 create mode 100644 src/mpl/include/mpl_timer_linux86_cycle.h
 create mode 100644 src/mpl/include/mpl_timer_mach_absolute_time.h
 create mode 100644 src/mpl/include/mpl_timer_query_performance_counter.h
 create mode 100644 src/mpl/include/mpl_timer_win86_cycle.h
 create mode 100644 src/mpl/include/mpl_trmem.h
 delete mode 100644 src/mpl/include/mplenv.h
 delete mode 100644 src/mpl/include/mpliov.h
 delete mode 100644 src/mpl/include/mplmsg.h
 delete mode 100644 src/mpl/include/mplsock.h
 delete mode 100644 src/mpl/include/mplstr.h
 delete mode 100644 src/mpl/include/mpltrmem.h
 delete mode 100644 src/mpl/include/mplutil.h
 create mode 100644 src/mpl/src/Makefile.mk
 create mode 100644 src/mpl/src/bt/Makefile.mk
 rename src/mpl/src/{mplutil.c => bt/mpl_bt.c} (100%)
 create mode 100644 src/mpl/src/env/Makefile.mk
 rename src/mpl/src/{mplenv.c => env/mpl_env.c} (100%)
 create mode 100644 src/mpl/src/mem/Makefile.mk
 create mode 100644 src/mpl/src/mem/mpl_trmem.c
 delete mode 100644 src/mpl/src/mplstr.c
 delete mode 100644 src/mpl/src/mpltrmem.c
 create mode 100644 src/mpl/src/msg/Makefile.mk
 rename src/mpl/src/{mplmsg.c => msg/mpl_msg.c} (100%)
 create mode 100644 src/mpl/src/sock/Makefile.mk
 rename src/mpl/src/{mplsock.c => sock/mpl_sock.c} (100%)
 create mode 100644 src/mpl/src/str/Makefile.mk
 create mode 100644 src/mpl/src/str/mpl_str.c
 create mode 100644 src/mpl/src/timer/Makefile.mk
 create mode 100644 src/mpl/src/timer/mpl_timer_clock_gettime.c
 create mode 100644 src/mpl/src/timer/mpl_timer_device.c
 create mode 100644 src/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c
 create mode 100644 src/mpl/src/timer/mpl_timer_gethrtime.c
 create mode 100644 src/mpl/src/timer/mpl_timer_gettimeofday.c
 create mode 100644 src/mpl/src/timer/mpl_timer_linux86_cycle.c
 create mode 100644 src/mpl/src/timer/mpl_timer_mach_absolute_time.c
 create mode 100644 src/mpl/src/timer/mpl_timer_query_performance_counter.c
 create mode 100644 src/mpl/src/timer/mpl_timer_win86_cycle.c
 delete mode 100644 src/pm/util/safestr2.c
 delete mode 100644 src/util/mem/check.c
 delete mode 100644 src/util/mem/safestr.c
 delete mode 100644 src/util/timers/Makefile.mk
 delete mode 100644 src/util/timers/mpiu_timer.c
 delete mode 100644 src/util/timers/mpiu_timer.h.in


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list