Message ID | 20241008153031.429906-7-stefan.klug@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Quoting Stefan Klug (2024-10-08 16:29:44) > For debugging purposes it is helpful to access the internal data of the > histogram. Add an accessor for that. > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > Changes in v2: > - return Span instead of reference to std::vector > --- > src/ipa/libipa/histogram.cpp | 6 ++++++ > src/ipa/libipa/histogram.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp > index 5fbfadf5e4e1..10e44b54a0cf 100644 > --- a/src/ipa/libipa/histogram.cpp > +++ b/src/ipa/libipa/histogram.cpp > @@ -62,6 +62,12 @@ Histogram::Histogram(Span<const uint32_t> data) > * \return Number of bins > */ > > +/** > + * \fn Histogram::data() > + * \brief Retrieve the internal data > + * \return The data > + */ > + > /** > * \fn Histogram::total() > * \brief Retrieve the total number of values in the data set > diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h > index 6fd641683694..a926002c8cf0 100644 > --- a/src/ipa/libipa/histogram.h > +++ b/src/ipa/libipa/histogram.h > @@ -36,6 +36,7 @@ public: > } > > size_t bins() const { return cumulative_.size() - 1; } > + const Span<const uint64_t> data() const { return cumulative_; } > uint64_t total() const { return cumulative_[cumulative_.size() - 1]; } > uint64_t cumulativeFrequency(double bin) const; > double quantile(double q, uint32_t first = 0, uint32_t last = UINT_MAX) const; > -- > 2.43.0 >
diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp index 5fbfadf5e4e1..10e44b54a0cf 100644 --- a/src/ipa/libipa/histogram.cpp +++ b/src/ipa/libipa/histogram.cpp @@ -62,6 +62,12 @@ Histogram::Histogram(Span<const uint32_t> data) * \return Number of bins */ +/** + * \fn Histogram::data() + * \brief Retrieve the internal data + * \return The data + */ + /** * \fn Histogram::total() * \brief Retrieve the total number of values in the data set diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h index 6fd641683694..a926002c8cf0 100644 --- a/src/ipa/libipa/histogram.h +++ b/src/ipa/libipa/histogram.h @@ -36,6 +36,7 @@ public: } size_t bins() const { return cumulative_.size() - 1; } + const Span<const uint64_t> data() const { return cumulative_; } uint64_t total() const { return cumulative_[cumulative_.size() - 1]; } uint64_t cumulativeFrequency(double bin) const; double quantile(double q, uint32_t first = 0, uint32_t last = UINT_MAX) const;