remove cpu vendor name from model name

This commit is contained in:
Doug MacEachern 2004-07-02 01:37:01 +00:00
parent 2168c3b578
commit f56206bbca
1 changed files with 13 additions and 0 deletions

View File

@ -258,6 +258,9 @@ double sigar_file_system_usage_calc_used(sigar_t *sigar,
return 0;
}
#define IS_CPU_R(p) \
((*p == '(') && (*(p+1) == 'R') && (*(p+2) == ')'))
/* common to win32 and linux */
void sigar_cpu_model_adjust(sigar_t *sigar, sigar_cpu_info_t *info)
{
@ -272,6 +275,16 @@ void sigar_cpu_model_adjust(sigar_t *sigar, sigar_cpu_info_t *info)
while (*ptr == ' ') ++ptr;
while (*end == ' ') *--end = '\0';
/* remove vendor from model name */
len = strlen(info->vendor);
if (strnEQ(ptr, info->vendor, len)) {
ptr += len;
if (IS_CPU_R(ptr)) {
ptr += 3; /* remove (R) */
while (*ptr == ' ') ++ptr;
}
}
strcpy(info->model, ptr);
}