performancecounter

Getting peak private bytes value for process in windows

荒凉一梦 提交于 2019-12-06 06:16:28
ProcessExplorer somehow obtain this value and show it on Performance tab for each process... How to get it using Win32 API? Solution: In `Peak Private Bytes' field, Process Explorer actually shows "Process\...\Page File Bytes Peak" performance counter. This value could be easily retrieved with PSAPI function GetProcessMemoryInfo. GetProcessMemoryInfo gets you this: PrivateUsage The current amount of memory that cannot be shared with other processes, in bytes. Private bytes include memory that is committed and marked MEM_PRIVATE, data that is not mapped, and executable pages that have been

Issue with perfmon counter value using WMI query

你离开我真会死。 提交于 2019-12-06 05:34:41
I am building EXE and through which i am fetching perfmon counter of application to monitor that using WMI query. I am testing it with my local machine and seems like my code logic gives me incorrect values for some of counters. Below is my code for one of the counter ( CacheTotalHitRatio ) And when i have looked it with perfmon exe in my system then it shows me something different as shown below. I think CacheTotalHitRatio is in percentage and should not be go beyond 100 but my code gives some higher value. What is problem here OR am i doing something wrong here? Please let me know if anyone

cpu usage of a thread

北城以北 提交于 2019-12-06 04:39:16
how to get the cpu usage of a thread in .net in c# Nick Martyshchenko Check How to get the cpu usage per thread on windows (win32) and GetThreadTimes you can use PInvoke for that. Another similar post on SO: How can I get CPU usage and/or RAM usage of a THREAD in C# (managed code)? So this is duplicate. 来源: https://stackoverflow.com/questions/3958571/cpu-usage-of-a-thread

Performance Counter Instance Name vs. Process Name

坚强是说给别人听的谎言 提交于 2019-12-06 04:04:32
问题 I am connecting to various performance counters in the Process category. I am using the following c# method to determine the instance name to use when acquiring the counters: private const string _categoryName = "Process"; private const string _processIdCounter = "ID Process"; public static bool TryGetInstanceName(Process process, out string instanceName) { PerformanceCounterCategory processCategory = new PerformanceCounterCategory(_categoryName); string[] instanceNames = processCategory

Using PerformanceCounters to target specific drives

眉间皱痕 提交于 2019-12-06 03:31:21
问题 Guys, I have the following code: using System.Diagnostics; private PerformanceCounter diskRead = new PerformanceCounter(); private PerformanceCounter diskWrite = new PerformanceCounter(); diskRead.CategoryName = "PhysicalDisk"; diskRead.CounterName = "Disk Reads/sec"; diskRead.InstanceName = "_Total"; diskWrite.CategoryName = "PhysicalDisk"; diskWrite.CounterName = "Disk Writes/sec"; diskWrite.InstanceName = "_Total"; This code keeps track of Disk Reads per second and Disk Writes per second

Correct use of “% Time in GC” performance counter

和自甴很熟 提交于 2019-12-05 15:39:03
I am trying to get the "% Time in GC" performance counter in ".NET CLR Memory" category programmatically. According to the description in PerfMon, % Time in GC is the percentage of elapsed time that was spent in performing a garbage collection (GC) since the last GC cycle. This counter is usually an indicator of the work done by the Garbage Collector on behalf of the application to collect and compact memory. This counter is updated only at the end of every GC and the counter value reflects the last observed value; its not an average. So based on that description, my understanding is that I

C# PerformanceCounter list of possible Parameters?

浪子不回头ぞ 提交于 2019-12-05 13:52:57
I am using the System.Data PerfomanceCounter class, and I have found some very specific examples of how to retrieve disk space or CPU usage. However I am unable to find the documentation on the possible values for: PerfomanceCounter.CategoryName PerformanceCounter.CounterName PerformanceCounter.InstanceName I can see from the class the different parameters I can pass to the constructor, but even going to the page for say CategoryName does not give me a list of available values. Can anyone offer and advice on how to find available values for these? Thanks! Those can be obtained from the

How can I add a performance counter to a category i have already created

早过忘川 提交于 2019-12-05 09:08:37
问题 I have created a PerformanceCounterCategory like below var category = PerformanceCounterCategory.Create("MyCat", "Cat Help", PerformanceCounterCategoryType.SingleInstance, "MyCounter", "Counter Help); How can I add a new counter to the category to monitor another item? I cannot find the api for it. 回答1: I did a research on this a while back and it doesn't seem to be possible to add counters to an existing category, what you would have to do it to recreate the same category with addition of

Determining a computer's maximum hard drive data transfer rate programmatically with C#

久未见 提交于 2019-12-05 07:24:01
I have written a small WPF widget using C# that displays the current CPU activity, RAM used and disk activity as three small percentage type bars. I have used the following PerformanceCounters for this: (diskCounter PerformanceCounter returns current total disk activity in bytes per second) private void InitialisePerformanceCounters() { cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total", true); totalRam = (int)(new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory / 1024 / 1024); ramCounter = new PerformanceCounter("Memory", "Available MBytes");

.net performance counter - Process(w3wp)\\% Processor Time

心不动则不痛 提交于 2019-12-05 06:19:31
During performance testing, I found that the values of Process(w3wp)\% Processor Time are greater than 100. Some values are 237.1436486 312.5338052 341.2373994 264.4097661 191.6237736 I thought this value represents the CPU usage by w3wp process. I don't understand why the value is greater than 100%. If you have multiple cores it can go over 100, it's the sum of the processor usage for each processor (core, or virtual core) so over 100 is normal ( 100*numberOfCores is the nax). Use the Process(w3wp_Total) version of the counter if you want the overall CPU %, this caps out at 100. As Nick