/usr/include/trilinos/Tsqr_TimeStats.hpp is in libtrilinos-tpetra-dev 12.12.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /*
//@HEADER
// ************************************************************************
//
// Kokkos: Node API and Parallel Node Kernels
// Copyright (2008) Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#ifndef __TSQR_TimeStats_hpp
#define __TSQR_TimeStats_hpp
#include <iostream>
#include <string>
namespace TSQR {
/// \brief Collect running timing statistics.
///
/// TimeStats collects running statistics on a particular timing,
/// which is collected count() times. When you get a new timing,
/// call update().
class TimeStats {
public:
//! Default constructor: resets statistics to initial values.
TimeStats ();
//! Reset the statistics.
void init ();
//! Add a new data point and update the running statistics.
void update (const double curTime);
/// \brief Print to the given output stream \c out.
///
/// \param out [in/out] Output stream to which to print
/// \param humanReadable [in] Whether to print in a format easy
/// for humans to read, or easy for automatic parsing
/// \param label [in] If not humanReadable, then print this string
/// as a row identifier at the beginning of the row
/// \param labelLabel [in] If not humanReadable, then use this
/// as the column header for the "label" (first) column
/// \param printHeaders [in] If not humanReadable, then print
/// column headers, preceded by a "%" so that the parser will
/// ignore the line
void
print (std::ostream& out,
const bool humanReadable,
const std::string& label,
const std::string& labelLabel,
const bool printHeaders) const;
//! Min value seen thus far (+Inf if no data have been collected).
double min () const { return min_; }
//! Max value seen thus far (-Inf if no data have been collected).
double max () const { return max_; }
//! Arithmetic mean thus far (0 if no data has been collected)
double mean () const { return mean_; }
//! Total thus far (0 if no data has been collected)
double total () const { return total_; }
//! Count of data points collected thus far
int count () const { return count_; }
/// \brief Construct a TimeStats object from its constituent data.
///
/// This is useful for computing global statistics over many MPI
/// processes, or for otherwise combining different TimeStats
/// objects.
///
/// \note This design is suboptimal, because it makes it hard for
/// new statistics to be added to the class.
TimeStats (const int newCount,
const double newMin,
const double newMax,
const double newMean,
const double newTotal) :
min_ (newMin),
max_ (newMax),
mean_ (newMean),
total_ (newTotal),
count_ (newCount)
{}
private:
double min_, max_, mean_, total_;
int count_;
};
} // namespace TSQR
#endif // __TSQR_TimeStats_hpp
|