cal metric: shred speed

This commit is contained in:
2022-06-30 00:32:13 +02:00
parent c61859ed4e
commit 9863c5591e
6 changed files with 37 additions and 5 deletions

View File

@ -77,9 +77,9 @@ void TUI::updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry)
string sModelName = it->getModelName();
string sCapacity = it->sCapacityToText();
string sState = " ";
string sSpeed = " ";
string sTime = " ";
bool bSelectedEntry = false;
if(u8SelectedEntry == u8Index)
@ -107,6 +107,7 @@ void TUI::updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry)
it->calculateTaskDuration();
sTime = this->formatTimeDuration(it->getTaskDuration());
sSpeed = this->formatSpeed(it->sShredSpeed.u32ShredTimeDelta, it->sShredSpeed.ulWrittenBytes);
break;
case Drive::DELETE_ACTIVE:
sState = "Deleting ...";
@ -151,7 +152,7 @@ void TUI::updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry)
break;
}
WINDOW * tmp = createEntryWindow( ((int)(u16StdscrX/3) - 2), 5, 3, (5* (u8Index) )+3, sModelFamily, sModelName, sCapacity, sState, sTime, "424 MB/s", bSelectedEntry);
WINDOW * tmp = createEntryWindow( ((int)(u16StdscrX/3) - 2), 5, 3, (5* (u8Index) )+3, sModelFamily, sModelName, sCapacity, sState, sTime, sSpeed, bSelectedEntry);
wrefresh(tmp);
u8Index++;
}//end loop though drives
@ -507,6 +508,16 @@ string TUI::formatTimeDuration(time_t u32Duration)
return out.str();
}
string TUI::formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes){
std::ostringstream out;
double dDeltaSec = ((double)((u32ShredTimeDelta)/1000000000.0)); //convert nano in sec
double speed = ((ulWrittenBytes/1000000.0)/dDeltaSec);
char s[25];
sprintf(s, "%0.2lf MB/s", speed);
out << s;
return out.str();
}
void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
{
struct MenuState menustate;