Search Results

Search found 34 results on 2 pages for 'performancecounter'.

Page 1/2 | 1 2  | Next Page >

  • .NET PerformanceCounter for Hard Faults/sec

    Vista's Resource Monitor includes a reading for "Hard Faults/sec". Is there an equivalent performance counter I can use in C# to get this reading? I've tried the "Page Faults/sec" under the memory category, but that appears to be something different.

    Read the article

  • PerformanceCounter.NextValue hangs on some machines.

    - by Poma
    I don't know why, but many computers hangs on following operation: void Init() { net1 = new List<PerformanceCounter>(); net2 = new List<PerformanceCounter>(); foreach (string instance in new PerformanceCounterCategory("Network Interface").GetInstanceNames()) { net1.Add(new PerformanceCounter("Network Interface", "Bytes Received/sec", instance)); net2.Add(new PerformanceCounter("Network Interface", "Bytes Sent/sec", instance)); } } //Once in 1 second void UpdateStats() { Status.Text = ""; for (int i = 0; i < net1.Count; i++) Status.Text += string.Format("{0}/{1} Kb/sec; ", net1[i].NextValue() / 1024, net2[i].NextValue() / 1024); } On some computes program hangs completely on first call of UpdateStats(), others experiencing 100% CPU load but program works (slowly). Other counters like new PerformanceCounter("Processor", "% Processor Time", "_Total") seems to work fine. Any suggwstions why is that?

    Read the article

  • How can I use Performance Counters in C# to monitor 4 processes with the same name?

    - by Waffles
    I'm trying to create a performance counter that can monitor the performance time of applications, one of which is Google Chrome. However, I notice that the performance time I get for chrome is unnaturally low - I look under the task-manager to realize my problem that chrome has more than one process running under the exact same name, but each process has a different working set size and thus(what I would believe) different processor times. I tried doing this: // get all processes running under the same name, and make a performance counter // for each one. Process[] toImport = Process.GetProcessesByName("chrome"); instances = new PerformanceCounter[toImport.Length]; for (int i = 0; i < instances.Length; i++) { PerformanceCounter toPopulate = new PerformanceCounter ("Process", "% Processor Time", toImport[i].ProcessName, true); //Console.WriteLine(toImport[i].ProcessName + "#" + i); instances[i] = toPopulate; } But that doesn't seem to work at all - I just monitor the same process several times over. Can anyone tell me of a way to monitor separate processes with the same name?

    Read the article

  • C#: Accessing PerformanceCounters for the ".NET CLR Memory category"

    - by Mads Ravn
    I'm trying to access the performance counters located in ".NET CLR Memory category" through C# using the PerformanceCounter class. However a cannot instantiate the categories with what I would expect was the correct category/counter name new PerformanceCounter(".NET CLR Memory", "# bytes in all heaps", Process.GetCurrentProcess().ProcessName); I tried looping through categories and counters using the following code string[] categories = PerformanceCounterCategory.GetCategories().Select(c => c.CategoryName).OrderBy(s => s).ToArray(); string toInspect = string.Join(",\r\n", categories); System.Text.StringBuilder interestingToInspect = new System.Text.StringBuilder(); string[] interestingCategories = categories.Where(s => s.StartsWith(".NET") || s.Contains("Memory")).ToArray(); foreach (string interestingCategory in interestingCategories) { PerformanceCounterCategory cat = new PerformanceCounterCategory(interestingCategory); foreach (PerformanceCounter counter in cat.GetCounters()) { interestingToInspect.AppendLine(interestingCategory + ":" + counter.CounterName); } } toInspect = interestingToInspect.ToString(); But could not find anything that seems to match. Is it not possible to observe these values from within the CLR or am I doing something wrong. The environment, should it matter, is .NET 4.0 running on a 64-bit windows 7 box.

    Read the article

  • ASP.NET how to get Cache in KB used for this application ?

    - by eugeneK
    I need to know what is Cache size. I've read on this site solution for close problem but it doesn't solves mine. As i know i can get values from PerMon, here is function public static string getCacheSize() { PerformanceCounter pc = new PerformanceCounter("ASP.NET Applications", "Cache % Machine Memory Limit Used","__TOTAL__", true); return string.Format("{0:0.00}%", pc.NextValue()); } 1.it gives me percents when i need KB and there is no item closest to this one in PerfMon 2.it shows 70.5% used while all memory usage is about 50% any help ?

    Read the article

  • Naming multi-instance performance counters in .NET

    - by Roger Lipscombe
    Most multiple instance performance counters in Windows seem to automatically(?) have a #n on the end if there's more than one instance with the same name. For example: if, in Perfmon, you look under the Process category, you'll see: ... dwm explorer explorer#1 ... I have two explorer.exe processes, so the second counter has #1 appended to its name. When I attempt to do this in a .NET application: I can create the category, and register the instance (using the PerformanceCounterCategory.Create that takes a CounterCreationDataCollection). I can open the counter for write and write to it. When I open the counter a second time, it opens the same counter. This means that I have two applications fighting over the counters. The documentation for PerformanceCounter.InstanceName states that # is not allowed in the name. So: how do I have multiple-instance performance counters that are actually multiple instance? And where the second (and subsequent) instances get #n appended to the name? That is: I know that I can put the process ID (e.g.) on the instance name. This works, but has the unfortunate side effect that restarting the process results in a new PID, and Perfmon continues monitoring the old counter.

    Read the article

  • Impersonation - Access is denied

    - by krisg
    I am having trouble using impersonation to delete a PerformanceCounterCategory from an MVC website. I have a static class and when the application starts it checks whether or not a PerformanceCounterCategory exists, and if it contains the correct counters. If not, it deletes the category and creates it again with the required counters. It works fine when running under the built in webserver Cassini, but when i try run it through IIS7 (Vista) i get the following error: Access is denied Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Win32Exception: Access is denied The code used is from an MS article, from memory... var username = "user"; var password = "password"; var domain = "tempuri.org"; WindowsImpersonationContext impersonationContext; // if impersonation fails - return if (!ImpersonateValidUser(username, password, domain, out impersonationContext)) { throw new AuthenticationException("Impersonation failed"); } PerformanceCounterCategory.Delete(PerfCategory); UndoImpersonation(impersonationContext); ... private static bool ImpersonateValidUser(string username, string password, string domain, out WindowsImpersonationContext impersonationContext) { const int LOGON32_LOGON_INTERACTIVE = 2; const int LOGON32_PROVIDER_DEFAULT = 0; WindowsIdentity tempWindowsIdentity; var token = IntPtr.Zero; var tokenDuplicate = IntPtr.Zero; if (RevertToSelf()) { if (LogonUserA(username, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref token) != 0) { if (DuplicateToken(token, 2, ref tokenDuplicate) != 0) { tempWindowsIdentity = new WindowsIdentity(tokenDuplicate); impersonationContext = tempWindowsIdentity.Impersonate(); if (impersonationContext != null) { CloseHandle(token); CloseHandle(tokenDuplicate); return true; } } } } if (token != IntPtr.Zero) CloseHandle(token); if (tokenDuplicate != IntPtr.Zero) CloseHandle(tokenDuplicate); impersonationContext = null; return false; } [DllImport("advapi32.dll")] public static extern int LogonUserA(String lpszUserName, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern int DuplicateToken(IntPtr hToken, int impersonationLevel, ref IntPtr hNewToken); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool RevertToSelf(); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern bool CloseHandle(IntPtr handle); The error is thrown when processing tries to execute the PerformanceCounterCategory.Delete command. Suggestions?

    Read the article

  • [.NET Performance Counter] "System.ComponentModel.Win32Exception: Access is denied" is thrown when c

    - by Ricky
    Hi guys: Calling PerformanceCounterCategory.Create() below on my machine thorws out this exception: System.ComponentModel.Win32Exception: Access is denied Do you know what's the issue about it? Thank you! if (!PerformanceCounterCategory.Exists("MyCategory")) { CounterCreationDataCollection counters = new CounterCreationDataCollection(); CounterCreationData avgDurationBase = new CounterCreationData(); avgDurationBase.CounterName = "average time per operation base"; avgDurationBase.CounterHelp = "Average duration per operation execution base"; avgDurationBase.CounterType = PerformanceCounterType.AverageBase; counters.Add(avgDurationBase); // create new category with the counters above PerformanceCounterCategory.Create("MyCategory", "Sample category for Codeproject", PerformanceCounterCategoryType.SingleInstance, counters); }

    Read the article

  • PerformanceCounters on .NET 4.0 & Windows 7

    - by scott
    I have a program that works fine on VS2008 and Vista, but I'm trying it on Windows 7 and VS2010 / .NET Framework 4.0 and it's not working. Ultimately the problem is that System.Diagnostics.PerformanceCounterCategory.GetCategories() (and other PerformanceCounterCategory methods) is not working. I'm getting a System.InvalidOperationException with the message "Cannot load Counter Name data because an invalid index '' was read from the registry." I can reproduce this with the very simple program shown below: class Program { static void Main(string[] args) { foreach (var pc in System.Diagnostics.PerformanceCounterCategory.GetCategories()) { Console.WriteLine(pc.CategoryName); } } } I did make sure I'm running the program as an admin. It doesn't matter if I run it with VS/Debugger attached or not. I don't have another machine with Windows 7 or VS2010 to test it on, so I'm not sure which is complicating things here (or both?). It is Windows 7 x64 and I've tried forcing the app to run in both x32 and x64 but get the same results.

    Read the article

  • C# WMI, Performance Counters, & SNMP Oh My!

    - by Keith
    I have a C# windows service which listens to a MSMQ and sends each message out as an email. Since there's no UI, I'd like to offer an ability to monitor this service to see things such as # messages in queue, # emails sent (by message type perhaps), # of errors, etc. What is the best/recommended way to accomplish this? Is it WMI or performance counters? Is this data viewed using PerfMon or WMI CIM Studio? Does any approach allow one to monitor the service real-time as well as providing historical analysis? I can dig into the details myself but would appreciate some broad guidance to help demystify this subject.

    Read the article

  • performance counter

    - by Abruzzo Forte e Gentile
    Hi All I created a performance counter for my C# application. Its type is NumberOfItems32. I don't know why but the Performance Monitor is displaying me on the y-axis only as maximum value only 100 when my counter is much more bigger than this for sure. Do you know if this is the correct behavior or am I doing something wrong? Thanks all AFG

    Read the article

  • CPU consumption of my process

    - by Abruzzo Forte e Gentile
    Hi all I would like to use Performance Monitor to check the CPU consumption of my process. Right now I am working on a MultiCore machine. If I have a look at my process in TASK MANAGER I see that my process consumes 20% of CPU. If I start performance monitor, I select Process--% Processor Time I see values peaking up and over 100%. Do you know why and how to get the real measure? I also looked at the CPU consumption for all of my 4 cores, but I don't know exactly how to attribute consumption to my process. If you can suggest a link or url about how to read CPU usage I would really appreciate! Thanks a lot! AFG

    Read the article

  • Adding custom perfomance counters in ASP.Net for service calls

    - by Nithin
    Hi All, I have to show the time taken for a service call in Perfmon from my ASP.Net application. For this, I have added a stopwatch which starts at the service call start and stops at service call stop. Now I have a custom counter which user AverageTimer32 to log the stopwatch values to Perfmon. My question is, how can I show the service names on the Perfmon graph. I am using windows XP (I know windows server perfmon has some fancy stuff).

    Read the article

  • Perfmon on Vista to monitor .Net CLR memory for dutch dummies

    - by Dabblernl
    OK... My managed .Net program is eating memory leading it to crash after a few hours with a OutOfMemoryException. I want to investigate this starting with using perfmon.exe. I found a description on how to do this here However, I have a dutch Vista and the terms used differ widely from the ones used in this blog and I find myself simply unable to set it up. Can someone point me the way by stating "first from the top,second from the left" how to set up a performance monitor for my .Net program?

    Read the article

  • C# - Getting a RawFraction Performance Counter to show a persistant value

    - by jacko
    I've created a performance counter that shows a fraction of an incremeted value (RawFraction type) over a base value (RawBase). Unfortunately, when monitoring this value, it only shows the percentage when one of the counters is incremented. At all other times it it is sampled, it shows 0. Is there some way to tell the counter to hold onto the last value until the next time it needs to recalculate the fraction?

    Read the article

  • DateTime.Now.Millisecond always return 0 on compact framework

    - by Sachin
    I need some way to find the elapsed time or time taken in milliseconds for a function to execute in compact framework. For the same I tried DateTime.Now.Millisecond. But DateTime.Now.Millisecond always return 0. Also I tried with Now.Tick. But it also returns the value in multiplication of 1,00,00,000 which means it always returns seconds part ignoring the milliseconds. My question is how to determine the time elapsed in millisecond on compact framework.

    Read the article

  • How can I get page faults statistics from kernel

    - by osgx
    Hello How can I get page faults statistics from kernel for my application while it is running? What about other events, like inter-cpu migrations count in SMP nodes, or number of context switches? I want to count such events for various small parts of the program. Thanks.

    Read the article

  • Performance Counters in Server Development

    - by Mubashar Ahmad
    Dear Gurus All you be agree with the value and worth of Performance Counters while developing and maintaining a server kind application I would like to know what is the best way to implement those, Specifically using C#? Usually performance counters have the following attributes They are shared global Writing requires locks to ensure Synchronization Reading Some times requires locks too. Is it better to update them Asynchronously and what is the best way to make them so. (I am planning to use the ThreadPool.QueuWorketItem function, pls tell me you opinion on this too.) If my question seems a bit vague can you just take the example of a HelloWorld Wcf service and i wanted to know following how many times its being hit overall and within a certain period Average/min/max Response Times overall and within a certain period. Moreover if any one knows about the Specialized way provided by DotNet or WCF then please let me know as well.

    Read the article

  • ASP.NET retrieve Average CPU Usage

    - by Sam
    Last night I did a load test on a site. I found that one of my shared caches is a bottleneck. I'm using a ReaderWriterLockSlim to control the updates of the data. Unfortunately at one point there are ~200 requests trying to update the data at approximately the same time. This also coincided with CPU usage spikes. The data being updated is in the ASP.NET Cache. What I'd like to do is if the CPU usage is around 75%, I'd like to just skip the cache and hit the database on another machine. My problem is that I don't know how expensive it is to create a new performance counter to check the cpu usage. Also, if I would probably like the average cpu usage over the last 2 or 3 seconds. However, I can't sit there and calculate the cpu time as that would take longer than it's taking to update the cache currently. Is there an easy way to get the average CPU usage? Are there any drawbacks to this? I'm also considering totaling the wait count for the lock and then at a certain threshold switch over to the database. The concern I had with this approach would be that changing hardware might allow more locks with less of a strain on the system. And also finding the right balance for the threshold would be cumbersome and it doesn't take into account any other load on the machine. But it's a simple approach, and simple is 99% of the time better.

    Read the article

  • Monitor file disk activity programmatically (Windows)

    - by iulianchira
    In Windows 2008R2, in Resource Monitor in the Disk Acitivity section I can see the number of bytes read from/written into files. How can I do this in a programatic manner, prefferably using C# (or Win32 API)? I have looked into WMI and various performance counters, however I cannot figure out if there is something which suits my needs.

    Read the article

  • COMET chat application - IIS7 slows down over time

    - by Yaron
    I have built a chat application which uses this code to push messages to clients (web pages) and to monitor online users and their information. Basically, the code creates and manages a custom thread pool for maintaining the list of connected users & their state. The application was hosted on a shared hosting account (IIS6), and worked fine. After moving the site (ASP.Net App) to a dedicated virtual server it seems I have a problem where IIS7 gets slower and slower as time passes, and my only "solution" is to restart IIS. I am trying to look at the performance counters and have do idea on which one to look.

    Read the article

  • Performance Overhead of Perf Event Subsystem in Linux Kernel

    - by Bo Xiao
    Performance counters for Linux are a new kernel-based subsystem that provide a framework for all things performance analysis. It covers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters, tracepoints) as well. Since 2.6.33, the kernel provide 'perf_event_create_kernel_counter' kernel api for developers to create kernel counter to collect system runtime information. What I concern most is the performance impact on overall system when tracepoint/ftrace is enabled. There are no docs I can find about them. I was once told that ftrace was implemented by dynamically patching code, will it slow the system dramatically?

    Read the article

1 2  | Next Page >