Hello Camm,
I have an old program I have written in Visual Studio, that extract
information about the CPU. (Vendor, number of cores and logical CPU:s,
and hyper-treading support.) I include the source for this program in my
mail.
It will not give you all information about a computer that you need, but
I think that it's a start. I can probably expand the program to provide
more of the information you need it.
When it comes to information about the operating system version, you can
use the command systeminfo. It provides a lot of valuable information,
but it is slow. (1-3 minutes on my machine). It will provide info about
the processor as part of it's output as well. (It says: "AMD64 Family 16
Model 5 Stepping 3 AuthenticAMD ~3100 Mhz" about my CPU) It provedes
info about the operating system name and exact version as well.
I hope this will provide you with the information you need.
Send me a mail if you need more info, I have a strong background in both
Windows and Unix/LInux and should be able to provide answers in a lot of
cases.
Best regards,
Sören Jonsson
SWEDEN
Greetings, and thank you both for your helpful replies!
I have remote rdp access to a win7 box with msys, cygwin, and mingw32
installed for gcl development purposes. Frankly, the less I have to
learn about windows internals, the better, but I am the original author
of the file that needs modification.
I tried installing msys2, but on attempting a run of the downloaded
executable, windows tells me that it is incompatible. I noticed also in
Soren's posted instructions that mingw64 or parts thereof are only
supported on a 64 bit host. I don't even know how to determine the
running cpu or os in windows to chase this down.
The existing mingw installation manager does not offer 64bit package
options.
If no obvious solution comes to mind, I'll write to the admin of the
box.
Take care,
// CPUInfo.cpp : main project file.
#include "stdafx.h"
using namespace System;
#include <iostream>
#include <string>
#include <intrin.h>
using namespace std;
void cpuID(unsigned i, unsigned regs[4]) {
#ifdef _WIN32 || _WIN64
__cpuid((int *)regs, (int)i);
#else
asm volatile
("cpuid" : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
: "a" (i), "c" (0));
// ECX is set to zero for CPUID function 4
#endif
}
int main(array<System::String ^> ^args)
{
unsigned regs[4];
// Get vendor
char vendor[12];
cpuID(0, regs);
((unsigned *)vendor)[0] = regs[1]; // EBX
((unsigned *)vendor)[1] = regs[3]; // EDX
((unsigned *)vendor)[2] = regs[2]; // ECX
string cpuVendor = string(vendor, 12);
// Get CPU features
cpuID(1, regs);
unsigned cpuFeatures = regs[3]; // EDX
// CPU Vendor
cout << " cpu vendor: " << cpuVendor << endl;
// Logical core count per CPU
cpuID(1, regs);
unsigned logical = (regs[1] >> 16) & 0xff; // EBX[23:16]
cout << " logical cpus: " << logical << endl;
unsigned cores = logical;
if (cpuVendor == "GenuineIntel") {
// Get DCP cache info
cpuID(4, regs);
cores = ((regs[0] >> 26) & 0x3f) + 1; // EAX[31:26] + 1
} else if (cpuVendor == "AuthenticAMD") {
// Get NC: Number of CPU cores - 1
cpuID(0x80000008, regs);
cores = ((unsigned)(regs[2] & 0xff)) + 1; // ECX[7:0] + 1
}
cout << " cpu cores: " << cores << endl;
// Detect hyper-threads
bool hyperThreads = cpuFeatures & (1 << 28) && cores < logical;
cout << "hyper-threads: " << (hyperThreads ? "true" : "false") << endl;
return 0;
}
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
// TODO: reference additional headers your program requires here
_______________________________________________
Gcl-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gcl-devel