LCOV - code coverage report
Current view: top level - include/Tools/Reporter/Probe - Reporter_probe.hxx (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 18 18 100.0 %
Date: 2024-06-12 12:04:18 Functions: 15 30 50.0 %

          Line data    Source code
       1             : #include "Tools/Reporter/Probe/Reporter_probe.hpp"
       2             : 
       3             : namespace spu
       4             : {
       5             : namespace tools
       6             : {
       7             : 
       8             : template<typename T>
       9             : size_t
      10        3640 : Reporter_probe::col_size(const int col)
      11             : {
      12        3640 :     return this->head[col] - this->tail[col] + (this->head[col] >= this->tail[col] ? 0 : this->buffer[col].size());
      13             : }
      14             : 
      15             : template<typename T>
      16             : bool
      17        1729 : Reporter_probe::push(const int col, const T* elts)
      18             : {
      19        1729 :     std::unique_lock<std::mutex> lck(this->mtx[col]);
      20        1729 :     if (this->col_size<T>(col) == this->buffer[col].size() - 1) return false;
      21        1729 :     auto buff = reinterpret_cast<T*>(this->buffer[col][this->head[col]].data());
      22        1729 :     std::copy(elts, elts + this->data_sizes[col], buff);
      23        1729 :     this->head[col] = (this->head[col] + 1) % this->buffer[col].size();
      24        1729 :     return true;
      25        1729 : }
      26             : 
      27             : template<typename T>
      28             : bool
      29        1911 : Reporter_probe::pull(const int col, T* elts)
      30             : {
      31        1911 :     std::unique_lock<std::mutex> lck(this->mtx[col]);
      32        1911 :     if (this->col_size<T>(col) == 0) return false;
      33        1729 :     auto buff = reinterpret_cast<const T*>(this->buffer[col][this->tail[col]].data());
      34        1729 :     std::copy(buff, buff + this->data_sizes[col], elts);
      35        1729 :     this->tail[col] = (this->tail[col] + 1) % this->buffer[col].size();
      36        1729 :     return true;
      37        1911 : }
      38             : 
      39             : }
      40             : }

Generated by: LCOV version 1.14