NetBurner 3.1
SerialToEtherThroughput/TestStateData.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef _TEST_STATE_DATA_H_
6 #define _TEST_STATE_DATA_H_
7 #pragma once
8 
9 #include <basicTypes.h>
10 
11 #include "ThroughputConstants.h"
12 
17 {
18  uint32_t m_count = 0;
19  double m_avgTime = 0.0;
20  double m_avgBytesPerSec = 0.0;
21  uint32_t m_failCount = 0;
22 };
23 
24 struct BufferObj
25 {
26  char m_buffer[ BUFFER_SIZE ];
27  uint m_byteCount = 0;
28  char* m_curBufPtr = nullptr;
29 };
30 
35 {
36 public:
37  TestStateData();
38  ~TestStateData(){}
39 
40  void ResetTestData();
41  void ResetAvgData();
42  void UpdateBufPtr( BufferObj &bufferObj );
43  bool ValidateDataBuffer();
44  void ReportCurTestData();
45  bool UpdateCurTestComplete();
46  void ReportTotalTestData();
47  inline void IncrementTestTime( double incVal ){ m_totalTestTime += incVal; }
48 
49  BufferObj m_sendData; // Buffer to hold data that will be sent
50  BufferObj m_recData; // Buffer to hold data that is received
51  double m_totalTestTime = 0.0; // How long have we been running this specific test
52  double m_totalSendTime = 0.0; // How long have we been sending data
53  double m_totalRecTime = 0.0; // How long have we been receiving data
54 
55  // Reporting metrics for each series of tests
56  TestResults m_results;
57 
58 private:
59  void InitBuffer( char* buf, bool fill );
60 };
61 
62 #endif /* _TEST_STATE_DATA_H_ */
63 
This is the main object that will keep track of overall test progress and results.
Definition: SerialToEtherThroughput/TestStateData.h:34
bool UpdateCurTestComplete()
Updates the data and averages associated with the overall set of tests that have been run...
Definition: SerialToEtherThroughput/TestStateData.cpp:115
void ResetAvgData()
Reset to the data that tracks the average values of tests.
Definition: SerialToEtherThroughput/TestStateData.cpp:55
void ReportCurTestData()
Prints out data associated with the current test.
Definition: SerialToEtherThroughput/TestStateData.cpp:99
void ResetTestData()
Reset to the start of a new test.
Definition: SerialToEtherThroughput/TestStateData.cpp:27
This holds the cumulative results for a specific set of tests.
Definition: SerialToEtherThroughput/TestStateData.h:16
bool ValidateDataBuffer()
Validates if the data buffer used to receive and send data from matches our base data buffer...
Definition: SerialToEtherThroughput/TestStateData.cpp:78
void UpdateBufPtr(BufferObj &bufferObj)
Updates the current buffer pointer to the location where we are reading/writing the data...
Definition: SerialToEtherThroughput/TestStateData.cpp:68
void ReportTotalTestData()
Prints out the cumulative data for a specific test type.
Definition: SerialToEtherThroughput/TestStateData.cpp:143