且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取 CPU 使用率 &PowerShell脚本中特定进程消耗的内存

更新时间:2023-11-13 09:02:16

获取SQL server进程信息的命令:

The command to get SQL server process information:

Get-Process SQLSERVR

获取任何以 S 开头的进程的信息的命令:

The command to get information for any process that starts with S:

Get-Process S*

获取 SQLServer 进程正在使用的虚拟内存量:

To get the amount of virtual memory that the SQLServer process is using:

Get-Process SQLSERVR | Select-Object VM

获取进程工作集的大小,以千字节为单位:

To get the size of the working set of the process, in kilobytes:

Get-Process SQLSERVR | Select-Object WS 

要获取进程正在使用的可分页内存量,以千字节为单位:

To get the amount of pageable memory that the process is using, in kilobytes:

Get-Process SQLSERVR - Select-Object PM

要获取进程正在使用的不可分页内存量,以千字节为单位:

To get the amount of non-pageable memory that the process is using, in kilobytes:

Get-Process SQLSERVR - Select-Object NPM

获取 CPU(进程在所有处理器上使用的处理器时间量,以秒为单位):

To get CPU (The amount of processor time that the process has used on all processors, in seconds):

Get-process SQLSERVR | Select-Object CPU

要更好地理解 Get-Process cmdlet,请在此处查看 technet 上的文档.

To better understand the Get-Process cmdlet, check out the documentation on technet here.