本文整理汇总了C++中SystemInfo::GetSystemInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ SystemInfo::GetSystemInfo方法的具体用法?C++ SystemInfo::GetSystemInfo怎么用?C++ SystemInfo::GetSystemInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SystemInfo
的用法示例。
在下文中一共展示了SystemInfo::GetSystemInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
status_t
DebugReportGenerator::_GenerateReportHeader(BFile& _output)
{
AutoLocker< ::Team> locker(fTeam);
BString data;
data.SetToFormat("Debug information for team %s (%" B_PRId32 "):\n",
fTeam->Name(), fTeam->ID());
WRITE_AND_CHECK(_output, data);
cpu_platform platform = B_CPU_UNKNOWN;
cpu_vendor cpuVendor = B_CPU_VENDOR_UNKNOWN;
uint32 cpuModel = 0;
uint32 topologyNodeCount = 0;
cpu_topology_node_info* topology = NULL;
get_cpu_topology_info(NULL, &topologyNodeCount);
if (topologyNodeCount != 0) {
topology = new(std::nothrow) cpu_topology_node_info[topologyNodeCount];
if (topology == NULL)
return B_NO_MEMORY;
BPrivate::ArrayDeleter<cpu_topology_node_info> deleter(topology);
get_cpu_topology_info(topology, &topologyNodeCount);
for (uint32 i = 0; i < topologyNodeCount; i++) {
switch (topology[i].type) {
case B_TOPOLOGY_ROOT:
platform = topology[i].data.root.platform;
break;
case B_TOPOLOGY_PACKAGE:
cpuVendor = topology[i].data.package.vendor;
break;
case B_TOPOLOGY_CORE:
cpuModel = topology[i].data.core.model;
break;
default:
break;
}
}
}
SystemInfo sysInfo;
if (fDebuggerInterface->GetSystemInfo(sysInfo) == B_OK) {
const system_info &info = sysInfo.GetSystemInfo();
data.SetToFormat("CPU(s): %" B_PRId32 "x %s %s\n",
info.cpu_count, get_cpu_vendor_string(cpuVendor),
get_cpu_model_string(platform, cpuVendor, cpuModel));
WRITE_AND_CHECK(_output, data);
char maxSize[32];
char usedSize[32];
data.SetToFormat("Memory: %s total, %s used\n",
BPrivate::string_for_size((int64)info.max_pages * B_PAGE_SIZE,
maxSize, sizeof(maxSize)),
BPrivate::string_for_size((int64)info.used_pages * B_PAGE_SIZE,
usedSize, sizeof(usedSize)));
WRITE_AND_CHECK(_output, data);
const utsname& name = sysInfo.GetSystemName();
data.SetToFormat("Haiku revision: %s (%s)\n", name.version,
name.machine);
WRITE_AND_CHECK(_output, data);
}
return B_OK;
}