summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2022-06-22 14:51:33 +0200
committerSimon Rettberg2022-06-22 14:51:33 +0200
commit1dce9dc9cf3fc19a6ea35965c96cd2def9136710 (patch)
treee802dfce183b3ccd797e6d18278fcc11e548d185
parentAdd --auto option to start immediately and quit when done (diff)
downloadspeedcheck-1dce9dc9cf3fc19a6ea35965c96cd2def9136710.tar.gz
speedcheck-1dce9dc9cf3fc19a6ea35965c96cd2def9136710.tar.xz
speedcheck-1dce9dc9cf3fc19a6ea35965c96cd2def9136710.zip
Don't restart reading after reaching end of input file
-rw-r--r--src/copythread.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/copythread.cpp b/src/copythread.cpp
index ffec902..21aadbb 100644
--- a/src/copythread.cpp
+++ b/src/copythread.cpp
@@ -42,16 +42,12 @@ void CopyThread::run()
// Sequential read
emit logMessage(tr("Starting sequential read test"));
- if (size > 0) {
- _file->seek(BIGRAND % size);
- }
timer.start();
do {
ret = _file->read(buffer, BUFFER_SIZE);
seqSum += ret;
- if (ret == 0) {
- _file->seek(0);
- }
+ if (ret == 0)
+ break; // EOF
} while (!_doStop && ret >= 0 && timer.elapsed() < TEST_LENGTH);
seqTime = timer.elapsed();