Skip to content

Commit

Permalink
Add a cumulative error counter to TimesliceAnalyzer.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuveland committed Nov 3, 2016
1 parent 7863e88 commit aa45b9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/fles_core/TimesliceAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ bool TimesliceAnalyzer::check_timeslice(const fles::Timeslice& ts)

if (ts.num_components() == 0) {
out_ << "no component in timeslice " << ts.index() << std::endl;
++timeslice_error_count_;
return false;
}

for (size_t c = 0; c < ts.num_components(); ++c) {
if (ts.num_microslices(c) == 0) {
out_ << "no microslices in timeslice " << ts.index()
<< ", component " << c << std::endl;
++timeslice_error_count_;
return false;
}
pattern_checkers_.at(c)->reset();
Expand All @@ -116,6 +118,7 @@ bool TimesliceAnalyzer::check_timeslice(const fles::Timeslice& ts)
out_ << "pattern error in timeslice " << ts.index()
<< ", microslice " << m << ", component " << c
<< std::endl;
++timeslice_error_count_;
return false;
}
}
Expand All @@ -130,6 +133,9 @@ std::string TimesliceAnalyzer::statistics() const
<< human_readable_count(content_bytes_) << " in " << microslice_count_
<< " microslices, avg: "
<< static_cast<double>(content_bytes_) / microslice_count_ << ")";
if (timslice_error_count_ > 0) {
s << " [" << timeslice_error_count_ << " errors]";
}
return s.str();
}

Expand Down
1 change: 1 addition & 0 deletions lib/fles_core/TimesliceAnalyzer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class TimesliceAnalyzer : public fles::TimesliceSink
std::string output_prefix_;

size_t timeslice_count_ = 0;
size_t timeslice_error_count_ = 0;
size_t microslice_count_ = 0;
size_t content_bytes_ = 0;
};

0 comments on commit aa45b9a

Please sign in to comment.