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

编程入门 行业动态 更新时间:2024-10-27 10:19:21
本文介绍了如何获取 CPU 使用率 &PowerShell脚本中特定进程消耗的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

Which commands I should write to find out 2 things:

  • SqlServer 使用的 RAM
  • 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脚本中特定进程消耗的内存

    本文发布于:2023-11-16 16:50:17,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1606093.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:使用率   脚本   消耗   进程   内存

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!