WebProcessStatistics.FormatToString(WebEventFormatter) Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Форматирует статистику процесса.
public:
virtual void FormatToString(System::Web::Management::WebEventFormatter ^ formatter);
public virtual void FormatToString (System.Web.Management.WebEventFormatter formatter);
abstract member FormatToString : System.Web.Management.WebEventFormatter -> unit
override this.FormatToString : System.Web.Management.WebEventFormatter -> unit
Public Overridable Sub FormatToString (formatter As WebEventFormatter)
Параметры
- formatter
- WebEventFormatter
Объект WebEventFormatter, содержащий сведения о табуляции и отступах, используемые для форматирования сведений о веб-событиях работоспособности.
Примеры
В следующем примере кода показано, как форматировать пользовательские сведения.
//Formats Web request event information.
public override void FormatCustomEventDetails(
WebEventFormatter formatter)
{
base.FormatCustomEventDetails(formatter);
// Add custom data.
formatter.AppendLine("");
formatter.AppendLine(
"Custom Process Statistics:");
formatter.IndentationLevel += 1;
// Get the process statistics.
formatter.AppendLine(GetAppDomainCount());
formatter.AppendLine(GetManagedHeapSize());
formatter.AppendLine(GetPeakWorkingSet());
formatter.AppendLine(GetProcessStartTime());
formatter.AppendLine(GetRequestsExecuting());
formatter.AppendLine(GetRequestsQueued());
formatter.AppendLine(GetRequestsRejected());
formatter.AppendLine(GetThreadCount());
formatter.AppendLine(GetWorkingSet());
formatter.IndentationLevel -= 1;
formatter.AppendLine(eventInfo.ToString());
}
'Formats Web request event information.
Public Overrides Sub FormatCustomEventDetails( _
ByVal formatter As WebEventFormatter)
MyBase.FormatCustomEventDetails(formatter)
' Add custom data.
formatter.AppendLine("")
formatter.AppendLine("Custom Process Statistics:")
formatter.IndentationLevel += 1
' Get the process statistics.
formatter.AppendLine(GetAppDomainCount())
formatter.AppendLine(GetManagedHeapSize())
formatter.AppendLine(GetPeakWorkingSet())
formatter.AppendLine(GetProcessStartTime())
formatter.AppendLine(GetRequestsExecuting())
formatter.AppendLine(GetRequestsQueued())
formatter.AppendLine(GetRequestsRejected())
formatter.AppendLine(GetThreadCount())
formatter.AppendLine(GetWorkingSet())
formatter.IndentationLevel -= 1
formatter.AppendLine(eventInfo.ToString())
End Sub
End Class
Комментарии
Этот FormatToString метод предоставляет универсальный формат для сведений о событиях, что полезно, если данные события должны быть записаны в журнал, а затем представлены пользователю. Он вызывается внутренне, когда поставщик вызывает один из ToString методов.