
这个需要进进程管理查看
如何打开进程管理器
快捷键Ctrl+Alt+方向键下键(或者小键盘的Enter键)
另一种方法,就是鼠标移至屏幕下方的图标栏,右击鼠标,选择任务管理器
在任务管理器--进程里面就可以看到那些那些程序正在运行
如果想看CPU占用率排行,点击一下CPU就会把CPU占用率最高的按顺序排布下来
是WinXP,可以按Ctrl+Alt+小键盘Del键打开任务管理器,或者开始栏右键,任务管理器,就可以查看CPU占用,但是要看内存使用率就比较麻烦。一般用电脑维护软件如360安全卫士,腾讯电脑管家等。或者下载内存检测的软件进行检测。
Win7就方便多了,可以Ctrl+Alt+小键盘Del键 ,在出现的菜单中选择任务管理器,或者开始栏右键,选择任务管理器,即可查看CPU使用率和内存使用率。
//cpu频率
using MicrosoftWin32;
private int GetCPUFrequency()
{
RegistryKey rk = RegistryLocalMachineOpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
object obj = rkGetValue("~MHz");
int CPUFrequency = (int)obj;
return CPUFrequency;
}
//////////////////////////////////
//磁盘空间 Management
using SystemManagement;
private long GetFreeDiskSpace()
{
ManagementObject disk = new ManagementObject(
"win32_logicaldiskdeviceid=\"d:\"");
diskGet();
string totalByte = disk["FreeSpace"]ToString();
long freeDiskSpaceMb = ConvertToInt64(totalbyte)/1024/1024;
return freeDiskSpaceMb;
}
/////////////////////
//内存信息
using System;
using SystemText;
using SystemRuntimeInteropServices;
namespace ConsoleApplication1
{
///// <summary>
/// Summary description for Class1
/// </summary>
class Class1
{
[StructLayout(LayoutKindSequential)]
public struct MEMORY_INFO
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}
[DllImport("kernel32")]
public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);
public static int Main(string[] args)
{
Class1 class1 = new Class1();
class1GetMemoryStatus();
return 0;
}
private void GetMemoryStatus()
{
MEMORY_INFO MemInfo;
MemInfo = new MEMORY_INFO();
GlobalMemoryStatus(ref MemInfo);
long totalMb = ConvertToInt64( MemInfodwTotalPhysToString())/1024/1024;
long avaliableMb = ConvertToInt64( MemInfodwAvailPhysToString())/1024/1024;
ConsoleWriteLine( "物理内存共有" + totalMb + " MB");
ConsoleWriteLine( "可使用的物理内存有" + avaliableMb +" MB");
}
}
//////////////////////////////
//cpu名字
using MicrosoftWin32;
private string GetCPUName()
{
RegistryKey rk = RegistryLocalMachineOpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
object obj = rkGetValue("ProcessorNameString");
string CPUName = (string)obj;
return CPUNameTrimStart();
}
///////////////////////
//OS版本
using System;
namespace determineOS_CS
{
class Class1
{
static void Main(string[] args)
{
// Get OperatingSystem information from the system namespace
SystemOperatingSystem osInfo =SystemEnvironmentOSVersion;
// Determine the platform
switch(osInfoPlatform)
{
// Platform is Windows 95, Windows 98,
// Windows 98 Second Edition, or Windows Me
case SystemPlatformIDWin32Windows:
switch (osInfoVersionMinor)
{
case 0:
ConsoleWriteLine ("Windows 95");
break;
case 10:
if(osInfoVersionRevisionToString()=="2222A")
ConsoleWriteLine("Windows 98 Second Edition");
else
ConsoleWriteLine("Windows 98");
break;
case 90:
ConsoleWriteLine("Windows Me");
break;
}
break;
// Platform is Windows NT 351, Windows NT 40, Windows 2000,
// or Windows XP
case SystemPlatformIDWin32NT:
switch(osInfoVersionMajor)
{
case 3:
ConsoleWriteLine("Windows NT 351");
break;
case 4:
ConsoleWriteLine("Windows NT 40");
break;
case 5:
if (osInfoVersionMinor==0)
ConsoleWriteLine("Windows 2000");
else
ConsoleWriteLine("Windows XP");
break;
}break;
}
ConsoleReadLine ();
}
}
}
嘎嘎
以上就是关于如何获得某个进程所占用CPU和内存的使用情况全部的内容,包括:如何获得某个进程所占用CPU和内存的使用情况、如何获取当前进程的CPU使用率,内存使用率、c# 如何获取某一个进程的cpu和内存使用情况等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)