![]() Now the output will show you details regarding a process and which processor its running. To view this detail you will have to press f key while on top command interface and then press j(press Enter key after you pressed j). The default top command output does not show these details. ![]() It was true at some point between when you made the open call on the file in proc and when that call returned. Note that all of this information may be obsolete by the time you get it. To see what the rest of the fields mean, have a look at the Linux kernel source - specifically the do_task_stat function in fs/proc/array.c or Documentation/filesystems/stat.txt. The third field will be an 'R' if the thread is running. To get the information you want, look in /proc//task//status. And the scheduler won't know ahead of time which core it will run a thread on because that will depend on future usage of those cores. Tasks don't sleep in any particular core. Sprintf(str, "%08X", varECX) //i.e.The answer below is no longer accurate as of 2014 Sprintf(PSN, "%s-%C%C%C%C-%C%C%C%C", PSN, str, str, str, str, str, str, str, str) %eax=3 gives least significant 64 bits in edx and ecx Sprintf(PSN, "%C%C%C%C-%C%C%C%C", str, str, str, str, str, str, str, str) %eax=1 gives most significant 32 bits in eax String vendorName = (it = vendorIdToName.end()) ? "Unknown" : it->second Ĭout << "Max instruction ID: " << eax << endl Ĭout << "Vendor ID: " << vendorIDString << endl Ĭout << "Vendor name: " << vendorName << endl String vendorIDString = vendorID.toString() Īuto it = vendorIdToName.find(vendorIDString) VendorIdToName = "National Semiconductor" _get_cpuid(level, &eax, &ebx, &ecx, &edx) ĬPUVendorID vendorID Return string(reinterpret_cast(this), 12) Sample (I have GCC 4.7+ and feel happy of using "auto" here): #include If this does not show anything, your system does not support a processor serial number. On a Linux system you can check for the presence of this feature (PSN bit) by doing: grep -i -color psn /proc/cpuinfo Where a good reference on how to use the CPUID instruction is in this Wikipedia article.ĮDIT The Wikipedia article says that the serial number was introduced with the Pentium III but was not anymore implemented in later models due to privacy concerns. ![]() Printf("serial number 0x%08x%08x\n", edx, ecx) ** see the CPUID Wikipedia article on which models return the serial Printf("extended family %d\n", (eax > 20) & 0xFF) Printf("extended model %d\n", (eax > 16) & 0xF) Printf("processor type %d\n", (eax > 12) & 0x3) Which one then can use as e.g.: #include Įax = 1 /* processor info and feature bits */ * ecx is often an input as well as an output. Here is what the Linux kernel seems to use: static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |