110,580
社区成员
发帖
与我相关
我的任务
分享
NetworkInterface.GetIsNetworkAvailable();
DriveInfo.GetDrives();
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
internal int dwOemId;
internal int dwPageSize;
internal IntPtr lpMinimumApplicationAddress;
internal IntPtr lpMaximumApplicationAddress;
internal IntPtr dwActiveProcessorMask;
internal int dwNumberOfProcessors;
internal int dwProcessorType;
internal int dwAllocationGranularity;
internal short wProcessorLevel;
internal short wProcessorRevision;
}
[DllImport("kernel32.dll", SetLastError=true)]
public static extern void GetSystemInfo(ref SYSTEM_INFO lpSystemInfo);
PerformanceCounter pfc = new PerformanceCounter("Processor", "% Processor Time", "_Total");
PerformanceCounter networkReceivePerformance = new PerformanceCounter("Network Interface", "Bytes Received/sec", "Realtek PCIe FE Family Controller");
PerformanceCounter networkSendPerformance = new PerformanceCounter("Network Interface", "Bytes Sent/sec", "Realtek PCIe FE Family Controller");
PerformanceCounter diskPerformance = new PerformanceCounter("LogicalDisk", "% Free Space", "_Total");
PerformanceCounter memoryPerformance = new PerformanceCounter("Memory", "Available MBytes");