demos/spectrum/3rdparty/fftreal/stopwatch/StopWatch.cpp
changeset 25 e24348a560a6
equal deleted inserted replaced
23:89e065397ea6 25:e24348a560a6
       
     1 /*****************************************************************************
       
     2 
       
     3         StopWatch.cpp
       
     4         Copyright (c) 2005 Laurent de Soras
       
     5 
       
     6 --- Legal stuff ---
       
     7 
       
     8 This library is free software; you can redistribute it and/or
       
     9 modify it under the terms of the GNU Lesser General Public
       
    10 License as published by the Free Software Foundation; either
       
    11 version 2.1 of the License, or (at your option) any later version.
       
    12 
       
    13 This library is distributed in the hope that it will be useful,
       
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16 Lesser General Public License for more details.
       
    17 
       
    18 You should have received a copy of the GNU Lesser General Public
       
    19 License along with this library; if not, write to the Free Software
       
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    21 
       
    22 *Tab=3***********************************************************************/
       
    23 
       
    24 
       
    25 
       
    26 #if defined (_MSC_VER)
       
    27 	#pragma warning (1 : 4130) // "'operator' : logical operation on address of string constant"
       
    28 	#pragma warning (1 : 4223) // "nonstandard extension used : non-lvalue array converted to pointer"
       
    29 	#pragma warning (1 : 4705) // "statement has no effect"
       
    30 	#pragma warning (1 : 4706) // "assignment within conditional expression"
       
    31 	#pragma warning (4 : 4786) // "identifier was truncated to '255' characters in the debug information"
       
    32 	#pragma warning (4 : 4800) // "forcing value to bool 'true' or 'false' (performance warning)"
       
    33 	#pragma warning (4 : 4355) // "'this' : used in base member initializer list"
       
    34 #endif
       
    35 
       
    36 
       
    37 
       
    38 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    39 
       
    40 #include	"StopWatch.h"
       
    41 
       
    42 #include	<cassert>
       
    43 
       
    44 
       
    45 
       
    46 namespace stopwatch
       
    47 {
       
    48 
       
    49 
       
    50 
       
    51 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    52 
       
    53 
       
    54 
       
    55 StopWatch::StopWatch ()
       
    56 :	_ccc ()
       
    57 ,	_nbr_laps (0)
       
    58 {
       
    59 	// Nothing
       
    60 }
       
    61 
       
    62 
       
    63 
       
    64 double	StopWatch::get_time_total (Int64 nbr_op) const
       
    65 {
       
    66 	assert (_nbr_laps > 0);
       
    67 	assert (nbr_op > 0);
       
    68 
       
    69 	return (
       
    70 		  static_cast <double> (_ccc.get_time_total ())
       
    71 	   / (static_cast <double> (nbr_op) * static_cast <double> (_nbr_laps))
       
    72 	);
       
    73 }
       
    74 
       
    75 
       
    76 
       
    77 double	StopWatch::get_time_best_lap (Int64 nbr_op) const
       
    78 {
       
    79 	assert (nbr_op > 0);
       
    80 
       
    81 	return (
       
    82 		  static_cast <double> (_ccc.get_time_best_lap ())
       
    83 		/ static_cast <double> (nbr_op)
       
    84 	);
       
    85 }
       
    86 
       
    87 
       
    88 
       
    89 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    90 
       
    91 
       
    92 
       
    93 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    94 
       
    95 
       
    96 
       
    97 }	// namespace stopwatch
       
    98 
       
    99 
       
   100 
       
   101 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/