$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74494 - trunk/libs/chrono/example
From: vicente.botet_at_[hidden]
Date: 2011-09-21 13:13:02
Author: viboes
Date: 2011-09-21 13:13:01 EDT (Wed, 21 Sep 2011)
New Revision: 74494
URL: http://svn.boost.org/trac/boost/changeset/74494
Log:
Added lightweight_stopwatch_reporter_example.cpp
Added:
   trunk/libs/chrono/example/lightweight_stopwatch_reporter_example.cpp   (contents, props changed)
Added: trunk/libs/chrono/example/lightweight_stopwatch_reporter_example.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/chrono/example/lightweight_stopwatch_reporter_example.cpp	2011-09-21 13:13:01 EDT (Wed, 21 Sep 2011)
@@ -0,0 +1,37 @@
+//  example/stopwatch_example.cpp  ---------------------------------------------------//
+//  Copyright Beman Dawes 2006, 2008
+//  Copyright 2009-2011 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+//  See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+//#include <iostream>
+#include <boost/chrono/stopwatches/reporters/lightweight_stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
+#include <boost/chrono/chrono_io.hpp>
+#include <cmath>
+
+using namespace boost::chrono;
+
+elapsed_formatter fmtr;
+
+int f1(long j)
+{
+
+  lightweight_stopwatch_reporter<simple_stopwatch<> > sw(fmtr);
+
+  for ( long i = 0; i < j; ++i )
+    std::sqrt( 123.456L );  // burn some time
+
+  return 0;
+}
+int main()
+{
+  lightweight_stopwatch_reporter<simple_stopwatch<> > sw(fmtr);
+
+  f1(1000);
+  f1(2000);
+  f1(3000);
+  f1(4000);
+  return 0;
+}