c统计多线程总时间_SQL Server处理器性能指标–第2部分–处理器:%用户时间,处理器:%特权时间,总时间和线程指标...

c统计多线程总时间

In SQL server processor performance metrics – Part 1 – The most important cpu metrics, we described the Processor Queue Length and two most important processor time counters – Processor % Processor Time and Process % Processor time

In this part, we will continue describing important time processor counters

SQL Server处理器性能指标–第1部分–最重要的cpu​​指标中 ,我们描述了处理器队列长度和两个最重要的处理器时间计数器– 处理器%处理器时间进程%处理器时间

在这一部分中,我们将继续描述重要的时间处理器计数器

处理器:%用户时间 (Processor: % User Time)

There are two modes for all processes executed on a Windows operating system: a user mode and privileged (kernel) mode. The operations that require direct access to memory and machine hardware are executed in the privileged mode (I/O operations, disk access, system services, etc.). All user applications and processes (this is where SQL Server belongs) are executed in the user mode

Windows操作系统上执行的所有进程都有两种模式:用户模式和特权(内核)模式。 需要直接访问内存和机器硬件的操作以特权模式执行(I / O操作,磁盘访问,系统服务等)。 所有用户应用程序和进程(这是SQL Server所属的地方)均在用户模式下执行

The Processor: % User Time value “Corresponds to the percentage of time that the processor spends on executing user processes such as SQL Server.” [1]

处理器: 用户时间 百分比“与处理器在执行用户进程(例如SQL Server)上花费的时间百分比相对应。” [1]

In other words, this is the percentage of processor non-idle time spent on user processes

换句话说,这是在用户进程上花费的处理器非空闲时间的百分比

If the Processor:% User Time high values are caused by SQL Server, the reason can be non-optimal SQL Server configuration, excessive querying, schema issues, etc. Further troubleshooting requires finding the process or batch that uses so much processor time

如果Processor:%User Time高值是由SQL Server引起的,则原因可能是SQL Server配置不理想,查询过多,架构问题等。进一步的故障排除需要找到占用大量处理器时间的进程或批处理。

The Processor:% User Time values close to 100% are a clear indication of processor bottlenecks. It means that user processes are using the processor all the time. To troubleshoot the issue, the first step is to determine the user application that causes the bottleneck

处理器:%用户时间值接近100%清楚地表明了处理器瓶颈。 这意味着用户进程一直在使用处理器。 要解决此问题,第一步是确定导致瓶颈的用户应用程序

In an environment with multiple SQL Server instances running, it’s important to monitor each instance performance individually, to be able to easier troubleshoot excessive processor usage

在运行多个SQL Server实例的环境中,重要的是单独监视每个实例的性能,以便能够更轻松地解决过多的处理器使用问题。

There is no specific value for this counter, you should monitor its value for a while and set a baseline. However, as the recommended Processor: % Processor Time value is 80% and the recommended Processor: % Privilege Time is maximum 10%, this leads to the conclusion that the recommended Processor: % User Time is below 70%

该计数器没有特定的值,您应该监视其值一段时间并设置基准。 但是,由于建议的处理器:%处理器时间值为80%,建议的处理器:%特权时间最大值为10%,因此得出以下结论:建议的处理器:%用户时间低于70%

It’s expected that complex operations use more processor time. The value graph goes up then, but it should fall down to the baseline value afterwards. The Processor: % User Time value can oscillate around the baseline approximately 10% during the normal operation. If the peaks appear without an obvious reason, the user processes executed on the machine should be investigated

预计复杂的操作会占用更多的处理器时间。 值图随后上升,但随后应下降到基线值。 在正常操作期间,“ 处理器:用户时间百分比”值可以在基线附近振荡大约10%。 如果没有明显原因出现峰值,则应调查机器上执行的用户进程

处理器:特权时间百分比 (Processor: % Privilege Time)

The Processor: % Privilege Time counter shows how much time the processor spends on executing non-user processes, i.e. privilege (kernel) mode operations

处理器:特权时间百分比计数器显示处理器在执行非用户进程(即特权(内核)模式操作)上花费的时间

“If the processor is very busy and this mode is high, it is usually an indication of some type of NT service having difficulty, although user mode programs can make calls to the Kernel mode NT components to occasionally cause this type of performance issue.” [1]

“如果处理器很忙并且此模式很高,通常表明某种类型的NT服务存在困难,尽管用户模式程序可能会调用内核模式NT组件,偶尔会引起这种类型的性能问题。” [1]

This is another important counter that helps determining whether the processor problems originate from internal Windows processes, or are caused by a user application

这是另一个重要的计数器,可帮助确定处理器问题是源自Windows内部进程还是由用户应用程序引起

The sum of Processor: % Privilege Time and Processor: % User Time gives Processor: % Processor Time There’s no need to monitor Processor: % Privilege Time, Processor: % User Time, and Processor: % Processor Time, as the third value can be calculated using other two. Monitoring any two of these will be sufficient

处理器总和:特权时间百分比 处理器:%用户时间为处理器:%处理器时间,无需监视处理器:%特权时间处理器:%用户时间 ,以及处理器:%处理器时间 ,因为可以使用其他两个值来计算第三个值。 监视其中任何两个就足够了

“the proportion of % Privileged Time to % User Time will depend on the system’s workload. A couple of common misconceptions are that there will be a balance between these two areas, and that each system will look the same. That having been said, a system performing the same workload over time should show little change in the ratio of Privileged to User time” [2]

