brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 0a0679b Raw
56 lines · c
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 at6//7//     http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// 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 and13// limitations under the License.14 15// Source project : https://github.com/ismaelJimenez/cpp.leastsq16// Adapted to be used with google benchmark17 18#ifndef COMPLEXITY_H_19#define COMPLEXITY_H_20 21#include <string>22#include <vector>23 24#include "benchmark/benchmark.h"25 26namespace benchmark {27 28// Return a vector containing the bigO and RMS information for the specified29// list of reports. If 'reports.size() < 2' an empty vector is returned.30std::vector<BenchmarkReporter::Run> ComputeBigO(31    const std::vector<BenchmarkReporter::Run>& reports);32 33// This data structure will contain the result returned by MinimalLeastSq34//   - coef        : Estimated coefficient for the high-order term as35//                   interpolated from data.36//   - rms         : Normalized Root Mean Squared Error.37//   - complexity  : Scalability form (e.g. oN, oNLogN). In case a scalability38//                   form has been provided to MinimalLeastSq this will return39//                   the same value. In case BigO::oAuto has been selected, this40//                   parameter will return the best fitting curve detected.41 42struct LeastSq {43  LeastSq() : coef(0.0), rms(0.0), complexity(oNone) {}44 45  double coef;46  double rms;47  BigO complexity;48};49 50// Function to return an string for the calculated complexity51std::string GetBigOString(BigO complexity);52 53}  // end namespace benchmark54 55#endif  // COMPLEXITY_H_56