CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::storage::StatisticsSenderService::FileStatistics Class Reference

Public Member Functions

 FileStatistics ()
 
void fillUDP (std::ostringstream &os) const
 
void update ()
 

Private Attributes

ssize_t m_read_single_bytes
 
ssize_t m_read_single_operations
 
ssize_t m_read_single_square
 
ssize_t m_read_vector_bytes
 
ssize_t m_read_vector_count_square
 
ssize_t m_read_vector_count_sum
 
ssize_t m_read_vector_operations
 
ssize_t m_read_vector_square
 
time_t m_start_time
 

Detailed Description

Definition at line 35 of file StatisticsSenderService.h.

Constructor & Destructor Documentation

StatisticsSenderService::FileStatistics::FileStatistics ( )

Definition at line 32 of file StatisticsSenderService.cc.

41  m_start_time(time(nullptr)) {}

Member Function Documentation

void StatisticsSenderService::FileStatistics::fillUDP ( std::ostringstream &  os) const

Definition at line 43 of file StatisticsSenderService.cc.

References funct::abs(), mps_fire::i, m_read_single_bytes, m_read_single_operations, m_read_single_square, m_read_vector_bytes, m_read_vector_count_square, m_read_vector_count_sum, m_read_vector_operations, m_read_vector_square, m_start_time, OUTPUT_STATISTIC, StorageAccount::read, StorageAccount::readv, mathSSE::sqrt(), StorageAccount::summary(), protons_cff::time, and StorageAccount::tokenForStorageClassName().

Referenced by edm::storage::StatisticsSenderService::fillUDP().

43  {
45  ssize_t read_single_operations = 0;
46  ssize_t read_single_bytes = 0;
47  ssize_t read_single_square = 0;
48  ssize_t read_vector_operations = 0;
49  ssize_t read_vector_bytes = 0;
50  ssize_t read_vector_square = 0;
51  ssize_t read_vector_count_sum = 0;
52  ssize_t read_vector_count_square = 0;
53  auto token = StorageAccount::tokenForStorageClassName("tstoragefile");
54  for (StorageAccount::StorageStats::const_iterator i = stats.begin(); i != stats.end(); ++i) {
55  if (i->first == token.value()) {
56  continue;
57  }
58  for (StorageAccount::OperationStats::const_iterator j = i->second.begin(); j != i->second.end(); ++j) {
59  if (j->first == static_cast<int>(StorageAccount::Operation::readv)) {
60  read_vector_operations += j->second.attempts;
61  read_vector_bytes += j->second.amount;
62  read_vector_count_square += j->second.vector_square;
63  read_vector_square += j->second.amount_square;
64  read_vector_count_sum += j->second.vector_count;
65  } else if (j->first == static_cast<int>(StorageAccount::Operation::read)) {
66  read_single_operations += j->second.attempts;
67  read_single_bytes += j->second.amount;
68  read_single_square += j->second.amount_square;
69  }
70  }
71  }
72  int64_t single_op_count = read_single_operations - m_read_single_operations;
73  if (single_op_count > 0) {
74  double single_sum = read_single_bytes - m_read_single_bytes;
75  double single_average = single_sum / static_cast<double>(single_op_count);
76  os << "\"read_single_sigma\":"
77  << sqrt(std::abs((static_cast<double>(read_single_square - m_read_single_square) -
78  single_average * single_average * single_op_count) /
79  static_cast<double>(single_op_count)))
80  << ", ";
81  os << "\"read_single_average\":" << single_average << ", ";
82  }
83  int64_t vector_op_count = read_vector_operations - m_read_vector_operations;
84  if (vector_op_count > 0) {
85  double vector_average =
86  static_cast<double>(read_vector_bytes - m_read_vector_bytes) / static_cast<double>(vector_op_count);
87  os << "\"read_vector_average\":" << vector_average << ", ";
88  os << "\"read_vector_sigma\":"
89  << sqrt(std::abs((static_cast<double>(read_vector_square - m_read_vector_square) -
90  vector_average * vector_average * vector_op_count) /
91  static_cast<double>(vector_op_count)))
92  << ", ";
93  double vector_count_average =
94  static_cast<double>(read_vector_count_sum - m_read_vector_count_sum) / static_cast<double>(vector_op_count);
95  os << "\"read_vector_count_average\":" << vector_count_average << ", ";
96  os << "\"read_vector_count_sigma\":"
97  << sqrt(std::abs((static_cast<double>(read_vector_count_square - m_read_vector_count_square) -
98  vector_count_average * vector_count_average * vector_op_count) /
99  static_cast<double>(vector_op_count)))
100  << ", ";
101  }
102 
103  os << "\"read_bytes\":" << (read_vector_bytes + read_single_bytes - m_read_vector_bytes - m_read_single_bytes)
104  << ", ";
105  os << "\"read_bytes_at_close\":"
106  << (read_vector_bytes + read_single_bytes - m_read_vector_bytes - m_read_single_bytes) << ", ";
107 
108  // See top of file for macros; not complex, just avoiding copy/paste
109  OUTPUT_STATISTIC(read_single_operations)
110  OUTPUT_STATISTIC(read_single_bytes)
111  OUTPUT_STATISTIC(read_vector_operations)
112  OUTPUT_STATISTIC(read_vector_bytes)
113 
114  os << "\"start_time\":" << m_start_time << ", ";
115  // NOTE: last entry doesn't have the trailing comma.
116  os << "\"end_time\":" << time(nullptr);
117 }
#define OUTPUT_STATISTIC(x)
static const StorageStats & summary(void)
tbb::concurrent_unordered_map< int, OperationStats > StorageStats
static StorageClassToken tokenForStorageClassName(std::string const &iName)
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void StatisticsSenderService::FileStatistics::update ( )

