00001 #ifndef _Q_TIMING_ANALYZER_HH_ 00002 #define _Q_TIMING_ANALYZER_HH_ 00003 00012 #include <vector> 00013 00014 class QTimingAnalyzer { 00015 public: 00017 QTimingAnalyzer(); 00018 00020 virtual ~QTimingAnalyzer(); 00021 00023 void AddValue(const double value) 00024 {fValues.push_back(value); fNeedsSort = true;} 00025 00027 void ComputeGoodnessThreshold(const double falseRate); 00028 00030 void FindPeriod(const double uncertainty, 00031 const double stepSize = 0.008); 00032 00034 unsigned int GetBestGoodness(); 00035 00037 unsigned int GetGoodness(const double value); 00038 00040 unsigned int GetGoodnessParameter(const double value); 00041 00043 unsigned int GetGoodnessThreshold() const {return fGoodnessThreshold;} 00044 00046 double GetPeriod() const {return fPeriod;} 00047 00049 unsigned int GetTotalGoodness(); 00050 00052 void SetAdjustments(const std::vector<double>& adjustments) 00053 {fAdjustments = adjustments;} 00054 00056 void SetExpectedPeriod(const double period) {fPeriod = period;} 00057 00059 void SetTolerance(const double tolerance) {fTolerance = tolerance;} 00060 00061 private: 00064 double DistanceToClosestElement(const double value, 00065 double& closestValue); 00066 00068 std::vector<double> fAdjustments; 00069 00071 unsigned int fGoodnessThreshold; 00072 00074 bool fNeedsSort; 00075 00077 double fPeriod; 00078 00080 double fTolerance; 00081 00083 std::vector<double> fValues; 00084 00085 }; 00086 00087 #endif