C#中获取当前CPU编号和线程名称
1,在类中导入静态成员函数:
using System.Runtime.InteropServices;
.....
[DllImport("kernel32.dll")]
extern public static int GetCurrentProcessorNumber();
2,使用:
int myProcessorNum = GetCurrentProcessorNumber();
string threadName = Thread.CurrentThread.Name;