IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 261088f7 authored by Dominik Baack's avatar Dominik Baack Committed by Ralf Ulrich
Browse files

fixed naming convention

parent 99e37e48
No related branches found
No related tags found
No related merge requests found
...@@ -24,50 +24,50 @@ namespace corsika::process { ...@@ -24,50 +24,50 @@ namespace corsika::process {
template <typename T> template <typename T>
class ExecTime : private T { class ExecTime : private T {
private: private:
std::chrono::high_resolution_clock::time_point fStart; std::chrono::high_resolution_clock::time_point startTime_;
std::chrono::duration<double,std::micro> fElapsedSum; std::chrono::duration<double,std::micro> cumulatedTime_;
double fMean; double mean_;
double fMean2; double mean2_;
double fMin; double min_;
double fMax; double max_;
long long fN; long long n_;
protected: protected:
public: public:
ExecTime() { ExecTime() {
fMin = std::numeric_limits<long long>::max(); min_ = std::numeric_limits<long long>::max();
fMax = 0; max_ = 0;
fMean = 0; mean_ = 0;
fMean2 = 0; mean2_ = 0;
fN = 0; n_ = 0;
} }
void start() { fStart = std::chrono::high_resolution_clock::now(); } void start() { startTime_ = std::chrono::high_resolution_clock::now(); }
void stop() { void stop() {
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double,std::micro> timeDiv = std::chrono::duration<double,std::micro> timeDiv =
std::chrono::duration_cast< std::chrono::duration<double,std::micro> >(end - fStart); std::chrono::duration_cast< std::chrono::duration<double,std::micro> >(end - startTime_);
fElapsedSum += timeDiv; cumulatedTime_ += timeDiv;
fN = fN + 1; n_ = n_ + 1;
if (fMax < timeDiv.count()) fMax = timeDiv.count(); if (max_ < timeDiv.count()) max_ = timeDiv.count();
if (timeDiv.count() < fMin) fMin = timeDiv.count(); if (timeDiv.count() < min_) min_ = timeDiv.count();
double delta = timeDiv.count() - fMean; double delta = timeDiv.count() - mean_;
fMean += delta / static_cast<double>(fN); mean_ += delta / static_cast<double>(n_);
double delta2 = timeDiv.count() - fMean; double delta2 = timeDiv.count() - mean_;
fMean2 += delta * delta2; mean2_ += delta * delta2;
} }
double mean() const { return fMean; } double mean() const { return mean_; }
double min() const { return fMin; } double min() const { return min_; }
double max() const { return fMax; } double max() const { return max_; }
double var() const { return fMean2 / fN; } double var() const { return mean2_ / n_; }
double sumTime() const { return fElapsedSum.count(); } double sumTime() const { return cumulatedTime_.count(); }
template <typename Particle, typename VTNType> template <typename Particle, typename VTNType>
EProcessReturn DoBoundaryCrossing(Particle& p, VTNType const& from, EProcessReturn DoBoundaryCrossing(Particle& p, VTNType const& from,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment