代码: using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using System.IO; using System.Text; using System.Management; using System.Runtime.InteropServices; namespace Lemony.SystemInfo { /// /// 系统信息类 - 获取C
using System.Management; using System.Net; public class PCInfoHelper { /// <summary> /// 操作系统的登录用户名 /// </summary> /// <returns></returns> public static string GetUserName() { try { string username = ""; ManagementClass m
github地址:https://github.com/charygao/SmsComputerMonitor 软件用于实时监控当前系统资源等情况,并调用接口,当资源被超额占用时,发送警报到个人手机:界面模拟Console的显示方式,信息缓冲大小由配置决定:可以定制监控的资源,包括: cpu使用率: 内存使用率: 磁盘使用率: 网络使用率: 进程线程数: using System; using System.Collections.Generic; using System.Diagnostic
首先是获取特定进程对象,可以使用Process.GetProcesses()方法来获取系统中运行的所有进程,或者使用Process.GetCurrentProcess()方法来获取当前程序所对应的进程对象.当有了进程对象后,可以通过进程对象名称来创建PerformanceCounter类型对象,通过设定PerformanceCounter构造函数的参数实现获取特定进程的CPU和内存使用情况. 具体实例代码如下: 首先是获取本机中所有进程对象,分别输出某一时刻各个进程的内存使用情况: using
using System;using System.Management; namespace MmPS.Common.Helper{ /// <summary> /// 获取计算机相关的信息 /// </summary> public class Computer { public static string CpuID; //1.cpu序列号 public static string MacAddress; //2.mac序列号 public static string Dis