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