Initial Commiit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
common/build/**
|
||||
listener/build/**
|
||||
ctest/build/**
|
||||
|
||||
33
ctest/.vscode/launch.json
vendored
Normal file
33
ctest/.vscode/launch.json
vendored
Normal file
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
53
ctest/.vscode/settings.json
vendored
Normal file
53
ctest/.vscode/settings.json
vendored
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
28
ctest/.vscode/tasks.json
vendored
Normal file
28
ctest/.vscode/tasks.json
vendored
Normal file
@@ -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"
|
||||
}
|
||||
11
ctest/CMakeLists.txt
Normal file
11
ctest/CMakeLists.txt
Normal file
@@ -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)
|
||||
|
||||
|
||||
|
||||
1
ctest/Untitled-1
Normal file
1
ctest/Untitled-1
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
172
ctest/main.cpp
Normal file
172
ctest/main.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
#include <stdio.h>
|
||||
#include <common/string.hpp>
|
||||
#include <common/block.hpp>
|
||||
#include <common/pointer.hpp>
|
||||
#include <common/fileio.hpp>
|
||||
#include <common/profiler.hpp>
|
||||
#include <common/mmap.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
#include <complex>
|
||||
|
||||
|
||||
// #include <iostream> // For standard input/output operations (like std::cout)
|
||||
// #include <fstream> // For file stream operations (like std::ifstream)
|
||||
// #include <string> // 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<int,int,int> foo()
|
||||
{
|
||||
return std::make_tuple(2,3,4);
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
// std::complex<double> 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<int> 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<int> numbers;
|
||||
|
||||
|
||||
|
||||
// numbers.insert(newInt(100);
|
||||
|
||||
// std::cout<< std::min(100,50) << std::endl;
|
||||
// std::string s = "hello";
|
||||
// std::cout << s << std::endl;
|
||||
// std::vector<std::string> 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());
|
||||
}
|
||||
2
ctest/test.txt
Normal file
2
ctest/test.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
line 1
|
||||
line 2
|
||||
Reference in New Issue
Block a user