|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74456 - trunk/libs/chrono/example
From: vicente.botet_at_[hidden]
Date: 2011-09-18 16:22:48
Author: viboes
Date: 2011-09-18 16:22:47 EDT (Sun, 18 Sep 2011)
New Revision: 74456
URL: http://svn.boost.org/trac/boost/changeset/74456
Log:
Chrono: Added basic Stopwatch reporter basic example
Added:
trunk/libs/chrono/example/stopwatch_reporter_example.cpp (contents, props changed)
Added: trunk/libs/chrono/example/stopwatch_reporter_example.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/chrono/example/stopwatch_reporter_example.cpp 2011-09-18 16:22:47 EDT (Sun, 18 Sep 2011)
@@ -0,0 +1,33 @@
+// 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/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
+#include <boost/chrono/chrono_io.hpp>
+#include <cmath>
+
+using namespace boost::chrono;
+
+int f1(long j)
+{
+ stopwatch_reporter<simple_stopwatch<> > sw;
+
+ for ( long i = 0; i < j; ++i )
+ std::sqrt( 123.456L ); // burn some time
+
+ return 0;
+}
+int main()
+{
+ stopwatch_reporter<simple_stopwatch<> > sw;
+
+ f1(1000);
+ f1(2000);
+ f1(3000);
+ return 0;
+}
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