[MOAB-dev] r2275 - in MOAB/trunk: . m4 parallel test/obb test/perf tools/converter tools/iMesh tools/mbperf tools/size tools/skin
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Wed Nov 19 13:06:23 CST 2008
Author: kraftche
Date: 2008-11-19 13:06:22 -0600 (Wed, 19 Nov 2008)
New Revision: 2275
Modified:
MOAB/trunk/MBAdaptiveKDTree.cpp
MOAB/trunk/MBBSPTree.cpp
MOAB/trunk/MBGeomUtil.cpp
MOAB/trunk/MBOrientedBox.cpp
MOAB/trunk/MBSysUtil.cpp
MOAB/trunk/ReadSTL.cpp
MOAB/trunk/TestUtil.hpp
MOAB/trunk/WriteHDF5.cpp
MOAB/trunk/WriteSTL.cpp
MOAB/trunk/kd_tree_tool.cpp
MOAB/trunk/m4/hdf5.m4
MOAB/trunk/parallel/parallel_unit_tests.cpp
MOAB/trunk/test/obb/obb_tree_tool.cpp
MOAB/trunk/test/perf/perf.cpp
MOAB/trunk/tools/converter/convert.cpp
MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp
MOAB/trunk/tools/mbperf/mbperf.cpp
MOAB/trunk/tools/mbperf/mbperf_iMesh.cpp
MOAB/trunk/tools/size/size.cpp
MOAB/trunk/tools/skin/skin.cpp
Log:
o Fix stomping of user-specified LDFLAGS
o Fix build under mingw32 (cross-compile for windows)
Modified: MOAB/trunk/MBAdaptiveKDTree.cpp
===================================================================
--- MOAB/trunk/MBAdaptiveKDTree.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/MBAdaptiveKDTree.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -28,7 +28,7 @@
#include <algorithm>
#include <limits>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <float.h>
# define finite(A) _finite(A)
#endif
Modified: MOAB/trunk/MBBSPTree.cpp
===================================================================
--- MOAB/trunk/MBBSPTree.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/MBBSPTree.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -27,7 +27,7 @@
#include <algorithm>
#include <limits>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <float.h>
# define finite(A) _finite(A)
#elif defined(HAVE_IEEEFP_H)
Modified: MOAB/trunk/MBGeomUtil.cpp
===================================================================
--- MOAB/trunk/MBGeomUtil.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/MBGeomUtil.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -27,7 +27,7 @@
#include <iostream>
#include <limits>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <float.h>
# define finite(A) _finite(A)
#endif
Modified: MOAB/trunk/MBOrientedBox.cpp
===================================================================
--- MOAB/trunk/MBOrientedBox.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/MBOrientedBox.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -40,7 +40,7 @@
#include <assert.h>
#include <limits>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <float.h>
# define finite(A) _finite(A)
#endif
Modified: MOAB/trunk/MBSysUtil.cpp
===================================================================
--- MOAB/trunk/MBSysUtil.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/MBSysUtil.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -15,11 +15,10 @@
#include <stdint.h>
#endif
-#ifdef _MSC_VER /* windows */
-# include <BaseTsd.h>
-typedef ULONG16 uint16_t;
-typedef ULONG32 uint32_t;
-typedef ULONG64 uint64_t;
+#if defined(_MSC_VER) /* windows */
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
#endif
namespace MBSysUtil
Modified: MOAB/trunk/ReadSTL.cpp
===================================================================
--- MOAB/trunk/ReadSTL.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/ReadSTL.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -39,9 +39,8 @@
#include <stdint.h>
#endif
-#ifdef _MSC_VER /* windows */
-# include <BaseTsd.h>
-typedef ULONG32 uint32_t;
+#if defined(_MSC_VER) /* Windows */
+typedef unsigned __int32 uint32_t;
#endif
#include <errno.h>
Modified: MOAB/trunk/TestUtil.hpp
===================================================================
--- MOAB/trunk/TestUtil.hpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/TestUtil.hpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -47,7 +47,7 @@
// If test application hasn't set MODE, set to default
#ifndef MODE
-# ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# define MODE EXCEPTION_MODE
# else
# define MODE LONGJMP_MODE
Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/WriteHDF5.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -31,7 +31,7 @@
#endif
#include <assert.h>
-#ifndef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
#include <sys/time.h>
#endif
#include <time.h>
Modified: MOAB/trunk/WriteSTL.cpp
===================================================================
--- MOAB/trunk/WriteSTL.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/WriteSTL.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -47,10 +47,11 @@
#include <fcntl.h>
#include <limits.h>
-#ifdef _MSC_VER /* windows */
+#if defined(_MSC_VER) || defined(__MINGW32__) /* windows */
# include <io.h>
-# include <BaseTsd.h>
-typedef ULONG32 uint32_t;
+# ifndef __MINGW32__
+typedef unsigned __int32 uint32_t;
+# endif
#else /* posix */
# include <unistd.h>
# define _S_IREAD (S_IRUSR|S_IRGRP|S_IROTH)
Modified: MOAB/trunk/kd_tree_tool.cpp
===================================================================
--- MOAB/trunk/kd_tree_tool.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/kd_tree_tool.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -9,9 +9,11 @@
#include <limits>
#include <stdlib.h>
#include <time.h>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
+#endif
const int MAX_TAG_VALUE = 32; // maximum value to use when tagging entities with tree cell number
const char* TAG_NAME = "TREE_CELL";
@@ -69,6 +71,7 @@
exit( err );
}
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
static void memory_use( unsigned long& vsize, unsigned long& rss )
{
char buffer[512];
@@ -89,6 +92,10 @@
"%lu %lu", &vsize, &rss );
rss *= getpagesize();
}
+#else
+static void memory_use( unsigned long& vsize, unsigned long& rss )
+ { vsize = rss = 0; }
+#endif
static int parseint( int& i, int argc, char* argv[] )
{
Modified: MOAB/trunk/m4/hdf5.m4
===================================================================
--- MOAB/trunk/m4/hdf5.m4 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/m4/hdf5.m4 2008-11-19 19:06:22 UTC (rev 2275)
@@ -26,7 +26,7 @@
esac
HAVE_ZLIB=no
if test "x$WITH_ZLIB" != "xno"; then
- old_LDFLAGS="$LIBS"
+ old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $HDF5_LDFLAGS"
AC_CHECK_LIB([z],[deflate],[HAVE_ZLIB=yes],
[if test "x$WITH_ZLIB" != "x"; then AC_MSG_ERROR([Could not find zlib]); fi])
@@ -99,10 +99,15 @@
if test "x$WITH_MPI" != "xno"; then
AC_CHECK_LIB([gpfs],[gpfs_stat],[HDF5_LIBS="-lgpfs $HDF5_LIBS"])
fi
+
+ HDF5_LIBNAME=hdf5
# if a path is specified, update LIBS and INCLUDES accordingly
if test "xyes" != "x$HDF5_ARG" && test "x" != "x$HDF5_ARG"; then
- if test -d "${HDF5_ARG}/lib"; then
+ if test -d "${HDF5_ARG}/dll"; then
+ HDF5_LDFLAGS="$HDF5_LDFLAGS -L${HDF5_ARG}/dll"
+ HDF5_LIBNAME=hdf5dll
+ elif test -d "${HDF5_ARG}/lib"; then
HDF5_LDFLAGS="$HDF5_LDFLAGS -L${HDF5_ARG}/lib"
elif test -d "${HDF5_ARG}"; then
HDF5_LDFLAGS="$HDF5_LDFLAGS -L${HDF5_ARG}"
@@ -132,24 +137,24 @@
AC_CHECK_HEADERS( [hdf5.h], [], [HAVE_HDF5=no] )
HAVE_LIB_HDF5=no
- AC_CHECK_LIB( [hdf5], [H5Fopen], [HAVE_LIB_HDF5=yes] )
+ AC_CHECK_LIB( [$HDF5_LIBNAME], [H5Fopen], [HAVE_LIB_HDF5=yes] )
if test $HAVE_LIB_HDF5 = no; then
if test $HAVE_ZLIB = yes; then
- unset ac_cv_lib_hdf5_H5Fopen
- AC_CHECK_LIB( [hdf5], [H5Fopen], [HAVE_LIB_HDF5=yes; HDF5_LIBS="-lz $HDF5_LIBS"], [], [-lz] )
+ unset ac_cv_lib_${HDF5_LIBNAME}_H5Fopen
+ AC_CHECK_LIB( [$HDF5_LIBNAME], [H5Fopen], [HAVE_LIB_HDF5=yes; HDF5_LIBS="-lz $HDF5_LIBS"], [], [-lz] )
fi
fi
if test $HAVE_LIB_HDF5 = no; then
if test $HAVE_SZIP = yes; then
- unset ac_cv_lib_hdf5_H5Fopen
- AC_CHECK_LIB( [hdf5], [H5Fopen], [HAVE_LIB_HDF5=yes; HDF5_LIBS="-lsz $HDF5_LIBS"], [], [-lsz] )
+ unset ac_cv_lib_${HDF5_LIBNAME}_H5Fopen
+ AC_CHECK_LIB( [$HDF5_LIBNAME], [H5Fopen], [HAVE_LIB_HDF5=yes; HDF5_LIBS="-lsz $HDF5_LIBS"], [], [-lsz] )
fi
fi
if test $HAVE_LIB_HDF5 = no; then
if test $HAVE_SZIP = yes; then
if test $HAVE_ZLIB = yes; then
- unset ac_cv_lib_hdf5_H5Fopen
- AC_CHECK_LIB( [hdf5], [H5Fopen], [HAVE_LIB_HDF5=yes; HDF5_LIBS="-lsz -lz $HDF5_LIBS"], [], [-lz -lsz] )
+ unset ac_cv_lib_${HDF5_LIBNAME}_H5Fopen
+ AC_CHECK_LIB( [$HDF5_LIBNAME], [H5Fopen], [HAVE_LIB_HDF5=yes; HDF5_LIBS="-lsz -lz $HDF5_LIBS"], [], [-lz -lsz] )
fi
fi
fi
@@ -167,7 +172,7 @@
HDF5_LDFLAGS=
HDF5_LIBS=
else
- HDF5_LIBS="$HDF5_LIBS -lhdf5"
+ HDF5_LIBS="$HDF5_LIBS -l$HDF5_LIBNAME"
fi
CPPFLAGS="$old_CPPFLAGS"
Modified: MOAB/trunk/parallel/parallel_unit_tests.cpp
===================================================================
--- MOAB/trunk/parallel/parallel_unit_tests.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/parallel/parallel_unit_tests.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -9,7 +9,7 @@
#include <algorithm>
#include <sstream>
#include <assert.h>
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
#endif
@@ -194,7 +194,7 @@
}
if (pause_proc != -1) {
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
std::cout << "Processor " << rank << " of " << size << " with PID " << getpid() << std::endl;
std::cout.flush();
#endif
Modified: MOAB/trunk/test/obb/obb_tree_tool.cpp
===================================================================
--- MOAB/trunk/test/obb/obb_tree_tool.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/test/obb/obb_tree_tool.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -11,9 +11,11 @@
#include <limits>
#include <stdlib.h>
#include <time.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+# include <unistd.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+#endif
std::string clock_to_string( clock_t t );
std::string mem_to_string( unsigned long mem );
@@ -54,7 +56,11 @@
exit( err );
}
+#if defined(_MSC_VER) || defined(__MINGW32__)
static void memory_use( unsigned long& vsize, unsigned long& rss )
+ { vsize = rss = 0; }
+#else
+static void memory_use( unsigned long& vsize, unsigned long& rss )
{
char buffer[512];
int filp = open( "/proc/self/stat", O_RDONLY );
@@ -74,6 +80,7 @@
"%lu %lu", &vsize, &rss );
rss *= getpagesize();
}
+#endif
static int parseint( int& i, int argc, char* argv[] )
{
Modified: MOAB/trunk/test/perf/perf.cpp
===================================================================
--- MOAB/trunk/test/perf/perf.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/test/perf/perf.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -17,7 +17,7 @@
// hexes created one at a time. This also creates the node to hex adjacencies.
// Different platforms follow different conventions for usage
-#ifndef NT
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <sys/resource.h>
#endif
#ifdef SOLARIS
@@ -370,8 +370,17 @@
}
}
+#if defined(_MSC_VER) || defined(__MINGW32__)
void print_time(const bool print_em, double &tot_time, double &utime, double &stime)
{
+ utime = (double)clock() / CLOCKS_PER_SEC;
+ if (print_em)
+ std::cout << "Total wall time = " << utime << std::endl;
+ tot_time = stime = 0;
+}
+#else
+void print_time(const bool print_em, double &tot_time, double &utime, double &stime)
+{
struct rusage r_usage;
getrusage(RUSAGE_SELF, &r_usage);
utime = (double)r_usage.ru_utime.tv_sec +
@@ -389,6 +398,7 @@
system("ps o args,drs,rss | grep perf | grep -v grep"); // RedHat 9.0 doesnt fill in actual memory data
#endif
}
+#endif
void testA(const int nelem, const double *coords)
{
Modified: MOAB/trunk/tools/converter/convert.cpp
===================================================================
--- MOAB/trunk/tools/converter/convert.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/tools/converter/convert.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -14,7 +14,7 @@
*/
// If Microsoft compiler, then WIN32
-#ifdef __MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# ifndef WIN32
# define WIN32
# endif
@@ -584,9 +584,9 @@
-void print_time( const char* prefix, clock_t ticks, std::ostream& stream )
+void print_time( int clk_per_sec, const char* prefix, clock_t ticks, std::ostream& stream )
{
- ticks *= sysconf(_SC_CLK_TCK)/100;
+ ticks *= clk_per_sec/100;
clock_t centi = ticks % 100;
clock_t seconds = ticks / 100;
if (seconds < 120)
@@ -621,7 +621,7 @@
void write_times( std::ostream& stream )
{
clock_t abs_tm = clock();
- print_time( " ", abs_tm - abs_time, stream );
+ print_time( CLOCKS_PER_SEC, " ", abs_tm - abs_time, stream );
abs_time = abs_tm;
}
@@ -642,9 +642,9 @@
abs_tm = times( &timebuf );
usr_tm = timebuf.tms_utime;
sys_tm = timebuf.tms_stime;
- print_time( " real: ", abs_tm - abs_time, stream );
- print_time( " user: ", usr_tm - usr_time, stream );
- print_time( " system: ", sys_tm - sys_time, stream );
+ print_time( sysconf(_SC_CLK_TCK), " real: ", abs_tm - abs_time, stream );
+ print_time( sysconf(_SC_CLK_TCK), " user: ", usr_tm - usr_time, stream );
+ print_time( sysconf(_SC_CLK_TCK), " system: ", sys_tm - sys_time, stream );
abs_time = abs_tm;
usr_time = usr_tm;
sys_time = sys_tm;
Modified: MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -8,7 +8,7 @@
#include <math.h>
#include <map>
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
#endif
@@ -454,7 +454,7 @@
MPI_Comm_size( MPI_COMM_WORLD, &size );
if (argc > 2 && !strcmp(argv[1], "-p")) {
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
std::cout << "Processor " << rank << " of " << size << " with PID " << getpid() << std::endl;
std::cout.flush();
#endif
Modified: MOAB/trunk/tools/mbperf/mbperf.cpp
===================================================================
--- MOAB/trunk/tools/mbperf/mbperf.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/tools/mbperf/mbperf.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -17,7 +17,7 @@
// hexes created one at a time. This also creates the node to hex adjacencies.
// Different platforms follow different conventions for usage
-#ifndef NT
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <sys/resource.h>
#endif
#ifdef SOLARIS
@@ -391,9 +391,19 @@
}
}
+#if defined(_MSC_VER) || defined(__MINGW32__)
void get_time_mem(double &tot_time, double &user_time,
double &sys_time, double &tot_mem)
{
+ tot_time = 0;
+ user_time = (double)clock() / CLOCKS_PER_SEC;
+ sys_time = 0;
+ tot_mem = 0;
+}
+#else
+void get_time_mem(double &tot_time, double &user_time,
+ double &sys_time, double &tot_mem)
+{
struct rusage r_usage;
getrusage(RUSAGE_SELF, &r_usage);
user_time = (double)r_usage.ru_utime.tv_sec +
@@ -442,6 +452,7 @@
tot_mem = ((double)vm_size);
}
}
+#endif
void testA(const int nelem, const double *coords)
{
Modified: MOAB/trunk/tools/mbperf/mbperf_iMesh.cpp
===================================================================
--- MOAB/trunk/tools/mbperf/mbperf_iMesh.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/tools/mbperf/mbperf_iMesh.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -6,7 +6,7 @@
*/
// Different platforms follow different conventions for usage
-#ifndef NT
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <sys/resource.h>
#endif
#ifdef SOLARIS
@@ -364,9 +364,19 @@
}
}
+#if defined(_MSC_VER) || defined(__MINGW32__)
void get_time_mem(double &tot_time, double &user_time,
double &sys_time, double &tot_mem)
{
+ tot_time = 0;
+ user_time = (double)clock() / CLOCKS_PER_SEC;
+ sys_time = 0;
+ tot_mem = 0;
+}
+#else
+void get_time_mem(double &tot_time, double &user_time,
+ double &sys_time, double &tot_mem)
+{
struct rusage r_usage;
getrusage(RUSAGE_SELF, &r_usage);
user_time = (double)r_usage.ru_utime.tv_sec +
@@ -415,6 +425,7 @@
tot_mem = ((double)vm_size);
}
}
+#endif
void compute_edge(double *start, const int nelem, const double xint,
const int stride)
Modified: MOAB/trunk/tools/size/size.cpp
===================================================================
--- MOAB/trunk/tools/size/size.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/tools/size/size.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -28,9 +28,11 @@
#include <vector>
#include <string>
#include <stdio.h>
-#include <unistd.h>
-#include <termios.h>
-#include <sys/ioctl.h>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+# include <unistd.h>
+# include <termios.h>
+# include <sys/ioctl.h>
+#endif
#include <math.h>
#include <assert.h>
#include <float.h>
@@ -231,10 +233,12 @@
// get terminal width
unsigned term_width = 80;
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
struct winsize size;
if ( ioctl( fileno(stdout), TIOCGWINSZ, (char*)&size ) == 0 )
term_width = size.ws_col;
if (!term_width) term_width = 80;
+#endif
assert(term_width > 7 + type_width + count_width + total_width);
term_width -= 7; // spaces
@@ -278,7 +282,7 @@
tmp_dbl = 0.0;
}
- printf( "%*s %*ld %*.*lg %*.*lg %*.*lg %*.*lg %*.*lg %*.*lg\n",
+ printf( "%*s %*ld %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g\n",
type_width, i == MBMAXTYPE ? edge_use_name : MBCN::EntityTypeName(i),
count_width, s.count,
total_width, total_prec, s.sum,
Modified: MOAB/trunk/tools/skin/skin.cpp
===================================================================
--- MOAB/trunk/tools/skin/skin.cpp 2008-11-18 21:34:44 UTC (rev 2274)
+++ MOAB/trunk/tools/skin/skin.cpp 2008-11-19 19:06:22 UTC (rev 2275)
@@ -2,9 +2,11 @@
#include <time.h>
#include <vector>
#include <cstdlib>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#endif
#include <fcntl.h>
#include "MBInterface.hpp"
#include "MBTagConventions.hpp"
@@ -15,7 +17,7 @@
void get_time_mem(double &tot_time, double &tot_mem);
// Different platforms follow different conventions for usage
-#ifndef NT
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <sys/resource.h>
#endif
#ifdef SOLARIS
@@ -332,8 +334,15 @@
return 0;
}
+#if defined(_MSC_VER) || defined(__MINGW32__)
void get_time_mem(double &tot_time, double &tot_mem)
{
+ tot_time = (double)clock() / CLOCKS_PER_SEC;
+ tot_mem = 0;
+}
+#else
+void get_time_mem(double &tot_time, double &tot_mem)
+{
struct rusage r_usage;
getrusage(RUSAGE_SELF, &r_usage);
double utime = (double)r_usage.ru_utime.tv_sec +
@@ -382,7 +391,7 @@
tot_mem = ((double)vm_size);
}
}
-
+#endif
More information about the moab-dev
mailing list