“特权时间百分比与用户时间百分比的比例将取决于系统的工作负载。 几个常见的误解是,这两个领域之间会保持平衡,并且每个系统看起来都一样。 话虽这么说,随时间推移执行相同工作负载的系统应该显示“特权与用户时间”的比率变化很小” [2]

If the Processor: % Privilege Time value is high, kernel mode processes are using a lot of processor time, the machine is busy executing basic operating system tasks and cannot run user processes and other applications, such as SQL Server. Using a more powerful processor can help

如果“ 处理器:特权时间百分比”值很高,则内核模式进程正在使用大量处理器时间,则计算机正忙于执行基本的操作系统任务,并且无法运行用户进程和其他应用程序,例如SQL Server。 使用功能更强大的处理器可以帮助

The recommended values for Processor: %Privilege Time are 5 to 10% , or maximum 30% of the % Total Processor Time (described next)

处理器的建议值:“特权时间百分比”为5至10%或最大处理器总时间百分比的30%(如下所述)

c统计多线程总时间_SQL Server处理器性能指标–第2部分–处理器:%用户时间,处理器:%特权时间,总时间和线程指标...

总处理器时间 (Total Processor Time)

“This counter groups the activity of all the processors together to report the total performance of the entire system. On a single processor machine, this value will equal the %Processor Time value of the processor object.” [1]

该计数器将所有处理器的活动分组在一起,以报告整个系统的总体性能。 在单处理器计算机上,此值将等于处理器对象的%Processor Time值。” [1]

The Total Processor Time counter shows the percentage of time during which the machine processors are busy, i.e. the percentage of time the processors we executing useful operations. The time needed for idle thread processing is excluded

Total Processor Time计数器显示机器处理器繁忙的时间百分比,即处理器执行有用操作的时间百分比。 不包括空闲线程处理所需的时间

The difference between this counter and Processor: % Processor Time is that Total Processor Time shows a sum of processor time percentages divided by the number of processors, i.e. an average value for all processors, while the latter shows one entry for each processor on the machine

此计数器与处理器之间的区别处理器时间百分比是: 总处理器时间显示的是处理器时间百分比的总和除以处理器数量,即所有处理器的平均值,而后者显示计算机上每个处理器的一个条目

The recommended value for Total Processor Time is up to 80% during normal operation. The remaining 20% are left for complex operations that cause peaks in processor usage, to avoid bottlenecks. If the value is constantly close to 100%, this is an indication of a processor bottleneck. To start troubleshooting, check the Processor: % Processor Time value to determine what processor handles most load

在正常操作期间,“ 总处理器时间 ”的建议值最高为80%。 剩下的20%用于复杂的操作,这些操作会导致处理器使用率达到峰值,从而避免出现瓶颈。 如果该值始终接近100%,则表明处理器出现瓶颈。 要开始进行故障排除,请检查“ 处理器:处理器时间百分比”值以确定哪个处理器处理最多的负载

When one of the processors is using much more processor time then the others, the Total Processor Time value might be misleading, so it’s better to monitor both total and per processor values

当其中一个处理器使用的处理器时间比其他处理器多得多时,“ 总处理器时间”值可能会产生误导,因此最好同时监视总和每个处理器的值

c统计多线程总时间_SQL Server处理器性能指标–第2部分–处理器:%用户时间,处理器:%特权时间,总时间和线程指标...

总用户时间百分比 (% Total User Time)

“This is the total user time of all the processors on the system.” [1]

“这是系统上所有处理器的总用户时间。” [1]

The Processor: % User Time counter shows the user time on a single processor

处理器:%用户时间计数器显示单个处理器上的用户时间

总特权时间百分比 (% Total Privilege Time)

“This is the total privilege time for all processors on the system collectively”

“这是系统上所有处理器的总特权时间”

Similar as above, the Processor : %Privilege Time shows the privilege time on a single processor

与上面类似, Processor:%Privilege Time显示单个处理器上的特权时间

Monitoring these total time counters is not very useful, as for any further analysis, it’s necessary to find out the processor where the bottleneck occurs

监视这些总时间计数器不是很有用,因为要进行任何进一步的分析,必须找出出现瓶颈的处理器

线程:处理器时间百分比 (Thread: % Processor Time)

This counter is required for a deeper analysis. It shows an entity for each thread on the processor. On a single processor machine that supports two threads, two entities are shown. To distinguish the specific thread among others, use the ThreadID value. The thread processor usage can be modified by adjusting the thread priority

需要使用此计数器来进行更深入的分析。 它显示了处理器上每个线程的实体。 在支持两个线程的单处理器计算机上,显示了两个实体。 若要区分特定线程,请使用ThreadID值。 可以通过调整线程优先级来修改线程处理器的使用情况

Other metrics that can be monitored per thread are: Thread State, Priority Base, Current Priority, Context Switches/sec, % Privileged Time, and % User Time. These metrics are rarely used, as other metrics described in this and the previous part of the SQL Server performance series provide more useful information for processor performance analysis and troubleshooting

每个线程可以监视的其他度量标准包括: 线程状态,优先级基础,当前优先级,上下文切换/秒,特权时间 百分比用户时间百分比 。 这些指标很少使用,因为本部分和SQL Server性能系列的上一部分中介绍的其他指标为处理器性能分析和故障排除提供了更多有用的信息。

翻译自: https://www.sqlshack.com/sql-server-processor-performance-metrics-part-2-processor-user-time-processor-privilege-time-total-times-thread-metrics/

c统计多线程总时间