diff --git a/buildproto.bat b/buildproto.bat index 116a7a3..db46758 100644 --- a/buildproto.bat +++ b/buildproto.bat @@ -1 +1 @@ -clang++ -DDEBUG src\proto\proto.cpp -o build\ayo.exe -Wall -Wextra -Wpedantic -std=c++11 -g -gcodeview -Wl,-pdb= -L C:\capybara\libclang\x86_64-w64-mingw32\bin -static-libstdc++ -static --verbose +clang++ -DDEBUG src\proto\proto.cpp -o build\ayo.exe -Wall -Wextra -Wpedantic -std=c++11 -g -gcodeview -Wl,-pdb= -L C:\capybara\libclang\x86_64-w64-mingw32\bin -l c++ -l unwind -static --verbose diff --git a/buildtest.bat b/buildtest.bat index 364e361..3ea2ae5 100644 --- a/buildtest.bat +++ b/buildtest.bat @@ -1 +1 @@ -clang++ -dynamic src\test\test.cpp -o build\test.exe -Wall -Wextra -Wpedantic -std=c++11 -L C:\capybara\libclang\x86_64-w64-mingw32\bin -L D:\Contenido\Capybara\Cositas\tmr\build -Wl,-Bstatic -l c++ -l unwind -Wl,-Bdynamic -l tmrtsc --verbose +clang++ -dynamic src\test\test.cpp -o build\test.exe -Wall -Wextra -Wpedantic -std=c++11 -L C:\capybara\libclang\x86_64-w64-mingw32\bin -L D:\Contenido\Capybara\Cositas\tmr\build -Wl,-Bstatic -l c++ -l unwind -Wl,-Bdynamic -l tmrtsc --verbose \ No newline at end of file diff --git a/src/proto/proto.cpp b/src/proto/proto.cpp index 53ba00f..c5b2e7a 100644 --- a/src/proto/proto.cpp +++ b/src/proto/proto.cpp @@ -1,3 +1,7 @@ +<<<<<<< Updated upstream +======= +//si, bueno, testx +>>>>>>> Stashed changes /* * THREADIN THE LINUS: https://linux.die.net/man/2/sched_setaffinity */ @@ -25,7 +29,7 @@ Intel(R) 64 and IA-32 Architectures Software Developer's Manual Volume 3 (3A, 3B //TSC is incremented by the base multiplier once every reference clock, so on my Xeon E5-2680 (Sandy Bridge EP) this is an increment of 27 every 10 ns -//https://github.com/jdmccalpin/low-overhead-timers/issues/1 + #ifdef _WIN64 //#include @@ -41,7 +45,7 @@ Intel(R) 64 and IA-32 Architectures Software Developer's Manual Volume 3 (3A, 3B #include #include #endif -#ifdef LOwOnus +#ifdef NOMESELDELINUS //hilitos y tal #endif @@ -49,17 +53,6 @@ Intel(R) 64 and IA-32 Architectures Software Developer's Manual Volume 3 (3A, 3B #include #include "../debug.h" -uint64_t checksatr(){ //Generic - uint64_t rcx; - asm volatile (".intel_syntax noprefix\t\n" \ - "mov eax, 0x80000007\t\n" \ - // 080000007h\t\n" - "cpuid\t\n" : "=c" (rcx) ); - //bool iTSC = rcx & (1<<6); - //"and edx, 10000000\n") - return rcx; -} - bool checkInvariantTSC(){ //Generic uint64_t rdx; asm volatile (".intel_syntax noprefix\t\n" \ @@ -103,11 +96,10 @@ EDX Bits 31-00: Reserved = 0. */ -char* AMDTest() { +char* AMDMeCagoEnTusPutosMuertos () { /* * Extended name on AMD systems when using 8000_002-4. 8000_0000 for Extpagequant/vendor. Hijos de puta. * Now parsing 0H for standard brand name - * https://github.com/jdmccalpin/low-overhead-timers/issues/1 */ char* palabritas = (char*)malloc(sizeof(char) * 13); uint8_t siguienteLetra = 0; @@ -127,8 +119,8 @@ char* AMDTest() { return palabritas; } -//GMET on??????????? Zenbros... -bool AMDGMET(){ +//GMET on??????????? jfc wtf +bool AMDJoderMET(){ uint64_t rdx; asm volatile ( ".intel_syntax noprefix\t\n" \ "mov eax, 0x8000000A\t\n" \ @@ -256,7 +248,7 @@ uint64_t estimandoFreq(){ valLen = MAX_VALUE_NAME; //data NULL + len NON_NULL to get dataBufLen; //data allocated (NON-NULL) + len NON-NULL with previous value for dataLen - //MS WHY. that why we defaultin to biggis. cos not worky. ewe + //JFC MS WHY. that why we defaultin to biggis. cos not worky. ewe dataLen = sizeof(REG_QWORD) * (longestDataSize); status = RegEnumValueW(key, i, @@ -286,7 +278,9 @@ uint64_t estimandoFreq(){ ) ) { //dataLen = dataLen * 2lu; - /* We do be usin' well designed APIs...... + /* BROS YO ES QUE ME VOY A CAGAR EN SUS PUTOS MUERTOS + * ASí QUE PIDES DOS VECES, UNA TAMAńO, OTRA A TOPE PRESISO, EH + * PUTA BASURA DE API * status = RegEnumValueW(key, * i, * valName, @@ -318,15 +312,14 @@ uint64_t estimandoFreq(){ int main(int argc, char** argv){ //AMD Momento - char* opiniones = AMDTest(); - bool w11 = AMDGMET(); + char* opiniones = AMDMeCagoEnTusPutosMuertos(); + bool w11 = AMDJoderMET(); for (int i = 0; i < 3; i++) { uint64_t isItActually32GHz = estimandoFreq(); log_debugcpp("ayo we found " << isItActually32GHz << " flash knuckle"); } int64_t juas = getFreqFromReg(); - log_debugcpp("satr " << checksatr()); - log_debugcpp("Invariant " << checkInvariantTSC()); + log_debugcpp("JODER " << juas); //iwintewel //Cordura diff --git a/src/test/test.cpp b/src/test/test.cpp index 8126175..1587e16 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -5,8 +5,7 @@ #define _MT #define _DLL #include - #include -//#include + #include #endif #include "../debug.h" @@ -15,31 +14,11 @@ using namespace tmr; #ifdef _WIN64 -static inline int64_t getQPCTicks() { - LARGE_INTEGER ticks; - if (!QueryPerformanceCounter(&ticks)) - { - return 0; - } - return ticks.QuadPart; -} - -static inline int64_t getQPCFrequency() { - LARGE_INTEGER ticks; - if (!QueryPerformanceFrequency(&ticks)) - { - return 0; - } - return ticks.QuadPart; -} - - int main(int argc, char** argv){ - //HMODULE dell; - //DWORD fracaso; + HMODULE dell; + DWORD fracaso; //DllImport TSCTimer* timer; - uint64_t sleep = 1; - uint64_t checks = 0; + int sleep = 1000; /* * dell = LoadLibraryExW(TEXT("libtmrtsc.dll"), NULL, NULL); @@ -52,42 +31,13 @@ int main(int argc, char** argv){ timer = TSCTimer::getTimer(); if(timer == nullptr) return -2; - uint64_t wfr = getQPCFrequency(); - int64_t fr = 3193999000;//timer->getBaseFrequency(); - - - uint64_t wt1 = getQPCTicks(); - int64_t t1 = timer->getTimeStamp(); - int64_t t2 = timer->getTimeStamp(); - while ((t2 - t1) < (sleep * fr)) { - t2 = timer->getTimeStamp(); - checks++; - } - //uint64_t fr = timer->getBaseFrequency(); - uint64_t wt2 = getQPCTicks(); - std::cout << "Sleep: " << sleep << "s\n-----------------\nTest 1: TSCTimer within QPC\n" << std::endl; - std::cout << "QPC Momento: \n t1: " << wt1 << " t2: " << wt2 << " fr: " << wfr << std::endl; - std::cout << " restita: " << wt2-wt1 << std::endl; - std::cout << "TSCTimer Momento: \n t1: " << t1 << " t2: " << t2 << " fr: " << fr << std::endl; - std::cout << " restita: " << t2-t1 << std::endl; - std::cout << " checks: " << checks << "\n-----------------\nTest 2: QPC within TSCTimer\n"<< std::endl; - - checks = 0; - t1 = timer->getTimeStamp(); - wt1 = getQPCTicks(); - wt2 = getQPCTicks(); - while ((wt2 - wt1) < (sleep * wfr)) { - wt2 = getQPCTicks(); - checks++; - } - //uint64_t fr = timer->getBaseFrequency(); - t2 = timer->getTimeStamp(); - std::cout << "QPC Momento: \n t1: " << wt1 << " t2: " << wt2 << " fr: " << wfr << std::endl; - std::cout << " restita: " << wt2-wt1 << std::endl; - std::cout << "TSCTimer Momento: \n t1: " << t1 << " t2: " << t2 << " fr: " << fr << std::endl; - std::cout << " restita: " << t2-t1 << std::endl; - std::cout << " checks: " << checks << std::endl; - + uint64_t t1 = timer->getTimeStamp(); + Sleep(sleep); + uint64_t t2 = timer->getTimeStamp(); + uint64_t fr = timer->getBaseFrequency(); + std::cout << "Siestecita de: " << sleep << " ms" << std::endl; + std::cout << "Windows Momento: \nt1: " << t1 << " t2: " << t2 << " fr: " << fr << std::endl; + std::cout << "restita: " << t2-t1 << std::endl; return 0; } diff --git a/src/tmrtsc.cpp b/src/tmrtsc.cpp index e940356..bac4398 100644 --- a/src/tmrtsc.cpp +++ b/src/tmrtsc.cpp @@ -47,6 +47,7 @@ namespace tmr { int64_t TSCTimer::intelRetrieveART(){ //TODO: Find a valid Intel CPU to debug ART route + //if (freq == nullptr) return - uint64_t raxde, rbxnum, rcxhz; asm volatile ( ".intel_syntax noprefix\t\n" \ diff --git a/src/tmrtsc.hpp b/src/tmrtsc.hpp index 6389381..5eb10b5 100644 --- a/src/tmrtsc.hpp +++ b/src/tmrtsc.hpp @@ -32,18 +32,18 @@ namespace tmr { #ifdef _WIN64 enum winReturnValues{ - CANT_OPEN_KEY = -1, - CANT_RETRIEVE_KEY_INFO = -2, + CANT_OPEN_KEY = -1, + CANT_RETRIEVE_KEY_INFO = -2, CANT_READ_DATA_FROM_VALUE = -3, - CANT_RETRIEVE_FREQUENCY = -4 + CANT_RETRIEVE_FREQUENCY = -4 }; #endif enum ReturnValues { - OPERATION_SUCCESSFUL = 0, - INVARIANT_TSC_NOT_SUPPORTED = -1, - UNSUPPORTED_CPU = -2, + OPERATION_SUCCESSFUL = 0, + INVARIANT_TSC_NOT_SUPPORTED = -1, + UNSUPPORTED_CPU = -2, CANT_READ_FREQUENCY_FROM_SYSTEM = -3, - ART_NOT_REPORTED = -4 + ART_NOT_REPORTED = -4 }; class LIB_EXPORT TSCTimer {