|
23 | 23 | #include <sys/time.h> |
24 | 24 | #include <sys/resource.h> |
25 | 25 | #include <chrono> |
| 26 | +#include <thread> |
26 | 27 | #endif |
27 | 28 |
|
28 | 29 | typedef struct _PROCESSOR_POWER_INFORMATION |
@@ -73,11 +74,13 @@ void QueryPerformanceCounter(PLARGE_INTEGER result) |
73 | 74 |
|
74 | 75 | DWORD timeGetTime() |
75 | 76 | { |
76 | | - std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now(); |
| 77 | + /* std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now(); |
77 | 78 |
|
78 | 79 | auto nanosec = now.time_since_epoch(); |
79 | 80 |
|
80 | 81 | return nanosec.count()/(1000000000.0 *60.0 *60.0); |
| 82 | + */ |
| 83 | + return SDL_GetTicks(); |
81 | 84 | } |
82 | 85 |
|
83 | 86 | #endif |
@@ -305,30 +308,22 @@ bool g_initialize_cpu_called = false; |
305 | 308 | //------------------------------------------------------------------------------------ |
306 | 309 | void _initialize_cpu() |
307 | 310 | { |
308 | | - // General CPU identification |
309 | | - if (!query_processor_info(&CPU::ID)) |
310 | | - FATAL("Can't detect CPU/FPU."); |
311 | 311 |
|
312 | 312 | CPU::Detect(); |
313 | 313 |
|
314 | | - Msg("* Detected CPU: %s [%s], F%d/M%d/S%d, 'rdtsc'", CPU::ID.modelName, |
315 | | - +CPU::ID.vendor, CPU::ID.family, CPU::ID.model, CPU::ID.stepping); |
316 | | - |
317 | 314 | string256 features; |
318 | 315 | xr_strcpy(features, sizeof(features), "RDTSC"); |
319 | | - if (CPU::ID.hasFeature(CpuFeature::Mmx)) xr_strcat(features, ", MMX"); |
320 | | - if (CPU::ID.hasFeature(CpuFeature::_3dNow)) xr_strcat(features, ", 3DNow!"); |
321 | | - if (CPU::ID.hasFeature(CpuFeature::Sse)) xr_strcat(features, ", SSE"); |
322 | | - if (CPU::ID.hasFeature(CpuFeature::Sse2)) xr_strcat(features, ", SSE2"); |
323 | | - if (CPU::ID.hasFeature(CpuFeature::Sse3)) xr_strcat(features, ", SSE3"); |
324 | | - if (CPU::ID.hasFeature(CpuFeature::MWait)) xr_strcat(features, ", MONITOR/MWAIT"); |
325 | | - if (CPU::ID.hasFeature(CpuFeature::Ssse3)) xr_strcat(features, ", SSSE3"); |
326 | | - if (CPU::ID.hasFeature(CpuFeature::Sse41)) xr_strcat(features, ", SSE4.1"); |
327 | | - if (CPU::ID.hasFeature(CpuFeature::Sse42)) xr_strcat(features, ", SSE4.2"); |
328 | | - if (CPU::ID.hasFeature(CpuFeature::HT)) xr_strcat(features, ", HTT"); |
| 316 | + if (SDL_HasMMX()) xr_strcat(features, ", MMX"); |
| 317 | + if (SDL_Has3DNow()) xr_strcat(features, ", 3DNow!"); |
| 318 | + if (SDL_HasSSE()) xr_strcat(features, ", SSE"); |
| 319 | + if (SDL_HasSSE2()) xr_strcat(features, ", SSE2"); |
| 320 | + if (SDL_HasSSE3()) xr_strcat(features, ", SSE3"); |
| 321 | + if (SDL_HasRDTSC()) xr_strcat(features, ", RDTSC"); |
| 322 | + if (SDL_HasSSE41()) xr_strcat(features, ", SSE4.1"); |
| 323 | + if (SDL_HasSSE42()) xr_strcat(features, ", SSE4.2"); |
329 | 324 |
|
330 | 325 | Msg("* CPU features: %s", features); |
331 | | - Msg("* CPU cores/threads: %d/%d", CPU::ID.n_cores, CPU::ID.n_threads); |
| 326 | + Msg("* CPU cores/threads: %d/%d", std::thread::hardware_concurrency(), SDL_GetCPUCount()); |
332 | 327 |
|
333 | 328 | #if defined(WINDOWS) |
334 | 329 | SYSTEM_INFO sysInfo; |
@@ -378,7 +373,7 @@ void _initialize_cpu_thread() |
378 | 373 | else |
379 | 374 | FPU::m24r(); |
380 | 375 |
|
381 | | - if (CPU::ID.hasFeature(CpuFeature::Sse)) |
| 376 | + if (SDL_HasSSE()) |
382 | 377 | { |
383 | 378 | //_mm_setcsr ( _mm_getcsr() | (_MM_FLUSH_ZERO_ON+_MM_DENORMALS_ZERO_ON) ); |
384 | 379 | _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); |
|
0 commit comments