[mapguide-commits] r4291 - in trunk/MgDev: Common/Renderers
Server/src/Gws/GwsQueryEngine Server/src/Services/Mapping
Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Oct 8 15:13:00 EDT 2009
Author: brucedechant
Date: 2009-10-08 15:12:59 -0400 (Thu, 08 Oct 2009)
New Revision: 4291
Modified:
trunk/MgDev/Common/Renderers/AGGRenderer.cpp
trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp
trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
Log:
Fix for trac ticket 1116 - GetTickCount() debugging/unit testing method on Linux is not returning correct results
http://trac.osgeo.org/mapguide/ticket/1116
Notes:
- Update GetTickCount() method on Linux to return milliseconds instead of clock ticks
- There were several GetTickCount() Linux methods defined in several different files and the duplicates have been removed
Modified: trunk/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/AGGRenderer.cpp 2009-10-07 21:10:32 UTC (rev 4290)
+++ trunk/MgDev/Common/Renderers/AGGRenderer.cpp 2009-10-08 19:12:59 UTC (rev 4291)
@@ -74,12 +74,19 @@
#ifndef _WIN32
// Linux version of GetTickCount()
+// Note: The Windows version of GetTickCount() returns the results in milliseconds.
#include <sys/times.h>
long GetTickCount()
{
- tms tm;
- return times(&tm);
+ struct timeval time;
+ long mtime, seconds, useconds;
+
+ gettimeofday(&time, NULL);
+ seconds = time.tv_sec;
+ useconds = time.tv_usec;
+ mtime = ((seconds) * 1000 + (long)(useconds/1000.0));
+ return mtime;
}
#endif
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp 2009-10-07 21:10:32 UTC (rev 4290)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp 2009-10-08 19:12:59 UTC (rev 4291)
@@ -26,15 +26,7 @@
#include "GwsQueryEngineImp.h"
#ifndef _WIN32
-
-// Linux version of GetTickCount()
-#include <sys/times.h>
-
-long GetTickCount()
-{
- tms tm;
- return times(&tm);
-}
+extern long GetTickCount();
#endif
Modified: trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp 2009-10-07 21:10:32 UTC (rev 4290)
+++ trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp 2009-10-08 19:12:59 UTC (rev 4291)
@@ -38,14 +38,7 @@
#ifndef _WIN32
#define _wcsnicmp wcsncasecmp
-// Linux version of GetTickCount()
-#include <sys/times.h>
-
-long GetTickCount()
-{
- tms tm;
- return times(&tm);
-}
+extern long GetTickCount();
#endif
Modified: trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp 2009-10-07 21:10:32 UTC (rev 4290)
+++ trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp 2009-10-08 19:12:59 UTC (rev 4291)
@@ -22,14 +22,7 @@
#ifndef _WIN32
#define stricmp strcasecmp
-// Linux version of GetTickCount()
-#include <sys/times.h>
-
-long GetTickCount()
-{
- tms tm;
- return times(&tm);
-}
+extern long GetTickCount();
#endif
#ifdef _WIN32
@@ -117,6 +110,8 @@
int nCoordinateSystemsTested = 0;
int nCoordinateSystemsPassed = 0;
+ long lStart = GetTickCount();
+
// Open the test file and read the OGC WKT.
// If the test file cannot be opened return an error.
FILE* stream = NULL;
@@ -186,6 +181,7 @@
}
ACE_DEBUG((LM_INFO, ACE_TEXT("\nTotal coordinate system OGC WKTs tested: %d/%d (Passed/Total)\n"), nCoordinateSystemsPassed, nCoordinateSystemsTested));
+ ACE_DEBUG((LM_INFO, ACE_TEXT("Total Processing Time: = %6.4f (s)\n"), ((GetTickCount()-lStart)/1000.0)));
}
catch(MgException* e)
{
@@ -322,6 +318,7 @@
{
int nTotalCoordinateSystemsTested = 0;
int nTotalCoordinateSystemsPassed = 0;
+ long lStart = GetTickCount();
MgCoordinateSystemFactory factory;
Ptr<MgStringCollection> categories;
@@ -399,6 +396,7 @@
}
ACE_DEBUG((LM_INFO, ACE_TEXT("\nTotal coordinate systems tested: %d/%d (Passed/Total)\n"), nTotalCoordinateSystemsPassed, nTotalCoordinateSystemsTested));
+ ACE_DEBUG((LM_INFO, ACE_TEXT("Total Processing Time: = %6.4f (s)\n"), ((GetTickCount()-lStart)/1000.0)));
}
catch(MgException* e)
{
@@ -5826,6 +5824,8 @@
INT32 epsg = factory->ConvertWktToEpsgCode(EPSG_4326_Wkt);
CPPUNIT_ASSERT(epsg == 4326);
+ long lStart = GetTickCount();
+
// Test all supported EPSG codes
// Open the test file and read the EPSG codes.
// If the test file cannot be opened return an error.
@@ -5906,6 +5906,7 @@
}
ACE_DEBUG((LM_INFO, ACE_TEXT("\nTotal EPSG codes tested: %d/%d (Passed/Total)\n"), nEpsgCodesPassed, nEpsgCodesTested));
+ ACE_DEBUG((LM_INFO, ACE_TEXT("Total Processing Time: = %6.4f (s)\n"), ((GetTickCount()-lStart)/1000.0)));
}
catch(MgException* e)
{
More information about the mapguide-commits
mailing list