1

I need to build a widget which would show (and monitor) CPU usage by a Silverlight instance (the control will be part of the silverlight application and would track the running instance). I could not find Process/PerformanceMonitor class in Silverlight.

Is there any existing API or some way to do this?

Edit 1) Same question being answered for non-Silverlight: How to get the CPU Usage in C#?

Thanks for your interest.

Community
  • 1
  • 1
Manish Basantani
  • 16,931
  • 22
  • 71
  • 103

1 Answers1

1

You should be about to use System.Windows.Analytics.AverageProcessorLoad to get the CPU load.

http://msdn.microsoft.com/en-us/library/system.windows.analytics.averageprocessorload%28VS.95%29.aspx

Not sure if OOB or Elevated Trust is required for this to work.

Ryan Alford
  • 7,514
  • 6
  • 42
  • 56
  • OOB? Elevated Trust? But yes, it required to be called on UI thread. Thanks, it provides me some usage percent. Is there any way to get memory usage of the process also?? – Manish Basantani Oct 02 '11 at 06:48
  • Yes, the `AverageProcessLoad` should give you that information. http://msdn.microsoft.com/en-us/library/system.windows.analytics.averageprocessload(VS.95).aspx – Ryan Alford Oct 03 '11 at 12:34