Issue 143 - MinidumpProcessor should extract number of processors. r=mento

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@180 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ted.mielczarek 2007-05-30 12:14:09 +00:00
parent 0e94332f7c
commit 90e050e598
3 changed files with 18 additions and 3 deletions

View file

@ -43,6 +43,9 @@ using std::string;
struct SystemInfo {
public:
SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
cpu_count(0) {}
// Resets the SystemInfo object to its default values.
void Clear() {
os.clear();
@ -50,6 +53,7 @@ struct SystemInfo {
os_version.clear();
cpu.clear();
cpu_info.clear();
cpu_count = 0;
}
// A string identifying the operating system, such as "Windows NT",
@ -82,6 +86,10 @@ struct SystemInfo {
// present in the dump, or additional identifying information is not
// defined for the CPU family, this field will be empty.
string cpu_info;
// The number of processors in the system. Will be greater than one for
// multi-core systems.
int cpu_count;
};
} // namespace google_breakpad

View file

@ -290,6 +290,8 @@ bool MinidumpProcessor::GetCPUInfo(Minidump *dump, SystemInfo *info) {
}
}
info->cpu_count = raw_system_info->number_of_processors;
return true;
}

View file

@ -300,6 +300,9 @@ static void PrintProcessState(const ProcessState& process_state) {
// This field is optional.
printf(" %s\n", cpu_info.c_str());
}
printf(" %d CPU%s\n",
process_state.system_info()->cpu_count,
process_state.system_info()->cpu_count != 1 ? "s" : "");
printf("\n");
// Print crash information.
@ -339,16 +342,18 @@ static void PrintProcessStateMachineReadable(const ProcessState& process_state)
{
// Print OS and CPU information.
// OS|{OS Name}|{OS Version}
// CPU|{CPU Name}|{CPU Info}
// CPU|{CPU Name}|{CPU Info}|{Number of CPUs}
printf("OS%c%s%c%s\n", kOutputSeparator,
StripSeparator(process_state.system_info()->os).c_str(),
kOutputSeparator,
StripSeparator(process_state.system_info()->os_version).c_str());
printf("CPU%c%s%c%s\n", kOutputSeparator,
printf("CPU%c%s%c%s%c%d\n", kOutputSeparator,
StripSeparator(process_state.system_info()->cpu).c_str(),
kOutputSeparator,
// this may be empty
StripSeparator(process_state.system_info()->cpu_info).c_str());
StripSeparator(process_state.system_info()->cpu_info).c_str(),
kOutputSeparator,
process_state.system_info()->cpu_count);
int requesting_thread = process_state.requesting_thread();