4 using System.Collections.Generic;
5 using System.Globalization;
8 namespace SiliconStudio.Core.Diagnostics
35 if (profilingKey == null)
throw new ArgumentNullException(
"profilingKey");
39 ProfilingType = profilingType;
46 public int Id {
get;
private set; }
64 public TimeSpan ElapsedTime {
get; set; }
70 public Dictionary<object, object> Attributes {
get; set; }
74 var builder =
new StringBuilder(Text != null ?
string.Format(
": {0}",Text) :
string.Empty);
75 bool hasElapsed =
false;
80 if (ElapsedTime >
new TimeSpan(0, 0, 1, 0))
82 builder.AppendFormat(
"Elapsed = {0:0.000}m", ElapsedTime.TotalMinutes);
84 else if (ElapsedTime >
new TimeSpan(0, 0, 0, 0, 1000))
86 builder.AppendFormat(
"Elapsed = {0:0.000}s", ElapsedTime.TotalSeconds);
90 builder.AppendFormat(
"Elapsed = {0:0.000}ms", ElapsedTime.TotalMilliseconds);
95 if (Attributes != null && Attributes.Count > 0)
102 foreach (var keyValue
in Attributes)
104 builder.Append(
", ").Append(keyValue.Key).Append(
" = ").Append(keyValue.Value);
108 return string.Format(
"[{0}] #{1}: {2}: {3}{4}",
ProfilingMessage(int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType)
Initializes a new instance of the ProfilingMessage class.
A key to identify a specific profile.
ProfilingMessage(int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType, string text)
Initializes a new instance of the ProfilingMessage class.
ProfilingMessageType
Type of a profiling message.
A log message generate by Profiler.
LogMessageType
Type of a LogMessage.
A base log message used by the logging infrastructure.
override string ToString()
An regular info message (level 2).