如何获取 CPU 使用率 &PowerShell脚本中特定进程消耗的内存 [英] How to get CPU usage & Memory consumed by particular process in powershell script

查看:61
本文介绍了如何获取 CPU 使用率 &PowerShell脚本中特定进程消耗的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到单个进程的性能,例如SqlServer"

I want to find performance of single process, as example "SqlServer"

我应该写哪些命令来找出两件事:

Which commands I should write to find out 2 things:

  1. SqlServer 使用的 RAM
  2. SqlServer 使用的 CPU

我找到了很多列出所有进程的解决方案,但我只想得到 1 个,即 SqlServer.

I found lot of solutions listing all processes, but I want to get only 1 i.e. SqlServer.

推荐答案

获取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.

这篇关于如何获取 CPU 使用率 &PowerShell脚本中特定进程消耗的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