complexity.h
Go to the documentation of this file.
1 // Copyright 2016 Ismael Jimenez Martinez. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 // Source project : https://github.com/ismaelJimenez/cpp.leastsq
16 // Adapted to be used with google benchmark
17 
18 #ifndef COMPLEXITY_H_
19 #define COMPLEXITY_H_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "benchmark/benchmark.h"
25 
26 namespace benchmark {
27 
28 // Return a vector containing the mean and standard devation information for
29 // the specified list of reports. If 'reports' contains less than two
30 // non-errored runs an empty vector is returned
31 std::vector<BenchmarkReporter::Run> ComputeStats(
32  const std::vector<BenchmarkReporter::Run>& reports);
33 
34 // Return a vector containing the bigO and RMS information for the specified
35 // list of reports. If 'reports.size() < 2' an empty vector is returned.
36 std::vector<BenchmarkReporter::Run> ComputeBigO(
37  const std::vector<BenchmarkReporter::Run>& reports);
38 
39 // This data structure will contain the result returned by MinimalLeastSq
40 // - coef : Estimated coeficient for the high-order term as
41 // interpolated from data.
42 // - rms : Normalized Root Mean Squared Error.
43 // - complexity : Scalability form (e.g. oN, oNLogN). In case a scalability
44 // form has been provided to MinimalLeastSq this will return
45 // the same value. In case BigO::oAuto has been selected, this
46 // parameter will return the best fitting curve detected.
47 
48 struct LeastSq {
49  LeastSq() : coef(0.0), rms(0.0), complexity(oNone) {}
50 
51  double coef;
52  double rms;
54 };
55 
56 // Function to return an string for the calculated complexity
57 std::string GetBigOString(BigO complexity);
58 
59 } // end namespace benchmark
60 #endif // COMPLEXITY_H_
benchmark
Definition: benchmark.h:241
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
benchmark::LeastSq
Definition: complexity.h:48
benchmark::LeastSq::coef
double coef
Definition: complexity.h:51
benchmark::ComputeBigO
std::vector< BenchmarkReporter::Run > ComputeBigO(const std::vector< BenchmarkReporter::Run > &reports)
Definition: complexity.cc:256
benchmark::GetBigOString
std::string GetBigOString(BigO complexity)
Definition: complexity.cc:48
benchmark::LeastSq::LeastSq
LeastSq()
Definition: complexity.h:49
benchmark::oNone
@ oNone
Definition: benchmark.h:375
benchmark::ComputeStats
std::vector< BenchmarkReporter::Run > ComputeStats(const std::vector< BenchmarkReporter::Run > &reports)
Definition: complexity.cc:153
benchmark::BigO
BigO
Definition: benchmark.h:375
benchmark::LeastSq::complexity
BigO complexity
Definition: complexity.h:53
benchmark.h
benchmark::LeastSq::rms
double rms
Definition: complexity.h:52


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:48