/// <summary> /// Initializes a new instance of the <see cref="ProfilingEvent" /> struct. /// </summary> /// <param name="profileId">The profile identifier.</param> /// <param name="profilingKey">The profiling key.</param> /// <param name="profilingType">Type of the profiling.</param> /// <param name="timeStamp"></param> /// <param name="elapsedTime">The elapsed time.</param> /// <param name="text">The text.</param> /// <param name="attributes">The attributes.</param> /// <param name="value0"></param> /// <param name="value1"></param> /// <param name="value2"></param> /// <param name="value3"></param> public ProfilingEvent( int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType, long timeStamp, long elapsedTime, string text, Dictionary<object, object> attributes, ProfilingCustomValue? value0 = null, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null) { Id = profileId; Key = profilingKey; Type = profilingType; TimeStamp = timeStamp; ElapsedTime = elapsedTime; Text = text; Attributes = attributes; Custom0 = value0; Custom1 = value1; Custom2 = value2; Custom3 = value3; }
private void EmitEvent(ProfilingMessageType profilingType, string text, long timeStamp) { // Perform a Mark event only if the profiling is running if (!isEnabled) { return; } // In the case of begin/end, reuse the text from the `begin`event // if the text is null for `end` event. if (text == null && profilingType != ProfilingMessageType.Mark) { text = beginText; } if (profilingType == ProfilingMessageType.Begin) { startTime = timeStamp; beginText = text; } else if (profilingType == ProfilingMessageType.End) { beginText = null; isEnabled = false; } // Create profiler event // TODO ideally we should make a copy of the attributes var profilerEvent = new ProfilingEvent(ProfilingId, ProfilingKey, profilingType, timeStamp, timeStamp - startTime, text, attributes); // Send profiler event to Profiler Profiler.ProcessEvent(ref profilerEvent, eventType); }
private void EmitEvent(ProfilingMessageType profilingType, string textFormat, params object[] textFormatArguments) { // Perform a Mark event only if the profiling is running if (!isEnabled) { return; } var timeStamp = Stopwatch.GetTimestamp(); // In the case of begin/end, reuse the text from the `begin`event // if the text is null for `end` event. var text = textFormat != null?string.Format(textFormat, textFormatArguments) : profilingType == ProfilingMessageType.Mark ? null : beginText; if (profilingType == ProfilingMessageType.Begin) { startTime = timeStamp; beginText = text; } else if (profilingType == ProfilingMessageType.End) { beginText = null; } // Create profiler event // TODO ideally we should make a copy of the attributes var profilerEvent = new ProfilingEvent(ProfilingId, ProfilingKey, profilingType, timeStamp, timeStamp - startTime, text, attributes); // Send profiler event to Profiler Profiler.ProcessEvent(ref profilerEvent, eventType); }
private void EmitEvent(ProfilingMessageType profilingType, string text, ProfilingCustomValue?value0, ProfilingCustomValue?value1, ProfilingCustomValue?value2, ProfilingCustomValue?value3) { // Perform a Mark event only if the profiling is running if (!isEnabled) { return; } var timeStamp = Stopwatch.GetTimestamp(); if (profilingType == ProfilingMessageType.Begin) { startTime = timeStamp; } //this actually stores the LAST text into beginText so to be able to add it at the end if (profilingType != ProfilingMessageType.End && text != null) { beginText = text; } // Create profiler event var profilerEvent = new ProfilingEvent(ProfilingId, ProfilingKey, profilingType, timeStamp, timeStamp - startTime, beginText ?? text, attributes, value0, value1, value2, value3); if (profilingType == ProfilingMessageType.End) { beginText = null; } // Send profiler event to Profiler Profiler.ProcessEvent(ref profilerEvent, eventType); }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingEvent" /> struct. /// </summary> /// <param name="profileId">The profile identifier.</param> /// <param name="profilingKey">The profiling key.</param> /// <param name="profilingType">Type of the profiling.</param> /// <param name="timeStamp"></param> /// <param name="elapsedTime">The elapsed time.</param> /// <param name="text">The text.</param> /// <param name="attributes">The attributes.</param> /// <param name="value0"></param> /// <param name="value1"></param> /// <param name="value2"></param> /// <param name="value3"></param> public ProfilingEvent( int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType, long timeStamp, long elapsedTime, string text, Dictionary <object, object> attributes, ProfilingCustomValue?value0 = null, ProfilingCustomValue?value1 = null, ProfilingCustomValue?value2 = null, ProfilingCustomValue?value3 = null) { Id = profileId; Key = profilingKey; Type = profilingType; TimeStamp = timeStamp; ElapsedTime = elapsedTime; Text = text; Attributes = attributes; Custom0 = value0; Custom1 = value1; Custom2 = value2; Custom3 = value3; }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingMessage" /> class. /// </summary> /// <param name="profileId">The profile unique identifier.</param> /// <param name="profilingKey">The profile key.</param> /// <param name="profilingType">Type of the profile.</param> /// <param name="text">The text.</param> public ProfilingMessage(int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType, string text) : base("Profiler", LogMessageType.Info, text) { if (profilingKey == null) throw new ArgumentNullException("profilingKey"); Id = profileId; Key = profilingKey; ProfilingType = profilingType; }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingEvent" /> struct. /// </summary> /// <param name="profileId">The profile identifier.</param> /// <param name="profilingKey">The profiling key.</param> /// <param name="profilingType">Type of the profiling.</param> /// <param name="elapsedTime">The elapsed time.</param> /// <param name="text">The text.</param> /// <param name="attributes">The attributes.</param> public ProfilingEvent(int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType, long timeStamp, long elapsedTime, string text, Dictionary <object, object> attributes) { Id = profileId; Key = profilingKey; Type = profilingType; TimeStamp = timeStamp; ElapsedTime = elapsedTime; Text = text; Attributes = attributes; }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingMessage" /> class. /// </summary> /// <param name="profileId">The profile unique identifier.</param> /// <param name="profilingKey">The profile key.</param> /// <param name="profilingType">Type of the profile.</param> /// <param name="text">The text.</param> public ProfilingMessage(int profileId, [NotNull] ProfilingKey profilingKey, ProfilingMessageType profilingType, string text) : base("Profiler", LogMessageType.Info, text) { if (profilingKey == null) { throw new ArgumentNullException(nameof(profilingKey)); } Id = profileId; Key = profilingKey; ProfilingType = profilingType; }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingMessage" /> class. /// </summary> /// <param name="profileId">The profile unique identifier.</param> /// <param name="profilingKey">The profile key.</param> /// <param name="profilingType">Type of the profile.</param> public ProfilingMessage(int profileId, [NotNull] ProfilingKey profilingKey, ProfilingMessageType profilingType) : this(profileId, profilingKey, profilingType, null) { }
private void EmitEvent(ProfilingMessageType profilingType, string text, ProfilingCustomValue? value0, ProfilingCustomValue? value1, ProfilingCustomValue? value2, ProfilingCustomValue? value3) { // Perform a Mark event only if the profiling is running if (!isEnabled) return; var timeStamp = Stopwatch.GetTimestamp(); if (profilingType == ProfilingMessageType.Begin) { startTime = timeStamp; } //this actually stores the LAST text into beginText so to be able to add it at the end if(profilingType != ProfilingMessageType.End && text != null) { beginText = text; } // Create profiler event var profilerEvent = new ProfilingEvent(profilingId, profilingKey, profilingType, timeStamp, timeStamp - startTime, beginText ?? text, attributes, value0, value1, value2, value3); if (profilingType == ProfilingMessageType.End) { beginText = null; } // Send profiler event to Profiler Profiler.ProcessEvent(ref profilerEvent); }
private void EmitEvent(ProfilingMessageType profilingType, string textFormat, params object[] textFormatArguments) { // Perform a Mark event only if the profiling is running if (!isEnabled) return; var timeStamp = Stopwatch.GetTimestamp(); // In the case of begin/end, reuse the text from the `begin`event // if the text is null for `end` event. var text = textFormat != null ? string.Format(textFormat, textFormatArguments) : profilingType == ProfilingMessageType.Mark ? null : beginText; if (profilingType == ProfilingMessageType.Begin) { startTime = timeStamp; beginText = text; } else if (profilingType == ProfilingMessageType.End) { beginText = null; } // Create profiler event // TODO ideally we should make a copy of the attributes var profilerEvent = new ProfilingEvent(profilingId, profilingKey, profilingType, timeStamp, timeStamp - startTime, text, attributes); // Send profiler event to Profiler Profiler.ProcessEvent(ref profilerEvent); }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingMessage" /> class. /// </summary> /// <param name="profileId">The profile unique identifier.</param> /// <param name="profilingKey">The profile key.</param> /// <param name="profilingType">Type of the profile.</param> public ProfilingMessage(int profileId, ProfilingKey profilingKey, ProfilingMessageType profilingType) : this(profileId, profilingKey, profilingType, null) { }