percent are now two digit precision
This commit is contained in:
@ -24,7 +24,7 @@ static struct tfnge_stream tfnge;
|
||||
|
||||
static unsigned long blockcount = 0UL;
|
||||
static long blockcount_max;
|
||||
static uint8_t u8Percent;
|
||||
static double d32Percent;
|
||||
#endif
|
||||
/**
|
||||
* \brief shred drive with shred
|
||||
@ -60,7 +60,7 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||
|
||||
blockcount_max = SHRED_ITERATIONS*(drive->getCapacity()/4096);
|
||||
|
||||
u8Percent = 0U;
|
||||
d32Percent = 0U;
|
||||
|
||||
rsf = open(randsrc, O_RDONLY | O_LARGEFILE);
|
||||
if (rsf == -1)
|
||||
@ -148,19 +148,19 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||
// write block loop
|
||||
while (1)
|
||||
{
|
||||
usleep(10);
|
||||
//usleep(10);
|
||||
|
||||
if(drive->state != Drive::SHRED_ACTIVE)
|
||||
{
|
||||
goto _return;
|
||||
}
|
||||
|
||||
uint8_t u8TmpPercent = calcProgress();
|
||||
double d32TmpPercent = calcProgress();
|
||||
|
||||
if(u8Percent != u8TmpPercent)
|
||||
if((d32TmpPercent-d32Percent) >= 0.09)
|
||||
{
|
||||
drive->setTaskPercentage(u8TmpPercent);
|
||||
u8Percent = u8TmpPercent;
|
||||
drive->setTaskPercentage(d32TmpPercent);
|
||||
d32Percent = d32TmpPercent;
|
||||
write(*ipSignalFd, "A",1);
|
||||
}
|
||||
|
||||
@ -267,11 +267,18 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||
_return:
|
||||
optind++;
|
||||
close(rsf);
|
||||
|
||||
if(drive->state == Drive::SHRED_ACTIVE)
|
||||
{
|
||||
drive->bWasShredded = true;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
#ifndef DRYRUN
|
||||
|
||||
uint8_t Shred::calcProgress()
|
||||
double Shred::calcProgress()
|
||||
{
|
||||
blockcount++;
|
||||
return ((((double)blockcount/(double)blockcount_max))*100);
|
||||
|
Reference in New Issue
Block a user