Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2008-01-15 19:17:20


Author: jtorjo
Date: 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
New Revision: 42809
URL: http://svn.boost.org/trac/boost/changeset/42809

Log:
[logging]
v0.13.17, 16 jan 2008
- added sample compile_time (for testing compile time)
Added:
   sandbox/logging/lib/logging/samples/compile_time/
   sandbox/logging/lib/logging/samples/compile_time/ReadMe.txt (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/basic_usage.vcproj (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/compile_time.sln (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy01.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy02.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy03.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy04.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy05.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy06.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy07.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy08.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy09.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy10.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy11.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy12.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy13.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy14.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy15.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy16.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy17.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy18.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy19.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/copy20.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/log.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/log.h (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/main.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/compile_time/original.cpp (contents, props changed)
Properties modified:
   sandbox/logging/lib/logging/tests/test_named_spacer/ (props changed)
   sandbox/logging/lib/logging/tests/test_rolling_file/ (props changed)
   sandbox/logging/lib/logging/tests/test_tags/ (props changed)
Text files modified:
   sandbox/logging/boost/logging/detail/cache_before_init.hpp | 4 ++--
   sandbox/logging/boost/logging/detail/macros.hpp | 31 +++++++++++++++++++++++++++++--
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3 ++-
   sandbox/logging/boost/logging/tag/defaults.hpp | 5 ++++-
   4 files changed, 37 insertions(+), 6 deletions(-)

Modified: sandbox/logging/boost/logging/detail/cache_before_init.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/cache_before_init.hpp (original)
+++ sandbox/logging/boost/logging/detail/cache_before_init.hpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -28,12 +28,12 @@
 #include <boost/logging/detail/fwd.hpp>
 #include <map>
 #include <vector>
-#include <boost/thread/detail/config.hpp>
+//#include <boost/thread/detail/config.hpp>
+#include <boost/config.hpp>
 #include <boost/assert.hpp>
 
 namespace boost { namespace logging { namespace detail {
 
-// have a cache class!!!!!!!!! log the thread as well
 
 #if defined (BOOST_HAS_WINTHREADS)
 typedef DWORD thread_id_type;

Modified: sandbox/logging/boost/logging/detail/macros.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/macros.hpp (original)
+++ sandbox/logging/boost/logging/detail/macros.hpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -61,6 +61,7 @@
         - @ref BOOST_LOG_COMPILE_FAST_ON
         - @ref BOOST_LOG_COMPILE_FAST_OFF
         - @ref BOOST_LOG_COMPILE_FAST
+ - @ref boost_log_compile_results
     - @ref macros_tss
         - @ref BOOST_LOG_TSS_USE_INTERNAL
         - @ref BOOST_LOG_TSS_USE_BOOST
@@ -399,13 +400,13 @@
 Assume you're using formatters and destinations, and you
 <tt>#include <boost/logging/format.hpp> </tt> or
 <tt>#include <boost/logging/format_ts.hpp> </tt>. If you include this in every file (indirectly, you'll
-be including some @c log.h file, which will then include the above), this will increase compilation time a lot.
+be including some @c log.h file, which will then include the above), this will increase compilation time quite a bit.
 
 So, you can choose to:
 - have fast compilation time, and a virtual function call per each logged message (default)
 - have everything inline (no virtual function calls), very fast, and slow compilation
 
-Most of the time you won't notice the extra virtual function call, and the compilation time will be a lot faster.
+Most of the time you won't notice the extra virtual function call, and the compilation time will be faster.
 However, just in case you'll sometime want the very fast configuration, just turn the fast compilation off, by using the
 @ref BOOST_LOG_COMPILE_FAST_OFF directive.
 
@@ -429,6 +430,32 @@
 @note
 Don't define this! It's defined automatically.
 
+@subsubsection boost_log_compile_results Compile time sample (and results)
+
+Recently I created a sample (compile_time) to test the effect of @c BOOST_LOG_COMPILE_FAST_ON.
+The results were not as promising as I had hoped. However, still, when @c BOOST_LOG_COMPILE_FAST_ON is on,
+will compile faster by 20-40%. Noting that this is just an simple example, the results might not be that conclusive.
+Anyway, here they are:
+
+
+Tested on 16 jan 2008/intel core duo 2.16Ghz machine, 5400Rpm HDD
+
+- VC 8.0 (no precompiled header)
+ - Debug
+ - Compile with BOOST_LOG_COMPILE_FAST_ON (default) - 33 secs
+ - Compile with BOOST_LOG_COMPILE_FAST_OFF - 43 secs
+- gcc 3.4.2
+ - Debug
+ - Compile with BOOST_LOG_COMPILE_FAST_ON (default) - 24 secs
+ - Compile with BOOST_LOG_COMPILE_FAST_OFF - 31 secs
+- gcc 4.1
+ - Debug
+ - Compile with BOOST_LOG_COMPILE_FAST_ON (default) - 20.5 secs
+ - Compile with BOOST_LOG_COMPILE_FAST_OFF - 24 secs
+
+If you have other results, or results from a big program using Boost Logging, please share them with me. Thanks!
+
+
 
 
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -1,7 +1,8 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.13.16, 15 jan 2008
+@section changelog_cur_ver Current Version: v0.13.17, 16 jan 2008
+- added sample compile_time (for testing compile time)
 - added destination::named test
 - automatically include writer/ts_write.hpp from format.hpp
 - added test_tags test

Modified: sandbox/logging/boost/logging/tag/defaults.hpp
==============================================================================
--- sandbox/logging/boost/logging/tag/defaults.hpp (original)
+++ sandbox/logging/boost/logging/tag/defaults.hpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -23,7 +23,8 @@
 
 #include <boost/logging/detail/fwd.hpp>
 #include <boost/logging/logging.hpp>
-#include <boost/thread/detail/config.hpp>
+//#include <boost/thread/detail/config.hpp>
+#include <boost/config.hpp>
 
 namespace boost { namespace logging { namespace tag {
 
@@ -86,6 +87,8 @@
         val = ::GetCurrentThreadId();
 #elif defined (BOOST_HAS_PTHREADS)
         val = pthread_self ();
+#else
+#error Unknown type of threads
 #endif
     }
 

Added: sandbox/logging/lib/logging/samples/compile_time/ReadMe.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/ReadMe.txt 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,35 @@
+Example of compile time.
+
+Build all the .cpp files in debug mode.
+Then, build them all, with BOOST_LOG_COMPILE_FAST_OFF directive, for ALL files.
+
+
+Tested on 16 jan 2008/intel core duo 2.16Ghz machine, 5400Rpm HDD
+
+
+
+
+VC 8.0
+(no precompiled header)
+
+Debug
+Compile with BOOST_LOG_COMPILE_FAST_ON (default) - 33 secs
+
+Compile with BOOST_LOG_COMPILE_FAST_OFF - 43 secs
+
+
+
+gcc 3.4.2
+Debug
+Compile with BOOST_LOG_COMPILE_FAST_ON (default) - 24 secs
+
+Compile with BOOST_LOG_COMPILE_FAST_OFF - 31 secs
+
+
+
+gcc 4.1
+Debug
+Compile with BOOST_LOG_COMPILE_FAST_ON (default) - 20.5 secs
+
+Compile with BOOST_LOG_COMPILE_FAST_OFF - 24 secs
+

Added: sandbox/logging/lib/logging/samples/compile_time/basic_usage.vcproj
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/basic_usage.vcproj 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="compile_time"
+ ProjectGUID="{011E74A4-F775-4EE3-B195-03B308F7D2F0}"
+ RootNamespace="basic_usage"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\filesystem\build\libboost_filesystem.lib\vc-8_0\debug\threading-multi"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="DebugCompileSlow|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;BOOST_LOG_COMPILE_FAST_OFF"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\filesystem\build\libboost_filesystem.lib\vc-8_0\debug\threading-multi"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="copy"
+ >
+ <File
+ RelativePath=".\copy01.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy02.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy03.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy04.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy05.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy06.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy07.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy08.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy09.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy10.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy11.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy12.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy13.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy14.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy15.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy16.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy17.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy18.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy19.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\copy20.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\log.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\log.h"
+ >
+ </File>
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\original.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/logging/lib/logging/samples/compile_time/compile_time.sln
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/compile_time.sln 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,23 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic_usage", "basic_usage.vcproj", "{011E74A4-F775-4EE3-B195-03B308F7D2F0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ DebugCompileSlow|Win32 = DebugCompileSlow|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {011E74A4-F775-4EE3-B195-03B308F7D2F0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {011E74A4-F775-4EE3-B195-03B308F7D2F0}.Debug|Win32.Build.0 = Debug|Win32
+ {011E74A4-F775-4EE3-B195-03B308F7D2F0}.DebugCompileSlow|Win32.ActiveCfg = DebugCompileSlow|Win32
+ {011E74A4-F775-4EE3-B195-03B308F7D2F0}.DebugCompileSlow|Win32.Build.0 = DebugCompileSlow|Win32
+ {011E74A4-F775-4EE3-B195-03B308F7D2F0}.Release|Win32.ActiveCfg = Release|Win32
+ {011E74A4-F775-4EE3-B195-03B308F7D2F0}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: sandbox/logging/lib/logging/samples/compile_time/copy01.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy01.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy02.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy02.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy03.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy03.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy04.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy04.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy05.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy05.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy06.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy06.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy07.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy07.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy08.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy08.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy09.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy09.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy10.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy10.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy11.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy11.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy12.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy12.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy13.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy13.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy14.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy14.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy15.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy15.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy16.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy16.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy17.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy17.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy18.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy18.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy19.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy19.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/copy20.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/copy20.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,2 @@
+#include "log.h"
+#include "original.cpp"

Added: sandbox/logging/lib/logging/samples/compile_time/log.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/log.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,24 @@
+
+#include "log.h"
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+// Step 6: Define the filters and loggers you'll use
+BOOST_DEFINE_LOG_FILTER(g_l_filter, finder::filter )
+BOOST_DEFINE_LOG(g_l, finder::logger)
+
+
+void init_logs() {
+ // Add formatters and destinations
+ // That is, how the message is to be formatted...
+ g_l->writer().add_formatter( formatter::idx() );
+ g_l->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+ g_l->writer().add_formatter( formatter::append_newline() );
+
+ // ... and where should it be written to
+ g_l->writer().add_destination( destination::cout() );
+ g_l->writer().add_destination( destination::dbg_window() );
+ g_l->writer().add_destination( destination::file("out.txt") );
+ g_l->turn_cache_off();
+}

Added: sandbox/logging/lib/logging/samples/compile_time/log.h
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/log.h 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,35 @@
+#ifndef LOG_H_header
+#define LOG_H_header
+
+#include <boost/logging/format_fwd.hpp>
+#include <boost/logging/tags.hpp>
+
+// Step 1: Optimize : use tags (on top of a cache string, to make formatting the message faster)
+namespace bl = boost::logging;
+typedef bl::tag::holder< bl::optimize::cache_string_one_str<>, bl::tag::file_line, bl::tag::thread_id, bl::tag::time> log_string;
+BOOST_LOG_FORMAT_MSG( log_string )
+
+#ifndef BOOST_LOG_COMPILE_FAST
+#include <boost/logging/format.hpp>
+#endif
+
+// Step 3 : Specify your logging class(es)
+using namespace boost::logging::scenario::usage;
+typedef use<
+ filter_::change::single_thread,
+ filter_::level::use_levels,
+ logger_::change::single_thread,
+ logger_::favor::correctness> finder;
+
+// Step 4: declare which filters and loggers you'll use
+BOOST_DECLARE_LOG_FILTER(g_l_filter, finder::filter )
+BOOST_DECLARE_LOG(g_l, finder::logger)
+
+// Step 5: define the macros through which you'll log
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_l_filter, debug ) .set_tag( BOOST_LOG_TAG_FILELINE)
+#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_l_filter, error ) .set_tag( BOOST_LOG_TAG_FILELINE)
+#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_l_filter, info ) .set_tag( BOOST_LOG_TAG_FILELINE)
+
+void init_logs();
+
+#endif

Added: sandbox/logging/lib/logging/samples/compile_time/main.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/main.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,23 @@
+// main.cpp : Where the main() action is
+
+/**
+@page compile_time See how difference from Fast-compile and Slow-compile (related to logging)
+
+Note that we're just testing compilation times. We add a lot of source files, just to make sure
+we can see a difference between fast and slow compile.
+
+*/
+
+// Wherever you use logs, include this ;)
+#include "log.h"
+
+#include <string>
+#include <sstream>
+#include <iostream>
+
+
+int main(int argc, char * argv[])
+{
+ return 0;
+}
+

Added: sandbox/logging/lib/logging/samples/compile_time/original.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/compile_time/original.cpp 2008-01-15 19:17:18 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,53 @@
+#include "log.h"
+
+using namespace boost::logging;
+
+namespace {
+
+ int val() {
+ static int i = 0;
+ return ++i;
+ }
+
+ void use() {
+ int i = (!std::cout);
+ LDBG_ << "this is so cool " << i++;
+ LDBG_ << "this is so cool again " << i++;
+ LERR_ << "first error " << i++;
+
+ std::string hello = "hello", world = "world";
+ LAPP_ << hello << ", " << world;
+
+ g_l_filter->set_enabled(level::error);
+ LDBG_ << "this will not be written anywhere";
+ LAPP_ << "this won't be written anywhere either";
+
+ g_l_filter->set_enabled(level::info);
+ LAPP_ << "good to be back ;) " << i++;
+ LERR_ << "second error " << i++;
+
+ LAPP_ << "this is so cool " << i++;
+ LAPP_ << "this is so cool again " << i++;
+ LERR_ << "third error " << i++;
+
+
+
+ LAPP_ << "this is so cool " << val();
+ LAPP_ << "this is so cool again " << val();
+ LERR_ << "first error " << val();
+
+ LAPP_ << hello << ", " << world;
+
+ g_l_filter->set_enabled(level::error);
+ LAPP_ << "this will not be written anywhere";
+ LAPP_ << "this won't be written anywhere either";
+
+ g_l_filter->set_enabled(level::info);
+ LAPP_ << "good to be back ;) " << val();
+ LERR_ << "second error " << val();
+
+ LDBG_ << "this is so cool " << val();
+ LAPP_ << "this is so cool again " << val();
+ LERR_ << "third error " << val();
+ }
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk