feat():initial version
This commit is contained in:
69
install/boost_1_75_0/include/boost/timer/config.hpp
Normal file
69
install/boost_1_75_0/include/boost/timer/config.hpp
Normal file
@@ -0,0 +1,69 @@
|
||||
// boost/timer/config.hpp -----------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2003, 2006, 2011
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// See http://www.boost.org/libs/timer for documentation.
|
||||
|
||||
#ifndef BOOST_TIMER_CONFIG_HPP
|
||||
#define BOOST_TIMER_CONFIG_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/system/api_config.hpp>
|
||||
|
||||
// This header implements separate compilation features as described in
|
||||
// http://www.boost.org/more/separate_compilation.html
|
||||
|
||||
// enable dynamic or static linking as requested --------------------------------------//
|
||||
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TIMER_DYN_LINK)
|
||||
# if defined(BOOST_TIMER_SOURCE)
|
||||
# define BOOST_TIMER_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define BOOST_TIMER_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define BOOST_TIMER_DECL
|
||||
#endif
|
||||
|
||||
// enable automatic library variant selection ----------------------------------------//
|
||||
|
||||
#if !defined(BOOST_TIMER_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TIMER_NO_LIB)
|
||||
//
|
||||
// Set the name of our library, this will get undef'ed by auto_link.hpp
|
||||
// once it's done with it:
|
||||
//
|
||||
#define BOOST_LIB_NAME boost_timer
|
||||
//
|
||||
// If we're importing code from a dll, then tell auto_link.hpp about it:
|
||||
//
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TIMER_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
#endif
|
||||
//
|
||||
// And include the header that does the work:
|
||||
//
|
||||
#include <boost/config/auto_link.hpp>
|
||||
|
||||
// We also need to autolink to the Chrono library; even though
|
||||
// it's not used in the interface, and no Chrono header is included,
|
||||
// it's used in the implementation and is necessary in order to link
|
||||
|
||||
#if !defined(BOOST_CHRONO_NO_LIB)
|
||||
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
#endif
|
||||
|
||||
#define BOOST_LIB_NAME boost_chrono
|
||||
|
||||
#include <boost/config/auto_link.hpp>
|
||||
|
||||
#endif // !defined(BOOST_CHRONO_NO_LIB)
|
||||
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#endif // BOOST_TIMER_CONFIG_HPP
|
||||
@@ -0,0 +1,90 @@
|
||||
|
||||
// Copyright Beman Dawes 1994-99.
|
||||
// Copyright Peter Dimov 2019.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/timer for documentation.
|
||||
|
||||
#ifndef BOOST_TIMER_PROGRESS_DISPLAY_HPP_INCLUDED
|
||||
#define BOOST_TIMER_PROGRESS_DISPLAY_HPP_INCLUDED
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <iostream> // for ostream, cout, etc
|
||||
#include <string> // for string
|
||||
|
||||
namespace boost {
|
||||
namespace timer {
|
||||
|
||||
// progress_display --------------------------------------------------------//
|
||||
|
||||
// progress_display displays an appropriate indication of
|
||||
// progress at an appropriate place in an appropriate form.
|
||||
|
||||
class progress_display : private noncopyable
|
||||
{
|
||||
public:
|
||||
explicit progress_display( unsigned long expected_count_,
|
||||
std::ostream & os = std::cout,
|
||||
const std::string & s1 = "\n", //leading strings
|
||||
const std::string & s2 = "",
|
||||
const std::string & s3 = "" )
|
||||
// os is hint; implementation may ignore, particularly in embedded systems
|
||||
: noncopyable(), m_os(os), m_s1(s1), m_s2(s2), m_s3(s3) { restart(expected_count_); }
|
||||
|
||||
void restart( unsigned long expected_count_ )
|
||||
// Effects: display appropriate scale
|
||||
// Postconditions: count()==0, expected_count()==expected_count_
|
||||
{
|
||||
_count = _next_tic_count = _tic = 0;
|
||||
_expected_count = expected_count_;
|
||||
|
||||
m_os << m_s1 << "0% 10 20 30 40 50 60 70 80 90 100%\n"
|
||||
<< m_s2 << "|----|----|----|----|----|----|----|----|----|----|"
|
||||
<< std::endl // endl implies flush, which ensures display
|
||||
<< m_s3;
|
||||
if ( !_expected_count ) _expected_count = 1; // prevent divide by zero
|
||||
} // restart
|
||||
|
||||
unsigned long operator+=( unsigned long increment )
|
||||
// Effects: Display appropriate progress tic if needed.
|
||||
// Postconditions: count()== original count() + increment
|
||||
// Returns: count().
|
||||
{
|
||||
if ( (_count += increment) >= _next_tic_count ) { display_tic(); }
|
||||
return _count;
|
||||
}
|
||||
|
||||
unsigned long operator++() { return operator+=( 1 ); }
|
||||
unsigned long count() const { return _count; }
|
||||
unsigned long expected_count() const { return _expected_count; }
|
||||
|
||||
private:
|
||||
std::ostream & m_os; // may not be present in all imps
|
||||
const std::string m_s1; // string is more general, safer than
|
||||
const std::string m_s2; // const char *, and efficiency or size are
|
||||
const std::string m_s3; // not issues
|
||||
|
||||
unsigned long _count, _expected_count, _next_tic_count;
|
||||
unsigned int _tic;
|
||||
void display_tic()
|
||||
{
|
||||
// use of floating point ensures that both large and small counts
|
||||
// work correctly. static_cast<>() is also used several places
|
||||
// to suppress spurious compiler warnings.
|
||||
unsigned int tics_needed = static_cast<unsigned int>((static_cast<double>(_count)
|
||||
/ static_cast<double>(_expected_count)) * 50.0);
|
||||
do { m_os << '*' << std::flush; } while ( ++_tic < tics_needed );
|
||||
_next_tic_count =
|
||||
static_cast<unsigned long>((_tic/50.0) * static_cast<double>(_expected_count));
|
||||
if ( _count == _expected_count ) {
|
||||
if ( _tic < 51 ) m_os << '*';
|
||||
m_os << std::endl;
|
||||
}
|
||||
} // display_tic
|
||||
};
|
||||
|
||||
} // namespace timer
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TIMER_PROGRESS_DISPLAY_HPP_INCLUDED
|
||||
129
install/boost_1_75_0/include/boost/timer/timer.hpp
Normal file
129
install/boost_1_75_0/include/boost/timer/timer.hpp
Normal file
@@ -0,0 +1,129 @@
|
||||
// boost/timer/timer.hpp -------------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 1994-2007, 2011
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_TIMER_TIMER_HPP
|
||||
#define BOOST_TIMER_TIMER_HPP
|
||||
|
||||
#include <boost/timer/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <ostream>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp> // must be the last #include
|
||||
|
||||
# if defined(_MSC_VER)
|
||||
# pragma warning(push) // Save warning settings
|
||||
# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
|
||||
# endif // needs to have dll-interface...
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace timer
|
||||
{
|
||||
class cpu_timer;
|
||||
class auto_cpu_timer;
|
||||
|
||||
typedef boost::int_least64_t nanosecond_type;
|
||||
|
||||
struct cpu_times
|
||||
{
|
||||
nanosecond_type wall;
|
||||
nanosecond_type user;
|
||||
nanosecond_type system;
|
||||
|
||||
void clear() { wall = user = system = 0; }
|
||||
};
|
||||
|
||||
const short default_places = 6;
|
||||
|
||||
BOOST_TIMER_DECL
|
||||
std::string format(const cpu_times& times, short places, const std::string& format);
|
||||
|
||||
BOOST_TIMER_DECL
|
||||
std::string format(const cpu_times& times, short places = default_places);
|
||||
|
||||
// cpu_timer -------------------------------------------------------------------------//
|
||||
|
||||
class BOOST_TIMER_DECL cpu_timer
|
||||
{
|
||||
public:
|
||||
|
||||
// constructor
|
||||
cpu_timer() BOOST_NOEXCEPT { start(); }
|
||||
|
||||
// observers
|
||||
bool is_stopped() const BOOST_NOEXCEPT { return m_is_stopped; }
|
||||
cpu_times elapsed() const BOOST_NOEXCEPT; // does not stop()
|
||||
std::string format(short places, const std::string& format) const
|
||||
{ return ::boost::timer::format(elapsed(), places, format); }
|
||||
std::string format(short places = default_places) const
|
||||
{ return ::boost::timer::format(elapsed(), places); }
|
||||
// actions
|
||||
void start() BOOST_NOEXCEPT;
|
||||
void stop() BOOST_NOEXCEPT;
|
||||
void resume() BOOST_NOEXCEPT;
|
||||
|
||||
private:
|
||||
cpu_times m_times;
|
||||
bool m_is_stopped;
|
||||
};
|
||||
|
||||
// auto_cpu_timer --------------------------------------------------------------------//
|
||||
|
||||
class BOOST_TIMER_DECL auto_cpu_timer : public cpu_timer
|
||||
{
|
||||
public:
|
||||
|
||||
// Explicit defaults for os are not provided to avoid including <iostream>, which has
|
||||
// high costs even when the standard streams are not actually used. Explicit defaults
|
||||
// for format are not provided to avoid order-of-dynamic-initialization issues with a
|
||||
// std::string.
|
||||
|
||||
explicit auto_cpu_timer(short places = default_places); // #1
|
||||
auto_cpu_timer(short places, const std::string& format); // #2
|
||||
explicit auto_cpu_timer(const std::string& format); // #3
|
||||
auto_cpu_timer(std::ostream& os, short places,
|
||||
const std::string& format) // #4
|
||||
: m_places(places), m_os(&os), m_format(format)
|
||||
{ start(); }
|
||||
explicit auto_cpu_timer(std::ostream& os, short places = default_places); // #5
|
||||
auto_cpu_timer(std::ostream& os, const std::string& format) // #6
|
||||
: m_places(default_places), m_os(&os), m_format(format)
|
||||
{ start(); }
|
||||
|
||||
~auto_cpu_timer();
|
||||
|
||||
// observers
|
||||
// not particularly useful to users, but allow testing of constructor
|
||||
// postconditions and ease specification of other functionality without resorting
|
||||
// to "for exposition only" private members.
|
||||
std::ostream& ostream() const { return *m_os; }
|
||||
short places() const { return m_places; }
|
||||
const std::string& format_string() const { return m_format; }
|
||||
|
||||
// actions
|
||||
void report();
|
||||
|
||||
private:
|
||||
short m_places;
|
||||
std::ostream* m_os; // stored as ptr so compiler can generate operator=
|
||||
std::string m_format;
|
||||
};
|
||||
|
||||
} // namespace timer
|
||||
} // namespace boost
|
||||
|
||||
# if defined(_MSC_VER)
|
||||
# pragma warning(pop) // restore warning settings.
|
||||
# endif
|
||||
|
||||
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
|
||||
|
||||
#endif // BOOST_TIMER_TIMER_HPP
|
||||
Reference in New Issue
Block a user