windows version of sigar_cpuid
This commit is contained in:
parent
5e4f8821cb
commit
7c61bc6695
@ -483,8 +483,6 @@ double sigar_file_system_usage_calc_used(sigar_t *sigar,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux__) || defined(DARWIN)
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sigar_uint32_t eax;
|
sigar_uint32_t eax;
|
||||||
sigar_uint32_t ebx;
|
sigar_uint32_t ebx;
|
||||||
@ -492,6 +490,8 @@ typedef struct {
|
|||||||
sigar_uint32_t edx;
|
sigar_uint32_t edx;
|
||||||
} sigar_cpuid_t;
|
} sigar_cpuid_t;
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(DARWIN)
|
||||||
|
|
||||||
# if defined(__i386__)
|
# if defined(__i386__)
|
||||||
# define SIGAR_HAS_CPUID
|
# define SIGAR_HAS_CPUID
|
||||||
static void sigar_cpuid(sigar_uint32_t request, sigar_cpuid_t *id)
|
static void sigar_cpuid(sigar_uint32_t request, sigar_cpuid_t *id)
|
||||||
@ -523,6 +523,27 @@ static void sigar_cpuid(sigar_uint32_t request,
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
#elif defined(WIN32)
|
||||||
|
# ifdef _M_X64
|
||||||
|
/*XXX*/
|
||||||
|
# else
|
||||||
|
# define SIGAR_HAS_CPUID
|
||||||
|
static void sigar_cpuid(sigar_uint32_t request,
|
||||||
|
sigar_cpuid_t *id)
|
||||||
|
{
|
||||||
|
__asm {
|
||||||
|
mov edi, id
|
||||||
|
mov eax, [edi].eax
|
||||||
|
mov ecx, [edi].ecx
|
||||||
|
cpuid
|
||||||
|
mov [edi].eax, eax
|
||||||
|
mov [edi].ebx, ebx
|
||||||
|
mov [edi].ecx, ecx
|
||||||
|
mov [edi].edx, edx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INTEL_ID 0x756e6547
|
#define INTEL_ID 0x756e6547
|
||||||
#define AMD_ID 0x68747541
|
#define AMD_ID 0x68747541
|
||||||
@ -547,7 +568,6 @@ int sigar_cpu_core_count(sigar_t *sigar)
|
|||||||
|
|
||||||
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
|
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
|
||||||
"[cpu] %d cores per socket", sigar->lcpu);
|
"[cpu] %d cores per socket", sigar->lcpu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sigar->lcpu;
|
return sigar->lcpu;
|
||||||
@ -574,12 +594,10 @@ int sigar_cpu_core_rollup(sigar_t *sigar)
|
|||||||
"[cpu] rolling up cores to sockets");
|
"[cpu] rolling up cores to sockets");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* cpuid stuff */
|
|
||||||
|
|
||||||
#define IS_CPU_R(p) \
|
#define IS_CPU_R(p) \
|
||||||
((*p == '(') && (*(p+1) == 'R') && (*(p+2) == ')'))
|
((*p == '(') && (*(p+1) == 'R') && (*(p+2) == ')'))
|
||||||
|
Loading…
Reference in New Issue
Block a user