NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_process_statistics.h
Go to the documentation of this file.
1/*
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 */
10
11#ifndef __BE_PROCESS_STATISTICS_H__
12#define __BE_PROCESS_STATISTICS_H__
13
14#include <pthread.h>
15
16#include <memory>
17#include <tuple>
18
20
21namespace BiometricEvaluation {
22 namespace Process {
23
42 class Statistics {
43 public:
44
49
69 Statistics(const std::shared_ptr<IO::FileLogCabinet>
70 &logCabinet);
71
86 const std::shared_ptr<IO::Logsheet> &logSheet);
87
89
114 std::tuple<uint64_t, uint64_t> getCPUTimes();
115
140 std::tuple<
141 uint64_t,
142 uint64_t,
143 uint64_t,
144 uint64_t,
145 uint64_t> getMemorySizes();
146
160 uint32_t getNumThreads();
161
177 void logStats();
178
207 void startAutoLogging(uint64_t interval);
208
220
228
229 private:
230
231 pid_t _pid;
232 std::shared_ptr<IO::FileLogCabinet> _logCabinet{};
233 std::shared_ptr<IO::Logsheet> _logSheet{};
234 bool _logging;
235 bool _autoLogging;
236 pthread_t _loggingThread;
237 pthread_mutex_t _logMutex;
238 };
239
240 }
241}
242#endif /* __BE_PROCESS_STATISTICS_H__ */
The Statistics class provides an interface for gathering process statistics, such as memory usage,...
std::tuple< uint64_t, uint64_t, uint64_t, uint64_t, uint64_t > getMemorySizes()
Obtain the current virtual memory (VM) set sizes for the process, in kilobytes.
void logStats()
Create a snapshot of the current process statistics in the FileLogsheet created in the FileLogCabinet...
std::tuple< uint64_t, uint64_t > getCPUTimes()
Obtain the total user and system times for the process, in microseconds.
uint32_t getNumThreads()
Obtain the number of threads composing this process.
Statistics(const std::shared_ptr< IO::Logsheet > &logSheet)
Construct a Statistic object that logs to an existing Logsheet.
void startAutoLogging(uint64_t interval)
Start logging process statistics automatically, in intervals of microseconds.
void callStatistics_logStats()
Helper function in C++ space that has access to this object, and is called from C space by the loggin...
void stopAutoLogging()
Stop the automatic logging of process statistics.
Statistics()
Constructor with no parameters.
Statistics(const std::shared_ptr< IO::FileLogCabinet > &logCabinet)
Construct a Statistics object with the associated FileLogCabinet.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...