|
15 | 15 | #include "ProfileList.h"
|
16 | 16 | #include "SystemDetails.h"
|
17 | 17 |
|
| 18 | +#include "CpuInfo.h" |
| 19 | + |
18 | 20 | HRESULT Orc::SystemIdentity::Write(const std::shared_ptr<StructuredOutput::IOutput>& writer, IdentityArea areas)
|
19 | 21 | {
|
20 | 22 | if (areas & IdentityArea::Process)
|
@@ -484,26 +486,17 @@ HRESULT Orc::SystemIdentity::CPU(const std::shared_ptr<StructuredOutput::IOutput
|
484 | 486 | BOOST_SCOPE_EXIT(&writer, &elt) { writer->EndCollection(elt); }
|
485 | 487 | BOOST_SCOPE_EXIT_END;
|
486 | 488 |
|
487 |
| - auto result = SystemDetails::GetCPUInfo(); |
488 |
| - if (!result) |
489 |
| - { |
490 |
| - assert(result.error().category() == std::system_category()); |
491 |
| - return result.error().value(); |
492 |
| - } |
| 489 | + writer->BeginElement(nullptr); |
| 490 | + BOOST_SCOPE_EXIT(&writer) { writer->EndElement(nullptr); } |
| 491 | + BOOST_SCOPE_EXIT_END; |
493 | 492 |
|
494 |
| - const auto& cpus = result.value(); |
495 |
| - for (const auto& cpu : cpus) |
496 |
| - { |
497 |
| - writer->BeginElement(nullptr); |
498 |
| - BOOST_SCOPE_EXIT(&writer) { writer->EndElement(nullptr); } |
499 |
| - BOOST_SCOPE_EXIT_END; |
| 493 | + CpuInfo cpuInfo; |
| 494 | + writer->WriteNamed(L"manufacturer", cpuInfo.Manufacturer()); |
| 495 | + writer->WriteNamed(L"name", cpuInfo.Name()); |
| 496 | + writer->WriteNamed(L"physical_processors", cpuInfo.PhysicalCores()); |
| 497 | + writer->WriteNamed(L"logical_processors", cpuInfo.LogicalCores()); |
| 498 | + writer->WriteNamed(L"hyperthreading", cpuInfo.IsHyperThreadingEnabled()); |
500 | 499 |
|
501 |
| - writer->WriteNamed(L"name", cpu.Name.c_str()); |
502 |
| - writer->WriteNamed(L"description", cpu.Description.c_str()); |
503 |
| - writer->WriteNamed(L"cores", (ULONG32)cpu.Cores); |
504 |
| - writer->WriteNamed(L"enabled_cores", (ULONG32)cpu.EnabledCores); |
505 |
| - writer->WriteNamed(L"logical_processors", (ULONG32)cpu.LogicalProcessors); |
506 |
| - } |
507 | 500 | return S_OK;
|
508 | 501 | }
|
509 | 502 |
|
|
0 commit comments