giuliomoro@42: /* giuliomoro@42: * intervals.h giuliomoro@42: * giuliomoro@42: * Created on: 18 May 2015 giuliomoro@42: * Author: unmanaged giuliomoro@42: */ giuliomoro@42: giuliomoro@42: #ifndef INTERVALS_H_ giuliomoro@42: #define INTERVALS_H_ giuliomoro@42: giuliomoro@42: #define TEN_POW_9 1000000000 giuliomoro@42: giuliomoro@42: #include giuliomoro@42: #include giuliomoro@42: #include giuliomoro@42: giuliomoro@42: #include giuliomoro@42: #include giuliomoro@42: giuliomoro@42: class Interval giuliomoro@42: { giuliomoro@42: private: giuliomoro@42: int intervalsPointer; giuliomoro@42: long sum; giuliomoro@42: RTIME startTime; giuliomoro@42: RTIME *intervals; giuliomoro@42: float maxTimeus; giuliomoro@42: float timeus; giuliomoro@42: float samplingRate; //used for getPrint() giuliomoro@42: int numFrames; giuliomoro@42: bool enabled; //whether it actually reads the clock or not giuliomoro@42: int numAverages; giuliomoro@42: char *name; giuliomoro@42: void init(int aNumAverages, int aNumFrames, float aSamplingRate, const char *aName); giuliomoro@42: public: giuliomoro@42: Interval(); giuliomoro@42: Interval(int aNumAverages); giuliomoro@42: Interval(int aNumAverages, int aNumFrames, float aSamplingRate, const char *aName); giuliomoro@42: ~Interval(); giuliomoro@42: void setNumFrames(int aNumFrames); giuliomoro@42: int start(); giuliomoro@42: int resetMax(); giuliomoro@42: int split(); giuliomoro@42: void setEnabled(bool aActive); giuliomoro@42: float getTimeus(); giuliomoro@42: float getMaxTimeus(); giuliomoro@42: void print(); giuliomoro@42: }; giuliomoro@42: giuliomoro@42: #endif /* INTERVALS_H_ */