Profiling and Benchmarking

Something I’ve done a lot of over the past few years is performance tuning of time critical code, mainly for high performance client/server messaging libraries.

I want to ask did Microsoft address performance and profiling in their .Net MF standard?

I suppose once could profile (where possible) some class libraries on a desktop PC and assume that adjustments that speed up code on a PC will similarly speed up code running on a Gadget Processor.

I searched the forum here for ‘profiling’ and saw a few posts that seemed to focus on timing measurements.

Not sure what people do here but I have used settled upon the Stopwatch.ElapsedTicks (instance property) or Stopwatch.GetTimestamp() (Static method) as the basis of all high precision time measurements.

But this only works if there is a hardware based high precision timer (See Stopwatch.IsHighResolution for more), so does these Gadgeteer boards provide a HPET?

Using this on desktop/server code allows me to measure TCP/IP message transit times with microsecond level precision it would be great to be able to do similar on these boards.

Is there any actual profiling support/tools for doing this on Gadgeteer devices?

Any info much appreciated.


I know that there is a profile flavor of CLR that you can compile (never done this myself) I’ve seen this in the source code inside porting kit. I assume this special build will help to profile performance critical sections of the CLR.

Hardware timers are different from board to board. I would refer to the specific MCU datasheet for timer precision specifics. I think it should be possible to implement something using Register class or RLP/RLPLight.

Thanks for this, I’ll look into what you mentioned. I wonder what the max frequency is that one can get an onboard timer to run at and if .Net MF offers additional time related classes/structs over those available in conventional .Net…