Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Hygon Dhyana support #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions go_bindings/Sigar/src/os/win32/win32_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,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: 3 additions & 0 deletions src/os/linux/linux_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,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 @@ -2215,6 +2215,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