Skip to content
Snippets Groups Projects

Saving counters result as monitoring histogram

Merged Valerii Kholoimov requested to merge dev_kholoimov_monitoring_counters_histogram into master
2 files
+ 18
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -26,6 +26,9 @@ namespace Allen::Monitoring {
template<typename T>
struct Counter;
template<typename T>
struct AveragingCounter;
struct AccumulatorInfosAndPointers {
std::size_t offset {0};
std::size_t size {0};
@@ -98,6 +101,7 @@ namespace Allen::Monitoring {
void registerAccumulator(AccumulatorBase* acc);
void registerCounter(Counter<unsigned>* c) { m_counters.push_back(c); }
void registerAveragingCounter(AveragingCounter<unsigned>* c) { m_av_counters.push_back(c); }
void initAccumulators(unsigned number_of_streams);
void mergeAndReset(bool singlethreaded = false);
char* bufferForStream(unsigned stream_id) const { return m_dev_buffer_ptr[m_stream_current_buffer[stream_id]]; }
@@ -124,6 +128,7 @@ namespace Allen::Monitoring {
std::vector<AccumulatorBase*> m_registered_accumulators;
std::vector<Counter<unsigned>*> m_counters;
std::vector<AveragingCounter<unsigned>*> m_av_counters;
std::map<std::string, AccumulatorInfosAndPointers> m_accumulators;
};
@@ -251,7 +256,10 @@ namespace Allen::Monitoring {
using type = T;
using DeviceType = DeviceAveragingCounter<T>;
AveragingCounter(const Allen::Algorithm* owner, std::string name) : AccumulatorBase(owner, name) {}
AveragingCounter(const Allen::Algorithm* owner, std::string name) : AccumulatorBase(owner, name)
{
if constexpr (std::is_same<T, unsigned>::value) AccumulatorManager::get()->registerAveragingCounter(this);
}
std::size_t size() const override { return 2; }
std::size_t elementSize() const override { return sizeof(T); }
DeviceType data(const Allen::Context& ctx) const { return reinterpret_cast<T*>(currentDevicePtr(ctx.stream_id)); }
Loading