Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6755/adobe/future Modified Files: Jamfile.v2 assemblage.hpp closed_hash.hpp cmd_system.hpp count_minmax.hpp enum_ops.hpp file_slurp.hpp find_closest.hpp iomanip.hpp iomanip_asl_cel.hpp iomanip_fwd.hpp iomanip_pdf.hpp iomanip_xml.hpp manip.hpp memory.hpp menu_system.hpp modal_dialog_interface.hpp ternary_function.hpp timer.hpp Log Message: asl 1.0.13 Index: assemblage.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/assemblage.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** assemblage.hpp 6 Jan 2006 18:02:57 -0000 1.5 --- assemblage.hpp 3 Feb 2006 18:33:36 -0000 1.6 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 30,62 **** { public: ! typedef boost::signals::connection connection_t; ! typedef boost::function<void ()> destruct_slot_t; private: ! typedef std::list<connection_t> connections_t; #if 0 ! typedef boost::signal<void ()> destruct_signal_t; #endif ! typedef std::vector<destruct_slot_t> destruct_signal_t; public: ! assemblage_t(); ! ~assemblage_t(); ! connection_t& hold_connection(const connection_t& connection); ! void signal_destruction(const destruct_slot_t& slot); ! template <typename T> ! void delete_on_destruction(T& x) ! { ! adobe::delete_ptr<T> deleter; ! signal_destruction(boost::bind(deleter,x)); ! } private: ! connections_t connections_m; ! destruct_signal_t destruct_signal_m; ! int group_m; }; --- 30,62 ---- { public: ! typedef boost::signals::connection connection_t; ! typedef boost::function<void ()> destruct_slot_t; private: ! typedef std::list<connection_t> connections_t; #if 0 ! typedef boost::signal<void ()> destruct_signal_t; #endif ! typedef std::vector<destruct_slot_t> destruct_signal_t; public: ! assemblage_t(); ! ~assemblage_t(); ! connection_t& hold_connection(const connection_t& connection); ! void signal_destruction(const destruct_slot_t& slot); ! template <typename T> ! void delete_on_destruction(T& x) ! { ! adobe::delete_ptr<T> deleter; ! signal_destruction(boost::bind(deleter,x)); ! } private: ! connections_t connections_m; ! destruct_signal_t destruct_signal_m; ! int group_m; }; *************** *** 71,85 **** struct equal_to_first : std::unary_function<PairType, bool> { ! equal_to_first(const typename PairType::first_type& first) : ! first_m(first) ! { } ! ! bool operator() (const PairType& pair) const ! { return pair.first == first_m; } private: ! typename PairType::first_type first_m; }; ! } // namespace --- 71,85 ---- struct equal_to_first : std::unary_function<PairType, bool> { ! equal_to_first(const typename PairType::first_type& first) : ! first_m(first) ! { } ! ! bool operator() (const PairType& pair) const ! { return pair.first == first_m; } private: ! typename PairType::first_type first_m; }; ! } // namespace Index: find_closest.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/find_closest.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** find_closest.hpp 6 Jan 2006 18:02:57 -0000 1.3 --- find_closest.hpp 3 Feb 2006 18:33:36 -0000 1.4 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 25,66 **** /* ! find_closest takes a range and a value, and returns the closest value in the sequence to the ! value passed, for some definition of "closest". By default it compares the cardinal difference ! between the values to find the closest, though the client can pass their own TernaryPredicate ! to override this functionality. ! Preconditions: ! - The sequence to be searched must be sorted according to the comparison method used in ! the supplied TernaryPredicate. ! Postconditions: ! - As long as the size of the sequence is greater than 0, the result will always be a valid ! value inside the sequence. (i.e., the only time the end of the sequence is returned is ! when the sequence is empty). ! Additional Concepts: ! - Subtractable : Subtraction yields a difference type; T - T -> D ! - TernaryPredicate : A TernanyPredicate is called with three arguments ! and returns true or false. */ /*************************************************************************************************/ ! template < typename T // T models Subtractable ! > struct closer_predicate : ternary_function<T, T, T, bool> { ! typedef ternary_function<T, T, T, bool> _super; ! typedef typename _super::first_argument_type first_argument_type; ! typedef typename _super::second_argument_type second_argument_type; ! typedef typename _super::third_argument_type third_argument_type; ! typedef typename _super::result_type result_type; ! result_type operator () (const first_argument_type& a, const second_argument_type& b, const third_argument_type& x) const ! { ! // precondition: a <= b ! return x - a < b - x; ! } }; --- 25,66 ---- /* ! find_closest takes a range and a value, and returns the closest value in the sequence to the ! value passed, for some definition of "closest". By default it compares the cardinal difference ! between the values to find the closest, though the client can pass their own TernaryPredicate ! to override this functionality. ! Preconditions: ! - The sequence to be searched must be sorted according to the comparison method used in ! the supplied TernaryPredicate. ! Postconditions: ! - As long as the size of the sequence is greater than 0, the result will always be a valid ! value inside the sequence. (i.e., the only time the end of the sequence is returned is ! when the sequence is empty). ! Additional Concepts: ! - Subtractable : Subtraction yields a difference type; T - T -> D ! - TernaryPredicate : A TernanyPredicate is called with three arguments ! and returns true or false. */ /*************************************************************************************************/ ! template < typename T // T models Subtractable ! > struct closer_predicate : ternary_function<T, T, T, bool> { ! typedef ternary_function<T, T, T, bool> _super; ! typedef typename _super::first_argument_type first_argument_type; ! typedef typename _super::second_argument_type second_argument_type; ! typedef typename _super::third_argument_type third_argument_type; ! typedef typename _super::result_type result_type; ! result_type operator () (const first_argument_type& a, const second_argument_type& b, const third_argument_type& x) const ! { ! // precondition: a <= b ! return x - a < b - x; ! } }; *************** *** 71,131 **** /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::forward_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! I first_third(first); ! I last_third(first); ! std::advance(first_third, third); ! std::advance(last_third, new_n); ! if (!pred(*first_third, *last_third, value)) ! first = first_third; ! n = new_n; ! } ! I second(first); ! std::advance(second, 1); ! return pred(*first, *second, value) ? first : second; } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::random_access_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! if (!pred(*(first + third), *(first + new_n), value)) ! first += third; ! n = new_n; ! } ! I second(first + 1); ! return pred(*first, *second, value) ? first : second; } --- 71,131 ---- /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::forward_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! I first_third(first); ! I last_third(first); ! std::advance(first_third, third); ! std::advance(last_third, new_n); ! if (!pred(*first_third, *last_third, value)) ! first = first_third; ! n = new_n; ! } ! I second(first); ! std::advance(second, 1); ! return pred(*first, *second, value) ? first : second; } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::random_access_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! if (!pred(*(first + third), *(first + new_n), value)) ! first += third; ! n = new_n; ! } ! I second(first + 1); ! return pred(*first, *second, value) ? first : second; } *************** *** 136,187 **** /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, D n, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T // T models Subtractable ! > inline I find_closest(I first, D n, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, closer_predicate<T>(), category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, I last, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T // T models Subtractable ! > inline I find_closest(I first, I last, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, closer_predicate<T>(), category()); } --- 136,187 ---- /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, D n, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T // T models Subtractable ! > inline I find_closest(I first, D n, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, closer_predicate<T>(), category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, I last, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T // T models Subtractable ! > inline I find_closest(I first, I last, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, closer_predicate<T>(), category()); } Index: timer.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/timer.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** timer.hpp 6 Jan 2006 18:02:57 -0000 1.7 --- timer.hpp 3 Feb 2006 18:33:36 -0000 1.8 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 16,32 **** \ingroup asl_libraries ! \brief A class for measuring periods of elapsed time. Can also ! accrue split times for some basic statistical reporting. Comparisons between two <code>adobe::timer_t</code> considers only the last split time. \model_of ! - \ref concept_regular_type ! - \ref stldoc_LessThanComparable \rationale ! A class that measures elapsed time can be useful when debugging, optimizing, or comparing ! implementations. <code>adobe::timer_t</code> utilizes the most accurate timing API a ! platform has to offer to maximize accuracy, while keeping the public API generic. \example --- 16,32 ---- \ingroup asl_libraries ! \brief A class for measuring periods of elapsed time. Can also ! accrue split times for some basic statistical reporting. Comparisons between two <code>adobe::timer_t</code> considers only the last split time. \model_of ! - \ref concept_regular_type ! - \ref stldoc_LessThanComparable \rationale ! A class that measures elapsed time can be useful when debugging, optimizing, or comparing ! implementations. <code>adobe::timer_t</code> utilizes the most accurate timing API a ! platform has to offer to maximize accuracy, while keeping the public API generic. \example *************** *** 35,52 **** \par \code ! adobe::timer_t timer1; ! do_my_func(); ! timer1.split(); ! adobe::timer_t timer2; ! do_their_func(); ! timer2.split(); ! if (timer1 == timer2) ! std::cout << "Functions are equally fast" << std::endl; ! else if (timer1 < timer2) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par --- 35,52 ---- \par \code ! adobe::timer_t timer1; ! do_my_func(); ! timer1.split(); ! adobe::timer_t timer2; ! do_their_func(); ! timer2.split(); ! if (timer1 == timer2) ! std::cout << "Functions are equally fast" << std::endl; ! else if (timer1 < timer2) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par *************** *** 54,80 **** in order to gain a more accurate understanding of the cost of an implementation: \code ! adobe::timer_t timer1; ! adobe::timer_t timer2; ! for (std::size_t i(0); i < sample_count_k; ++i) ! { ! timer1.reset(); ! do_my_func(); ! timer1.accrue(); ! timer2.reset(); ! do_their_func(); ! timer2.accrue(); ! } ! double my_avg(timer1.accrued_average()); ! double their_avg(timer2.accrued_average()); ! if (my_avg == their_avg) ! std::cout << "Functions are equally fast" << std::endl; ! else if (my_avg < their_avg) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par --- 54,80 ---- in order to gain a more accurate understanding of the cost of an implementation: \code ! adobe::timer_t timer1; ! adobe::timer_t timer2; ! for (std::size_t i(0); i < sample_count_k; ++i) ! { ! timer1.reset(); ! do_my_func(); ! timer1.accrue(); ! timer2.reset(); ! do_their_func(); ! timer2.accrue(); ! } ! double my_avg(timer1.accrued_average()); ! double their_avg(timer2.accrued_average()); ! if (my_avg == their_avg) ! std::cout << "Functions are equally fast" << std::endl; ! else if (my_avg < their_avg) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par *************** *** 98,116 **** #if ADOBE_PLATFORM_MAC ! #include<Carbon/Carbon.h> #elif ADOBE_PLATFORM_WIN ! #ifndef WINDOWS_LEAN_AND_MEAN ! #define WINDOWS_LEAN_AND_MEAN ! #define ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN 1 ! #endif ! #include <windows.h> ! #if ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #undef WINDOWS_LEAN_AND_MEAN ! #undef ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #endif #elif defined(BOOST_HAS_THREADS) ! #include <boost/thread/xtime.hpp> #elif defined(BOOST_HAS_GETTIMEOFDAY) ! #include <sys/time.h> #endif --- 98,116 ---- #if ADOBE_PLATFORM_MAC ! #include<Carbon/Carbon.h> #elif ADOBE_PLATFORM_WIN ! #ifndef WINDOWS_LEAN_AND_MEAN ! #define WINDOWS_LEAN_AND_MEAN ! #define ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN 1 ! #endif ! #include <windows.h> ! #if ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #undef WINDOWS_LEAN_AND_MEAN ! #undef ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #endif #elif defined(BOOST_HAS_THREADS) ! #include <boost/thread/xtime.hpp> #elif defined(BOOST_HAS_GETTIMEOFDAY) ! #include <sys/time.h> #endif *************** *** 128,341 **** { #if ADOBE_PLATFORM_MAC ! typedef UnsignedWide value_type; #elif ADOBE_PLATFORM_WIN ! typedef LARGE_INTEGER value_type; #elif defined(BOOST_HAS_THREADS) ! typedef boost::xtime value_type; #elif defined(BOOST_HAS_GETTIMEOFDAY) ! typedef timeval value_type; #endif ! typedef std::vector<double> accumulator_type; public: ! typedef accumulator_type::size_type size_type; #ifndef ADOBE_NO_DOCUMENTATION ! timer_t() ! { #if ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceFrequency(&frequency_m); #endif ! reset(); ! } ! timer_t(const timer_t& rhs) : ! epoch_m(rhs.epoch_m), ! split_m(rhs.split_m), ! time_set_m(rhs.time_set_m) #if ADOBE_PLATFORM_WIN ! , frequency_m(rhs.frequency_m) #endif ! { } ! timer_t& operator = (const timer_t& rhs) ! { ! epoch_m = rhs.epoch_m; ! split_m = rhs.split_m; ! time_set_m = rhs.time_set_m; #if ADOBE_PLATFORM_WIN ! frequency_m = rhs.frequency_m; #endif ! return *this; ! } #endif ! /*! ! Resets the epoch of the timer to now ! */ ! inline void reset() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&epoch_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&epoch_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&epoch_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&epoch_m, static_cast<struct timezone*>(0)); #endif ! } ! /*! ! Resets the split time accumulator ! */ ! inline void reset_accumulator() ! { time_set_m.clear(); } ! /*! ! \return ! The difference of time between the epoch and now, in milliseconds ! */ ! inline double split() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&split_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&split_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&split_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&split_m, static_cast<struct timezone*>(0)); #endif ! return last_split(); ! } ! /*! ! \return ! The difference of time between the epoch and the last split, in milliseconds ! */ ! ! inline double last_split() const ! { #if ADOBE_PLATFORM_MAC ! return (split_m.lo - epoch_m.lo) / double(1e3); #elif ADOBE_PLATFORM_WIN ! return (split_m.QuadPart - epoch_m.QuadPart) / static_cast<double>(frequency_m.QuadPart) * double(1e3); #elif defined(BOOST_HAS_THREADS) ! return ((split_m.sec - epoch_m.sec) * double(1e3) + (split_m.nsec - epoch_m.nsec) / double(1e6)); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! return ((split_m.tv_sec - epoch_m.tv_sec) * double(1e3) + (split_m.tv_usec - epoch_m.tv_usec) / double(1e3)); #else ! return -1; #endif ! } ! /*! ! Grabs a new split time and stores it in the accumulator. ! */ ! inline void accrue() ! { time_set_m.push_back(split()); } ! /*! ! \return ! The smallest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_min() const ! { return *adobe::min_element(time_set_m); } ! /*! ! \return ! The largest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_max() const ! { return *adobe::max_element(time_set_m); } ! /*! ! \return ! The average of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_average() const ! { return empty() ? 0 : accrued_total() / size(); } ! /*! ! \return ! The median of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_median() const ! { ! if (empty()) return 0; ! adobe::sort(time_set_m); ! return (size() % 2 == 1) ? ! time_set_m[time_set_m.size() / 2] : ! (time_set_m[time_set_m.size() / 2] + ! time_set_m[time_set_m.size() / 2 - 1]) / 2; ! } ! /*! ! \return ! The summation of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_total() const ! { return adobe::accumulate(time_set_m, double(0)); } ! /*! ! \return ! The number of split times in the accumulator ! */ ! inline size_type size() const ! { return time_set_m.size(); } ! /*! ! \return ! Whether or not there are any split times in the accumulator ! */ ! inline bool empty() const ! { return time_set_m.empty(); } ! /*! ! An archaic utility function that takes a new split time and outputs it to a stream ! \param decoration An identifier to apply to the split time. ! \param s The stream to which output is written. Defaults to <code>std::cout</code> ! */ ! inline void report(const char* decoration, std::ostream& s = std::cout) ! { ! double time(split()); ! s << decoration << " took " << time << " milliseconds (" << time / 1e3 << " sec)" << std::endl; ! } private: #ifndef ADOBE_NO_DOCUMENTATION ! friend bool operator == (const timer_t& x, const timer_t& y); ! friend bool operator < (const timer_t& x, const timer_t& y); #endif ! value_type epoch_m; ! value_type split_m; ! mutable accumulator_type time_set_m; #if ADOBE_PLATFORM_WIN ! value_type frequency_m; #endif }; --- 128,341 ---- { #if ADOBE_PLATFORM_MAC ! typedef UnsignedWide value_type; #elif ADOBE_PLATFORM_WIN ! typedef LARGE_INTEGER value_type; #elif defined(BOOST_HAS_THREADS) ! typedef boost::xtime value_type; #elif defined(BOOST_HAS_GETTIMEOFDAY) ! typedef timeval value_type; #endif ! typedef std::vector<double> accumulator_type; public: ! typedef accumulator_type::size_type size_type; #ifndef ADOBE_NO_DOCUMENTATION ! timer_t() ! { #if ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceFrequency(&frequency_m); #endif ! reset(); ! } ! timer_t(const timer_t& rhs) : ! epoch_m(rhs.epoch_m), ! split_m(rhs.split_m), ! time_set_m(rhs.time_set_m) #if ADOBE_PLATFORM_WIN ! , frequency_m(rhs.frequency_m) #endif ! { } ! timer_t& operator = (const timer_t& rhs) ! { ! epoch_m = rhs.epoch_m; ! split_m = rhs.split_m; ! time_set_m = rhs.time_set_m; #if ADOBE_PLATFORM_WIN ! frequency_m = rhs.frequency_m; #endif ! return *this; ! } #endif ! /*! ! Resets the epoch of the timer to now ! */ ! inline void reset() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&epoch_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&epoch_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&epoch_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&epoch_m, static_cast<struct timezone*>(0)); #endif ! } ! /*! ! Resets the split time accumulator ! */ ! inline void reset_accumulator() ! { time_set_m.clear(); } ! /*! ! \return ! The difference of time between the epoch and now, in milliseconds ! */ ! inline double split() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&split_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&split_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&split_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&split_m, static_cast<struct timezone*>(0)); #endif ! return last_split(); ! } ! /*! ! \return ! The difference of time between the epoch and the last split, in milliseconds ! */ ! ! inline double last_split() const ! { #if ADOBE_PLATFORM_MAC ! return (split_m.lo - epoch_m.lo) / double(1e3); #elif ADOBE_PLATFORM_WIN ! return (split_m.QuadPart - epoch_m.QuadPart) / static_cast<double>(frequency_m.QuadPart) * double(1e3); #elif defined(BOOST_HAS_THREADS) ! return ((split_m.sec - epoch_m.sec) * double(1e3) + (split_m.nsec - epoch_m.nsec) / double(1e6)); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! return ((split_m.tv_sec - epoch_m.tv_sec) * double(1e3) + (split_m.tv_usec - epoch_m.tv_usec) / double(1e3)); #else ! return -1; #endif ! } ! /*! ! Grabs a new split time and stores it in the accumulator. ! */ ! inline void accrue() ! { time_set_m.push_back(split()); } ! /*! ! \return ! The smallest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_min() const ! { return *adobe::min_element(time_set_m); } ! /*! ! \return ! The largest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_max() const ! { return *adobe::max_element(time_set_m); } ! /*! ! \return ! The average of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_average() ... [truncated message content] |