Definition at line 119 of file StatisticsSenderService.cc.

References mps_fire::i, m_read_single_bytes, m_read_single_operations, m_read_single_square, m_read_vector_bytes, m_read_vector_count_square, m_read_vector_count_sum, m_read_vector_operations, m_read_vector_square, m_start_time, StorageAccount::read, StorageAccount::readv, StorageAccount::summary(), protons_cff::time, and StorageAccount::tokenForStorageClassName().

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), edm::storage::StatisticsSenderService::filePostCloseEvent(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

119  {
121  ssize_t read_single_operations = 0;
122  ssize_t read_single_bytes = 0;
123  ssize_t read_single_square = 0;
124  ssize_t read_vector_operations = 0;
125  ssize_t read_vector_bytes = 0;
126  ssize_t read_vector_square = 0;
127  ssize_t read_vector_count_sum = 0;
128  ssize_t read_vector_count_square = 0;
129  auto token = StorageAccount::tokenForStorageClassName("tstoragefile");
130  for (StorageAccount::StorageStats::const_iterator i = stats.begin(); i != stats.end(); ++i) {
131  if (i->first == token.value()) {
132  continue;
133  }
134  for (StorageAccount::OperationStats::const_iterator j = i->second.begin(); j != i->second.end(); ++j) {
135  if (j->first == static_cast<int>(StorageAccount::Operation::readv)) {
136  read_vector_operations += j->second.attempts;
137  read_vector_bytes += j->second.amount;
138  read_vector_count_square += j->second.vector_square;
139  read_vector_square += j->second.amount_square;
140  read_vector_count_sum += j->second.vector_count;
141  } else if (j->first == static_cast<int>(StorageAccount::Operation::read)) {
142  read_single_operations += j->second.attempts;
143  read_single_bytes += j->second.amount;
144  read_single_square += j->second.amount_square;
145  }
146  }
147  }
148 
149  m_read_single_square = read_single_square;
150  m_read_vector_square = read_vector_square;
151  m_read_vector_count_square = read_vector_count_square;
152  m_read_vector_count_sum = read_vector_count_sum;
153  m_read_single_operations = read_single_operations;
154  m_read_single_bytes = read_single_bytes;
155  m_read_vector_operations = read_vector_operations;
156  m_read_vector_bytes = read_vector_bytes;
157  m_start_time = time(nullptr);
158 }
static const StorageStats & summary(void)
tbb::concurrent_unordered_map< int, OperationStats > StorageStats
static StorageClassToken tokenForStorageClassName(std::string const &iName)

Member Data Documentation

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_single_bytes
private

Definition at line 43 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_single_operations
private

Definition at line 42 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_single_square
private

Definition at line 44 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_vector_bytes
private

Definition at line 46 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_vector_count_square
private

Definition at line 49 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_vector_count_sum
private

Definition at line 48 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_vector_operations
private

Definition at line 45 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

ssize_t edm::storage::StatisticsSenderService::FileStatistics::m_read_vector_square
private

Definition at line 47 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().

time_t edm::storage::StatisticsSenderService::FileStatistics::m_start_time
private

Definition at line 50 of file StatisticsSenderService.h.

Referenced by fillUDP(), and update().