Skip to content

Commit

Permalink
add Hygon Dhyana support hyperic#129
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhanyin committed Aug 28, 2024
1 parent a053a7b commit 09b4830
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go_bindings/Sigar/src/os/win32/win32_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,8 @@ static int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info)
else {
if (strEQ(info->vendor, "AuthenticAMD")) {
SIGAR_SSTRCPY(info->vendor, "AMD");
} else if (strEQ(info->vendor, "HygonGenuine")) {
SIGAR_SSTRCPY(info->vendor, "Hygon");
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/os/linux/linux_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,9 @@ static int get_cpu_info(sigar_t *sigar, sigar_cpu_info_t *info,
else if (strEQ(info->vendor, "AuthenticAMD")) {
SIGAR_SSTRCPY(info->vendor, "AMD");
}
else if (strEQ(info->vendor, "HygonGenuine")) {
SIGAR_SSTRCPY(info->vendor, "Hygon");
}
}
break;
case 'f':
Expand Down
3 changes: 3 additions & 0 deletions src/os/win32/win32_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,9 @@ static int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info)
if (strEQ(info->vendor, "AuthenticAMD")) {
SIGAR_SSTRCPY(info->vendor, "AMD");
}
else if (strEQ(info->vendor, "HygonGenuine")) {
SIGAR_SSTRCPY(info->vendor, "Hygon");
}
}

size = sizeof(info->model);
Expand Down
3 changes: 2 additions & 1 deletion src/sigar_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ static void sigar_cpuid(sigar_uint32_t request,

#define INTEL_ID 0x756e6547
#define AMD_ID 0x68747541
#define HYGON_ID 0x6f677948

int sigar_cpu_core_count(sigar_t *sigar)
{
Expand All @@ -565,7 +566,7 @@ int sigar_cpu_core_count(sigar_t *sigar)

sigar_cpuid(0, &id);

if ((id.ebx == INTEL_ID) || (id.ebx == AMD_ID)) {
if ((id.ebx == INTEL_ID) || (id.ebx == AMD_ID) || (id.ebx == HYGON_ID)) {
sigar_cpuid(1, &id);

if (id.edx & (1<<28)) {
Expand Down

0 comments on commit 09b4830

Please sign in to comment.