Share via


TimingLogger Class

Definition

A class which uses the native Xamarin.Android runtime to accurately measure (to the nanosecond level) time spent executing a portion of code bracketed with calls to Start(String) (or the constructor, by default) and Stop(String). Timing messages are logged with the Info priority and the monodroid-timing tag in the device's logcat buffer.

public class TimingLogger : IDisposable
type TimingLogger = class
    interface IDisposable
Inheritance
TimingLogger
Implements

Constructors

TimingLogger(String, Boolean)

Construct a TimeLogger instance and start measuring time immediately, if the startImmediately parameter is left out or set to true. If the startMessage is not null then the message is logged at the start.

Methods

Dispose()

Dispose of the current instance. Dispose() for more information.

Dispose(Boolean)

Dispose of the current instance, stopping timing if necessary. Note that if timing is stopped here, the log will contain the default message (Stop(String))

Finalize()
Start(String)

Start measuring time. If startMessage is provided (or if the constructor was passed a message to use when starting) it will be output to the log, otherwise the measurement start is silent. The method does anything only if no measurement is active.

Stop(String)

Stop measuring time and log message specified in the stopMessage parameter. If message is not specified, the Xamarin.Android runtime will use the default message, "Managed Timing". Time is reported in the following format:

stopMessage; elapsed: %lis:%lu::%lu

The elapsed fields are defined as follows: seconds:milliseconds::nanoseconds

Applies to