7
mirror of https://github.com/EEVengers/ThunderScope.git synced 2025-04-08 06:25:30 +00:00

Performance Testing added to PCIeLink class

This commit is contained in:
Daniel Vasile 2021-03-20 16:00:51 -04:00
parent e126655967
commit 520f031edf
3 changed files with 31 additions and 13 deletions
Software/waveview/scope_link

View File

@ -68,6 +68,10 @@ public:
void Read(uint8_t* buff);
void Write(ScopeCommand command, void* val);
void ClockTick1();
void ClockTick2();
void PrintTimeDelta();
~PCIeLink();
private:
@ -82,6 +86,10 @@ private:
LARGE_INTEGER freq; //used for perforamnce testing
int64_t last_chunk_read;
//used for speed testing
LARGE_INTEGER tick1;
LARGE_INTEGER tick2;
void _Read(HANDLE hPCIE, long long address, uint8_t* buff, int bytesToRead);
void _Write(HANDLE hPCIE, long long address, uint8_t* buff, int bytesToWrite);
void _FIFO_WRITE(HANDLE hPCIE, uint8_t* data, uint8_t bytesToWrite);

View File

@ -284,7 +284,11 @@ void runPCIeTest() {
pcieLink->Write(dataMover_enable,nullptr);
uint8_t* buff = (uint8_t*)malloc(sizeof(uint8_t) * (1 << 23));
pcieLink->ClockTick1();
pcieLink->Read(buff);
pcieLink->ClockTick2();
pcieLink->PrintTimeDelta();
FILE* fp = fopen("TestData.txt","w");
for(int i = 0; i < (1 << 23); i+= 8) {

View File

@ -348,15 +348,9 @@ void PCIeLink::_Read(HANDLE hPCIE, int64_t address, uint8_t* buff, int bytesToRe
// read from device into buffer
DWORD bytesRead;
LARGE_INTEGER start;
LARGE_INTEGER stop;
QueryPerformanceCounter(&start);
if (!ReadFile(hPCIE, buff, bytesToRead, &bytesRead, NULL)) {
ERROR << "_Read() failed with Win32 error code: " << GetLastError();
}
QueryPerformanceCounter(&stop);
double time_sec = (unsigned long long)(stop.QuadPart - start.QuadPart) / (double)freq.QuadPart;
//INFO << bytesRead << " bytes read in " << time_sec;
}
void PCIeLink::_Write(HANDLE hPCIE, int64_t address, uint8_t* buff, int bytesToWrite) {
@ -374,15 +368,9 @@ void PCIeLink::_Write(HANDLE hPCIE, int64_t address, uint8_t* buff, int bytesToW
// write from buffer to device
DWORD bytesWritten;
LARGE_INTEGER start;
LARGE_INTEGER stop;
QueryPerformanceCounter(&start);
if (!WriteFile(hPCIE, buff, bytesToWrite, &bytesWritten, NULL)) {
ERROR << "_Write() failed with Win32 error code: " << GetLastError();
}
QueryPerformanceCounter(&stop);
double time_sec = (unsigned long long)(stop.QuadPart - start.QuadPart) / (double)freq.QuadPart;
//INFO << bytesWritten << " bytes written in " << time_sec;
}
PCIeLink::PCIeLink() {
@ -401,7 +389,25 @@ PCIeLink::~PCIeLink() {
}
void PCIeLink::ClockTick1() {
QueryPerformanceCounter(&tick1);
}
void PCIeLink::ClockTick2() {
QueryPerformanceCounter(&tick2);
}
/************************************************************
* PrintTimeDelta()
* prints the time difference between tick1 and tick2 -> (tick2 - tick1) / freq
*
* return: NONE
*
*************************************************************/
void PCIeLink::PrintTimeDelta() {
double time_sec = (unsigned long long)(tick2.QuadPart - tick1.QuadPart) / (double)freq.QuadPart;
INFO << "Time Delta is: " << time_sec;
}