MiniProfiler
A single MiniProfiler can be used to represent any number of steps/levels in a call-graph, via Step()
Totally baller.
Assembly: ServiceStack.NetFramework.dll
View Source
[ExcludeMetadata]
[DataContract]
public class MiniProfiler : IProfiler, IDbProfiler
Properties
Id
Identifies this Profiler so it may be stored/cached.
Totally baller.
View Source
[DataMember(Order = 1, Name = "Id")]
public Guid Id { get; set; }
Name
A display name for this profiling session.
Totally baller.
View Source
[DataMember(Order = 2, Name = "Name")]
public string Name { get; set; }
Started
When this profiler was instantiated.
Totally baller.
View Source
[DataMember(Order = 3, Name = "Started")]
public DateTime Started { get; set; }
MachineName
Where this profiler was run.
Totally baller.
View Source
[DataMember(Order = 4, Name = "MachineName")]
public string MachineName { get; set; }
Level
Allows filtering of ServiceStack.MiniProfiler.Timing steps based on what ServiceStack.MiniProfiler.ProfileLevel the steps are created with.
Totally baller.
View Source
[DataMember(Order = 5, Name = "Level")]
public ProfileLevel Level { get; set; }
Root
The first ServiceStack.MiniProfiler.Timing that is created and started when this profiler is instantiated. All other ServiceStack.MiniProfiler.Timings will be children of this one.
Totally baller.
View Source
[DataMember(Order = 6, Name = "Root")]
public Timing Root { get; set; }
User
A string identifying the user/client that is profiling this request. Set MiniProfiler.Settings.UserProvider with an ServiceStack.MiniProfiler.IUserProvider-implementing class to provide a custom value.
Totally baller.
View Source
[DataMember(Order = 7, Name = "User")]
public string User { get; set; }
HasUserViewed
Returns true when this MiniProfiler has been viewed by the ServiceStack.MiniProfiler.MiniProfiler.User that recorded it.
Totally baller.
View Source
[DataMember(Order = 8, Name = "HasUserViewed")]
public bool HasUserViewed { get; set; }
DurationMilliseconds
Milliseconds, to one decimal place, that this MiniProfiler ran.
Totally baller.
View Source
[DataMember(Order = 9, Name = "DurationMilliseconds")]
public decimal DurationMilliseconds { get; }
HasTrivialTimings
Returns true when ServiceStack.MiniProfiler.MiniProfiler.Root or any of its ServiceStack.MiniProfiler.Timing.Children are ServiceStack.MiniProfiler.Timing.IsTrivial.
Totally baller.
View Source
[DataMember(Order = 10, Name = "HasTrivialTimings")]
public bool HasTrivialTimings { get; }
HasAllTrivialTimings
Returns true when all child ServiceStack.MiniProfiler.Timings are ServiceStack.MiniProfiler.Timing.IsTrivial.
Totally baller.
View Source
[DataMember(Order = 11, Name = "HasAllTrivialTimings")]
public bool HasAllTrivialTimings { get; }
TrivialDurationThresholdMilliseconds
Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms.
Totally baller.
View Source
[DataMember(Order = 12, Name = "TrivialDurationThresholdMilliseconds")]
public decimal TrivialDurationThresholdMilliseconds { get; }
Json
Json representing the collection of CustomTimings relating to this Profiler
Totally baller.
View Source
[DataMember(Order = 13, Name = "Json")]
public string Json { get; set; }
Head
Points to the currently executing Timing.
Totally baller.
View Source
public Timing Head { get; set; }
Current
Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was Started.
Totally baller.
View Source
public static MiniProfiler Current { get; }
DurationMillisecondsInSql
Milliseconds, to one decimal place, that this MiniProfiler was executing sql.
Totally baller.
View Source
[DataMember(Order = 14, Name = "DurationMillisecondsInSql")]
public decimal DurationMillisecondsInSql { get; }
HasSqlTimings
Returns true when we have profiled queries.
Totally baller.
View Source
[DataMember(Order = 15, Name = "HasSqlTimings")]
public bool HasSqlTimings { get; set; }
HasDuplicateSqlTimings
Returns true when any child Timings have duplicate queries.
Totally baller.
View Source
[DataMember(Order = 16, Name = "HasDuplicateSqlTimings")]
public bool HasDuplicateSqlTimings { get; set; }
ExecutedReaders
How many sql data readers were executed in all ServiceStack.MiniProfiler.Timing steps.
Totally baller.
View Source
[DataMember(Order = 17, Name = "ExecutedReaders")]
public int ExecutedReaders { get; }
ExecutedScalars
How many sql scalar queries were executed in all ServiceStack.MiniProfiler.Timing steps.
Totally baller.
View Source
[DataMember(Order = 18, Name = "ExecutedScalars")]
public int ExecutedScalars { get; }
ExecutedNonQueries
How many sql non-query statements were executed in all ServiceStack.MiniProfiler.Timing steps.
Totally baller.
View Source
[DataMember(Order = 19, Name = "ExecutedNonQueries")]
public int ExecutedNonQueries { get; }
IDbProfiler.IsActive
View Source
bool IDbProfiler.IsActive { get; }
Methods
ToString()
Returns the ServiceStack.MiniProfiler.MiniProfiler.Root's ServiceStack.MiniProfiler.Timing.Name and ServiceStack.MiniProfiler.MiniProfiler.DurationMilliseconds this profiler recorded.
View Source
public override string ToString()
Returns
System.String
Equals(Object)
Returns true if Ids match.
View Source
public override bool Equals(object obj)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Object | obj |
GetHashCode()
Returns hashcode of Id.
View Source
public override int GetHashCode()
Returns
System.Int32
Step(String)
View Source
public IDisposable Step(string name)
Returns
System.IDisposable
Parameters
Type | Name |
---|---|
System.String | name |
GetTimingHierarchy()
Walks the ServiceStack.MiniProfiler.Timing hierarchy contained in this profiler, starting with ServiceStack.MiniProfiler.MiniProfiler.Root, and returns each Timing found.
View Source
public IEnumerable<Timing> GetTimingHierarchy()
Returns
System.Collections.Generic.IEnumerable<ServiceStack.MiniProfiler.Timing>
Start()
View Source
public IProfiler Start()
Returns
ServiceStack.MiniProfiler.IProfiler
Stop()
View Source
public void Stop()
Start(ProfileLevel)
Starts a new MiniProfiler based on the current ServiceStack.MiniProfiler.IProfilerProvider. This new profiler can be accessed by ServiceStack.MiniProfiler.MiniProfiler.Current
View Source
public static MiniProfiler Start(ProfileLevel level)
Returns
ServiceStack.MiniProfiler.MiniProfiler
Parameters
Type | Name |
---|---|
ServiceStack.MiniProfiler.ProfileLevel | level |
Stop(Boolean)
Ends the current profiling session, if one exists.
View Source
public static void Stop(bool discardResults)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | discardResults |
When true, clears the ServiceStack.MiniProfiler.MiniProfiler.Current for this HttpContext, allowing profiling to be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled.
|
StepStatic(String, ProfileLevel)
Returns an System.IDisposable
that will time the code between its creation and disposal. Use this method when you
do not wish to include the MvcMiniProfiler namespace for the ServiceStack.MiniProfiler.MiniProfilerExtensions.Step(ServiceStack.MiniProfiler.IProfiler%2cSystem.String%2cServiceStack.MiniProfiler.ProfileLevel)
extension method.
View Source
public static IDisposable StepStatic(string name, ProfileLevel level = ProfileLevel.Info)
Returns
System.IDisposable
Parameters
Type | Name | Description |
---|---|---|
System.String | name | A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime. |
| | ServiceStack.MiniProfiler.ProfileLevel | level | This step's visibility level; allows filtering when MiniProfiler.Start is called.
|
RenderIncludes(Nullable<RenderPosition>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, Boolean, Nullable<Boolean>)
Returns the css and javascript includes needed to display the MiniProfiler results UI.
View Source
public IHtmlString RenderIncludes(RenderPosition? position = null, bool? showTrivial = null, bool? showTimeWithChildren = null, int? maxTracesToShow = null, bool xhtml = false, bool? showControls = null)
Returns
ServiceStack.IHtmlString: Script and link elements normally; an empty string when there is no active profiling session.
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<ServiceStack.MiniProfiler.RenderPosition> | position | Which side of the page the profiler popup button should be displayed on (defaults to left) |
|
| System.Nullable<System.Boolean>
| showTrivial | Whether to show trivial timings by default (defaults to false)
|
| System.Nullable<System.Boolean>
| showTimeWithChildren | Whether to show time the time with children column by default (defaults to false)
|
| System.Nullable<System.Int32>
| maxTracesToShow | The maximum number of trace popups to show before removing the oldest (defaults to 15)
|
| System.Boolean
| xhtml | xhtml rendering mode, ensure script tag is closed ... etc
|
| System.Nullable<System.Boolean>
| showControls | when true, shows buttons to minimize and clear MiniProfiler results
|
ToJson()
Renders the current ServiceStack.MiniProfiler.MiniProfiler to json.
View Source
public static string ToJson()
Returns
System.String
ToJson(MiniProfiler)
Renders the parameter ServiceStack.MiniProfiler.MiniProfiler to json.
View Source
public static string ToJson(MiniProfiler profiler)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.MiniProfiler.MiniProfiler | profiler |
FromJson(String)
Deserializes the json string parameter to a ServiceStack.MiniProfiler.MiniProfiler.
View Source
public static MiniProfiler FromJson(string json)
Returns
ServiceStack.MiniProfiler.MiniProfiler
Parameters
Type | Name |
---|---|
System.String | json |
Clone()
Create a DEEP clone of this object
View Source
public MiniProfiler Clone()
Returns
ServiceStack.MiniProfiler.MiniProfiler
GetInProgressCommands()
Returns all currently open commands on this connection
View Source
public SqlTiming[] GetInProgressCommands()
Returns
ServiceStack.MiniProfiler.SqlTiming[]
GetSqlTimings()
Returns all ServiceStack.MiniProfiler.SqlTiming results contained in all child ServiceStack.MiniProfiler.Timing steps.
View Source
public List<SqlTiming> GetSqlTimings()
Returns
System.Collections.Generic.List<ServiceStack.MiniProfiler.SqlTiming>
IDbProfiler.ExecuteStart(DbCommand, ExecuteType)
View Source
void IDbProfiler.ExecuteStart(DbCommand profiledDbCommand, ExecuteType executeType)
Parameters
Type | Name |
---|---|
System.Data.Common.DbCommand | profiledDbCommand |
ServiceStack.MiniProfiler.Data.ExecuteType | executeType |
IDbProfiler.ExecuteFinish(DbCommand, ExecuteType, DbDataReader)
View Source
void IDbProfiler.ExecuteFinish(DbCommand profiledDbCommand, ExecuteType executeType, DbDataReader reader)
Parameters
Type | Name |
---|---|
System.Data.Common.DbCommand | profiledDbCommand |
ServiceStack.MiniProfiler.Data.ExecuteType | executeType |
System.Data.Common.DbDataReader | reader |
IDbProfiler.ReaderFinish(DbDataReader)
View Source
void IDbProfiler.ReaderFinish(DbDataReader reader)
Parameters
Type | Name |
---|---|
System.Data.Common.DbDataReader | reader |
IDbProfiler.OnError(DbCommand, ExecuteType, Exception)
View Source
void IDbProfiler.OnError(DbCommand profiledDbCommand, ExecuteType executeType, Exception exception)
Parameters
Type | Name |
---|---|
System.Data.Common.DbCommand | profiledDbCommand |
ServiceStack.MiniProfiler.Data.ExecuteType | executeType |
System.Exception | exception |