From 575ae6bb56d4a7758d493451e779dc909f546304 Mon Sep 17 00:00:00 2001 From: Sean Date: Sun, 10 Aug 2025 11:37:45 -0400 Subject: [PATCH] Initial Commiit --- .gitignore | 1 + ctest/.vscode/launch.json | 33 +++++++ ctest/.vscode/settings.json | 53 +++++++++++ ctest/.vscode/tasks.json | 28 ++++++ ctest/CMakeLists.txt | 11 +++ ctest/Untitled-1 | 1 + ctest/main.cpp | 172 ++++++++++++++++++++++++++++++++++++ ctest/test.txt | 2 + 8 files changed, 301 insertions(+) create mode 100644 ctest/.vscode/launch.json create mode 100644 ctest/.vscode/settings.json create mode 100644 ctest/.vscode/tasks.json create mode 100644 ctest/CMakeLists.txt create mode 100644 ctest/Untitled-1 create mode 100644 ctest/main.cpp create mode 100644 ctest/test.txt diff --git a/.gitignore b/.gitignore index 87399cd..75eb29e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ common/build/** listener/build/** +ctest/build/** diff --git a/ctest/.vscode/launch.json b/ctest/.vscode/launch.json new file mode 100644 index 0000000..7e3ee60 --- /dev/null +++ b/ctest/.vscode/launch.json @@ -0,0 +1,33 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/tester", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] + } + + ] +} \ No newline at end of file diff --git a/ctest/.vscode/settings.json b/ctest/.vscode/settings.json new file mode 100644 index 0000000..6b7d21e --- /dev/null +++ b/ctest/.vscode/settings.json @@ -0,0 +1,53 @@ +{ + "files.associations": { + "*.tpp": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "concepts": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "random": "cpp", + "ratio": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "typeinfo": "cpp", + "fstream": "cpp", + "iostream": "cpp" + } +} \ No newline at end of file diff --git a/ctest/.vscode/tasks.json b/ctest/.vscode/tasks.json new file mode 100644 index 0000000..05054c5 --- /dev/null +++ b/ctest/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/ctest/CMakeLists.txt b/ctest/CMakeLists.txt new file mode 100644 index 0000000..0941df3 --- /dev/null +++ b/ctest/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.10.0) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/home/pi/Boneyard") +project(tester VERSION 0.1.0 LANGUAGES C CXX) + +add_executable(tester main.cpp) + +add_subdirectory(/home/pi/Boneyard/common /home/pi/Boneyard/common/build) +target_link_libraries(tester PRIVATE common) + + + diff --git a/ctest/Untitled-1 b/ctest/Untitled-1 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ctest/Untitled-1 @@ -0,0 +1 @@ + diff --git a/ctest/main.cpp b/ctest/main.cpp new file mode 100644 index 0000000..a61c51d --- /dev/null +++ b/ctest/main.cpp @@ -0,0 +1,172 @@ +#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()); +} diff --git a/ctest/test.txt b/ctest/test.txt new file mode 100644 index 0000000..7bba8c8 --- /dev/null +++ b/ctest/test.txt @@ -0,0 +1,2 @@ +line 1 +line 2