[mapguide-commits] r6094 - in trunk/MgDev/Common/MapGuideCommon: .
Util
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Aug 25 03:16:21 EDT 2011
Author: liuar
Date: 2011-08-25 00:16:21 -0700 (Thu, 25 Aug 2011)
New Revision: 6094
Added:
trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.cpp
trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.h
Modified:
trunk/MgDev/Common/MapGuideCommon/Makefile.am
trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.h
trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj
trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj
trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters
trunk/MgDev/Common/MapGuideCommon/MapGuideCommonBuild.cpp
Log:
The RFC 110 Profiling Service (V).
Implement a timer for MapGuide to record the time span.
Modified: trunk/MgDev/Common/MapGuideCommon/Makefile.am
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Makefile.am 2011-08-24 17:55:08 UTC (rev 6093)
+++ trunk/MgDev/Common/MapGuideCommon/Makefile.am 2011-08-25 07:16:21 UTC (rev 6094)
@@ -129,7 +129,8 @@
System/MapGuideStream.cpp \
System/UserInformation.cpp \
System/CryptographyManager.cpp \
- Util/IpUtil.cpp
+ Util/IpUtil.cpp \
+ Util/TimerUtil.cpp
noinst_HEADERS = $(include_SOURCES) \
MapGuideCommon.h \
@@ -255,7 +256,8 @@
System/MapGuideStream.h \
System/UserInformation.h \
System/CryptographyManager.h \
- Util/IpUtil.h
+ Util/IpUtil.h \
+ Util/TimerUtil.h
INCLUDES = \
-I../PlatformBase \
Modified: trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.h 2011-08-24 17:55:08 UTC (rev 6093)
+++ trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.h 2011-08-25 07:16:21 UTC (rev 6094)
@@ -56,6 +56,7 @@
#include "System/MapGuideStream.h"
#include "System/CryptographyManager.h"
#include "Util/IpUtil.h"
+#include "Util/TimerUtil.h"
#include "MapLayer/Layer.h"
#include "MapLayer/Map.h"
Modified: trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj 2011-08-24 17:55:08 UTC (rev 6093)
+++ trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj 2011-08-25 07:16:21 UTC (rev 6094)
@@ -5242,6 +5242,46 @@
RelativePath=".\Util\IpUtil.h"
>
</File>
+ <File
+ RelativePath=".\Util\TimerUtil.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Util\TimerUtil.h"
+ >
+ </File>
</Filter>
<File
RelativePath=".\MapGuideCommon.h"
Modified: trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj 2011-08-24 17:55:08 UTC (rev 6093)
+++ trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj 2011-08-25 07:16:21 UTC (rev 6094)
@@ -925,6 +925,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="MapGuideCommonBuild.cpp" />
+ <ClCompile Include="Util\TimerUtil.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MapLayer\Layer.h" />
@@ -1051,6 +1057,7 @@
<ClInclude Include="System\UserInformation.h" />
<ClInclude Include="Util\IpUtil.h" />
<ClInclude Include="MapGuideCommon.h" />
+ <ClInclude Include="Util\TimerUtil.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MapGuideCommon.rc" />
Modified: trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters 2011-08-24 17:55:08 UTC (rev 6093)
+++ trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters 2011-08-25 07:16:21 UTC (rev 6094)
@@ -391,6 +391,9 @@
<ClCompile Include="Services\ProfilingService.cpp">
<Filter>Services</Filter>
</ClCompile>
+ <ClCompile Include="Util\TimerUtil.cpp">
+ <Filter>Util</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MapLayer\Layer.h">
@@ -763,6 +766,9 @@
<ClInclude Include="Services\ProfilingDefs.h">
<Filter>Services</Filter>
</ClInclude>
+ <ClInclude Include="Util\TimerUtil.h">
+ <Filter>Util</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MapGuideCommon.rc" />
Modified: trunk/MgDev/Common/MapGuideCommon/MapGuideCommonBuild.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapGuideCommonBuild.cpp 2011-08-24 17:55:08 UTC (rev 6093)
+++ trunk/MgDev/Common/MapGuideCommon/MapGuideCommonBuild.cpp 2011-08-25 07:16:21 UTC (rev 6094)
@@ -137,4 +137,4 @@
#include "System/UserInformation.cpp"
#include "System/CryptographyManager.cpp"
#include "Util/IpUtil.cpp"
-
+#include "Util/TimerUtil.cpp"
Added: trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.cpp (rev 0)
+++ trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.cpp 2011-08-25 07:16:21 UTC (rev 6094)
@@ -0,0 +1,80 @@
+//
+// Copyright (C) 2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "TimerUtil.h"
+
+#ifdef WIN32
+LARGE_INTEGER MgTimerUtil::frequency = {0};
+LARGE_INTEGER MgTimerUtil::count = {0};
+#else
+timeval MgTimerUtil::count = {0};
+#endif
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+
+MgTimerUtil::MgTimerUtil()
+{
+}
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+
+MgTimerUtil::~MgTimerUtil()
+{
+}
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Retrieves the current time in milliseconds.
+/// </summary>
+///----------------------------------------------------------------------------
+
+double MgTimerUtil::GetTime()
+{
+#ifdef WIN32
+ if(0 == frequency.QuadPart)
+ {
+ GetFrequency(&frequency);
+ }
+ QueryPerformanceCounter(&count);
+
+ return count.QuadPart* (1000.0 / frequency.QuadPart);
+#else
+ gettimeofday(&count, NULL);
+ return (count.tv_sec * 1000.0) + count.tv_usec;
+#endif
+}
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Invoke the QueryPerformanceFrequency to initialize class member frequency.
+/// </summary>
+///----------------------------------------------------------------------------
+
+void MgTimerUtil::GetFrequency(LARGE_INTEGER* pFrequency)
+{
+ if(!QueryPerformanceFrequency(pFrequency))
+ throw new MgUnclassifiedException(L"MgTimerUtil.GetFrequency", __LINE__, __WFILE__, NULL, L"", NULL);
+}
\ No newline at end of file
Added: trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.h (rev 0)
+++ trunk/MgDev/Common/MapGuideCommon/Util/TimerUtil.h 2011-08-25 07:16:21 UTC (rev 6094)
@@ -0,0 +1,92 @@
+//
+// Copyright (C) 2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MGTIMERUTIL_H_
+#define MGTIMERUTIL_H_
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <sys/time.h>
+#endif
+
+/// \cond INTERNAL
+class MG_MAPGUIDE_API MgTimerUtil
+{
+ DECLARE_CLASSNAME(MgTimerUtil)
+
+INTERNAL_API:
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Constructs the object.
+ ///
+ ///
+
+ MgTimerUtil();
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Destructs the object.
+ ///
+ ///
+
+ virtual ~MgTimerUtil();
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Retrieves the current time in milliseconds
+ ///
+ /// \return
+ /// current time in milliseconds
+ ///
+ ///
+
+ static double GetTime();
+
+private:
+
+ /// Unimplemented Methods
+
+ MgTimerUtil(const MgTimerUtil& util);
+ MgTimerUtil& operator=(const MgTimerUtil& util);
+
+ /// Helper Methods
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Invoke the QueryPerformanceFrequency to initialize frequency.
+ /// \param pFrequency
+ /// Pointer which idicates the frequncy.
+ ///
+
+ static void GetFrequency(LARGE_INTEGER* pFrequency);
+
+private:
+
+#ifdef WIN32
+ static LARGE_INTEGER frequency;
+ static LARGE_INTEGER count;
+#else
+ static timeval count;
+#endif
+};
+/// \endcond
+
+/// Inline Methods
+
+#endif
\ No newline at end of file
More information about the mapguide-commits
mailing list