Loading ifs/include/preload/rpc/ld_rpc_data.hpp +0 −2 Original line number Diff line number Diff line Loading @@ -77,8 +77,6 @@ int rpc_send_read(const size_t recipient, const std::string& path, const size_t HG_Destroy(handle); return err; return 0; } int rpc_send_write(const size_t recipient, const std::string& path, const size_t in_size, const off_t in_offset, Loading ifs/src/preload/preload.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,8 @@ int puts(const char* str) { ssize_t write(int fd, const void* buf, size_t count) { init_passthrough_if_needed(); if (is_env_initialized && file_map.exist(fd)) { // TODO if append flag has been given, set offset accordingly. // XXX handle lseek too return pwrite(fd, buf, count, 0); } return (reinterpret_cast<decltype(&write)>(libc_write))(fd, buf, count); Loading ifs_test/main.cpp +29 −29 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ using get_time = chrono::steady_clock; int main(int argc, char* argv[]) { // auto filen = atoi(argv[1]); auto filen = atoi(argv[1]); // cout << mkdir("/tmp/mountdir/bla", 0775) << endl; // auto buf = "BUFFERINO2"; Loading @@ -21,18 +21,18 @@ int main(int argc, char* argv[]) { // cout << stat("/tmp/mountdir/creat.txt", &attr) << endl; // cout << unlink("/tmp/mountdir/creat.txt") << endl; char buf[] = "test123\n"; string p = "/tmp/mountdir/file"s; auto fd = open(p.c_str(), O_CREAT|O_WRONLY, 0777); auto nw = write(fd, &buf, strlen(buf)); close(fd); fd = open(p.c_str(), O_RDONLY, 0777); char buf_read[9] = {0}; auto rs = read(fd, &buf_read, strlen(buf)); buf_read[8] = '\0'; printf("buffer read: %s\n", buf_read); close(fd); // char buf[] = "test123\n"; // string p = "/tmp/mountdir/file"s; // auto fd = open(p.c_str(), O_CREAT|O_WRONLY, 0777); // auto nw = write(fd, &buf, strlen(buf)); // close(fd); // // fd = open(p.c_str(), O_RDONLY, 0777); // char buf_read[9] = {0}; // auto rs = read(fd, &buf_read, strlen(buf)); // buf_read[8] = '\0'; // printf("buffer read: %s\n", buf_read); // close(fd); // auto fd2 = open("/tmp/rootdir/data/chunks/file/data2", O_RDONLY, 0777); // char buf_read2[9] = {0}; Loading @@ -45,22 +45,22 @@ int main(int argc, char* argv[]) { // auto start_t = get_time::now(); // // for (int i = 0; i < filen; ++i) { // string p = "/tmp/mountdir/file" + to_string(i); // creat(p.c_str(), 0666); // if (i % 25000 == 0) // cout << i << " files processed." << endl; // } // // auto end_t = get_time::now(); // auto diff = end_t - start_t; // // auto diff_count = chrono::duration_cast<ns>(diff).count(); // // cout << diff_count << "ns\t" << (diff_count) / 1000000. << "ms" << endl; // cout << filen / ((diff_count) / 1000000000.) << " files per second" << endl; auto start_t = get_time::now(); for (int i = 0; i < filen; ++i) { string p = "/tmp/mountdir/file" + to_string(i); creat(p.c_str(), 0666); if (i % 25000 == 0) cout << i << " files processed." << endl; } auto end_t = get_time::now(); auto diff = end_t - start_t; auto diff_count = chrono::duration_cast<ns>(diff).count(); cout << diff_count << "ns\t" << (diff_count) / 1000000. << "ms" << endl; cout << filen / ((diff_count) / 1000000000.) << " files per second" << endl; return 0; Loading Loading
ifs/include/preload/rpc/ld_rpc_data.hpp +0 −2 Original line number Diff line number Diff line Loading @@ -77,8 +77,6 @@ int rpc_send_read(const size_t recipient, const std::string& path, const size_t HG_Destroy(handle); return err; return 0; } int rpc_send_write(const size_t recipient, const std::string& path, const size_t in_size, const off_t in_offset, Loading
ifs/src/preload/preload.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,8 @@ int puts(const char* str) { ssize_t write(int fd, const void* buf, size_t count) { init_passthrough_if_needed(); if (is_env_initialized && file_map.exist(fd)) { // TODO if append flag has been given, set offset accordingly. // XXX handle lseek too return pwrite(fd, buf, count, 0); } return (reinterpret_cast<decltype(&write)>(libc_write))(fd, buf, count); Loading
ifs_test/main.cpp +29 −29 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ using get_time = chrono::steady_clock; int main(int argc, char* argv[]) { // auto filen = atoi(argv[1]); auto filen = atoi(argv[1]); // cout << mkdir("/tmp/mountdir/bla", 0775) << endl; // auto buf = "BUFFERINO2"; Loading @@ -21,18 +21,18 @@ int main(int argc, char* argv[]) { // cout << stat("/tmp/mountdir/creat.txt", &attr) << endl; // cout << unlink("/tmp/mountdir/creat.txt") << endl; char buf[] = "test123\n"; string p = "/tmp/mountdir/file"s; auto fd = open(p.c_str(), O_CREAT|O_WRONLY, 0777); auto nw = write(fd, &buf, strlen(buf)); close(fd); fd = open(p.c_str(), O_RDONLY, 0777); char buf_read[9] = {0}; auto rs = read(fd, &buf_read, strlen(buf)); buf_read[8] = '\0'; printf("buffer read: %s\n", buf_read); close(fd); // char buf[] = "test123\n"; // string p = "/tmp/mountdir/file"s; // auto fd = open(p.c_str(), O_CREAT|O_WRONLY, 0777); // auto nw = write(fd, &buf, strlen(buf)); // close(fd); // // fd = open(p.c_str(), O_RDONLY, 0777); // char buf_read[9] = {0}; // auto rs = read(fd, &buf_read, strlen(buf)); // buf_read[8] = '\0'; // printf("buffer read: %s\n", buf_read); // close(fd); // auto fd2 = open("/tmp/rootdir/data/chunks/file/data2", O_RDONLY, 0777); // char buf_read2[9] = {0}; Loading @@ -45,22 +45,22 @@ int main(int argc, char* argv[]) { // auto start_t = get_time::now(); // // for (int i = 0; i < filen; ++i) { // string p = "/tmp/mountdir/file" + to_string(i); // creat(p.c_str(), 0666); // if (i % 25000 == 0) // cout << i << " files processed." << endl; // } // // auto end_t = get_time::now(); // auto diff = end_t - start_t; // // auto diff_count = chrono::duration_cast<ns>(diff).count(); // // cout << diff_count << "ns\t" << (diff_count) / 1000000. << "ms" << endl; // cout << filen / ((diff_count) / 1000000000.) << " files per second" << endl; auto start_t = get_time::now(); for (int i = 0; i < filen; ++i) { string p = "/tmp/mountdir/file" + to_string(i); creat(p.c_str(), 0666); if (i % 25000 == 0) cout << i << " files processed." << endl; } auto end_t = get_time::now(); auto diff = end_t - start_t; auto diff_count = chrono::duration_cast<ns>(diff).count(); cout << diff_count << "ns\t" << (diff_count) / 1000000. << "ms" << endl; cout << filen / ((diff_count) / 1000000000.) << " files per second" << endl; return 0; Loading