[v2,6/7] ipa: libipa: Add data accessor to Histogram
diff mbox series

Message ID 20241007095425.211158-7-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • Add support for IPA debugging metadata
Related show

Commit Message

Stefan Klug Oct. 7, 2024, 9:54 a.m. UTC
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>

---
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(+)

Patch
diff mbox series

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;