#include #include #include #include #include #include #include #include #include #include #include #include #include // #include // For standard input/output operations (like std::cout) // #include // For file stream operations (like std::ifstream) // #include // For using std::string // int main() // { // Profiler profiler = Profiler(); // std::ifstream inputFile("/mnt/mariadb/backupdb.sql"); // if (!inputFile.is_open()) // { // std::cerr << "Error: Could not open the file." << std::endl; // return 1; // Indicate an error // } // DWORD lines = 0; // std::string line; // while (std::getline(inputFile, line)) // { // lines++; // if(!(lines%1000000)) // { // std::cout << "reading " << lines << " " << line << std::endl; // } // } // inputFile.close(); // std::cout << "Done, total took " << profiler.end() << " (ms)" << std::endl; // return 0; // Indicate successful execution // } // int main(int argc, char ** argv) // { // Profiler profiler = Profiler(); // FileIO inputFile = FileIO("/mnt/mariadb/backupdb.sql"); // inputFile.setBufferLength(500000000); // // FileIO inputFile = FileIO("/home/pi/Boneyard/ctest/main.cpp"); // String strLine = String(); // DWORD length = 0; // DWORD lines = 0; // printf("opening...\n"); // while(inputFile.readLine(strLine)) // { // lines++; // // printf("reading %d %s\n",lines,(char*)strLine); // if(!(lines%1000000)) // { // printf("reading %d %s\n",lines,(char*)strLine); // } // } // printf("Done, read %d lines\n",lines); // inputFile.close(); // printf("done, took %d(ms)...\n",profiler.end()); // return 0; // } std::tuple foo() { return std::make_tuple(2,3,4); } int main(int argc, char ** argv) { // std::complex c{4.0,3.0}; // FileIO fileIO = FileIO("/mnt/mariadb/backupdb.sql"); // std::cout << "Reading ... " << std::endl; // int lines =0; // String strLine; // while(fileIO.readLine(strLine)) // { // lines++; // if(!(lines%1000000)) // { // printf("reading %d %s\n",lines,(char*)strLine); // } // } // fileIO.close(); } void stdLibStuff() { // std::vector numbers; // numbers.push_back(100); // numbers.push_back(50); // numbers.push_back(100); // int *p=&numbers[0]; // int *p1=&numbers[1]; // int *p2=&numbers[2]; // int max = *std::max_element(numbers.begin(), numbers.end()); // std::cout << typeid(max_it).name() << std::endl; // if(max_it == p)std::cout << "p" << std::endl; // if(max_it == p1) std::cout << "p1" << std::endl; // if(max_it == p2)std::cout << "p2" << std::endl; // std::cout << *max_it << std::endl; // int max_value = *max_it; // std::max(*numbers.begin()); // std::cout << std::max(numbers) << std::endl; // Block numbers; // numbers.insert(newInt(100); // std::cout<< std::min(100,50) << std::endl; // std::string s = "hello"; // std::cout << s << std::endl; // std::vector strings; // strings.push_back("hello"); // strings.push_back("world"); // for (const std::string& s : strings) // { // std::cout << s << " "; // } // char buffer[] = "Another direct copy"; // int a = sizeof(buffer); } void readFile() { // MemoryMappedFile memoryMappedFile("/home/pi/Boneyard/ctest/main.cpp",MemoryMappedFile::CreationFlags::ReadOnly); // MemoryMappedFile memoryMappedFile("/home/pi/Boneyard/ctest/test.txt",MemoryMappedFile::CreationFlags::ReadOnly); MemoryMappedFile memoryMappedFile("/mnt/mariadb/backupdb.sql",MemoryMappedFile::CreationFlags::ReadOnly); Profiler profiler = Profiler(); String strLine; DWORD lines = 0; strLine.reserve(1400000,0); while(memoryMappedFile.readLine(strLine)) { // printf("%s\n",(char*)strLine); lines++; if(!(lines%1000000)) { printf("reading %d %s\n",lines,(char*)strLine); } } memoryMappedFile.close(); printf("done, took %d(ms)...\n",profiler.end()); }