Commit ea3f3433 authored by Ilya Prokhorov's avatar Ilya Prokhorov

mb blocks and threshold as argument

parent daaff5fd
......@@ -8,9 +8,11 @@ using namespace std;
int main(int argc, char **argv) {
cout << "Slowride v1.0" << endl;
if (argc < 3) {
cout << "Usage: sudo ./slowride [block device] [ms threshold]" << endl;
cout << "Example: sudo ./slowride /dev/sda2 4500" << endl;
if (argc != 4) {
cout << "Usage: sudo ./slowride [block device] [mb per block] [ms threshold]" << endl;
cout << "Example: sudo ./slowride /dev/sda2 1000 400" << endl;
cout << "Example: sudo ./slowride /dev/sda2 1000 0" << endl;
exit(3);
}
auto inputStream = ifstream(argv[1], ifstream::binary);
......@@ -29,10 +31,12 @@ int main(int argc, char **argv) {
auto bytesBlockSize = 1024;
auto mgBlocksSize = bytesBlockSize * 1024;
auto mgbsPerBlock = 520;
mgbsPerBlock = atoi(argv[2]);
auto blockSize = mgBlocksSize * mgbsPerBlock;
auto buffer = new char[blockSize];
auto timeout = atoi(argv[2]);
auto timeout = atoi(argv[3]);
for (long long int position = 0; position < length; position += blockSize) {
......@@ -52,7 +56,7 @@ int main(int argc, char **argv) {
if (readTime > timeout) {
auto currentGB = position / 1024 / 1024 / 1000;
cout << "slow block at " << currentGB << "GB" << endl;
cout << "Read threshold at: " << currentGB << "GB" << endl;
cout << "T: " << fixed << readTime << setprecision(5);
cout << "s" << endl;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment