views:

14

answers:

1

Hi, I want to measure the resource consumption of my silverlight application at runtime. I do NOT want to use an external profiler, since I want to evaluate the overall application performance (esp. regarding CPU consumption), to show/hide functionality depending on the current performance status of the application.

Is there a way to measure that?

Thx, Juve

A: 

The Silverlight sandboxing model should not allow you to access things out of the box. I don't Silverlight enough to tell if CPU-utilization is an exception to that rule, but if you can not find anything on Google that is probably the case.

You best bet is to time the execution of some of your important methods, or calculate framerate or similar and use that as an indirect measurement of available performance.
This is probably easier to define relevant measures that way anyway. Like if framerate < 20 => remove stuff, if framerate > 30 => add stuff.

There is no Stopwatch in Silverlight, but you can find implementations on Google.

Albin Sunnanbo