관리자는 대량의 데이터에 대해 복잡한 변환을 수행하는 Integration Services 패키지의 성능을 모니터링해야 할 수 있습니다. Microsoft .NET Framework의 System.Diagnostics 네임스페이스는 기존 성능 카운터를 사용하고 고유한 성능 카운터를 만들기 위한 클래스를 제공합니다.
성능 카운터는 시간 경과에 따른 소프트웨어 성능을 분석하는 데 사용할 수 있는 애플리케이션 성능 정보를 저장합니다. 성능 모니터 도구를 사용하여 로컬 또는 원격으로 성능 카운터를 모니터링할 수 있습니다. 나중에 패키지의 제어 흐름 분기를 위해 성능 카운터 값을 변수에 저장할 수 있습니다.
성능 카운터를 사용하는 대신 FireProgress 개체의 Events 속성을 통해 Dts 이벤트를 발생시킬 수도 있습니다. 이 FireProgress 이벤트는 Integration Services 런타임에 증분 진행률 및 완료율 정보를 모두 반환합니다.
참고 항목
여러 패키지에서 더 쉽게 다시 사용할 수 있는 작업을 만들려면 이 스크립트 태스크 샘플의 코드를 사용자 지정 작업의 시작점으로 사용하는 것이 좋습니다. 자세한 내용은 사용자 지정 작업 개발을 참조하세요.
설명
다음 예제에서는 사용자 지정 성능 카운터를 만들고 카운터를 증분합니다. 먼저 성능 카운터가 이미 있는지 여부를 확인합니다. 성능 카운터를 만들지 않은 경우 스크립트는 개체의 메서드를 Create 호출 PerformanceCounterCategory 하여 만듭니다. 성능 카운터를 만든 후에는 스크립트에서 해당 카운터를 증가시킵니다. 마지막으로, 성능 카운터가 더 이상 필요하지 않은 경우 성능 카운터에서 Close 메서드를 호출하는 최상의 방법을 따릅니다.
참고 항목
새 성능 카운터 범주 및 성능 카운터를 만들려면 관리 권한이 필요합니다. 또한 새 범주 및 카운터는 만든 후 컴퓨터에 유지됩니다.
이 스크립트 태스크 예제를 구성하려면
- 코드의
Imports문을 사용하여 System.Diagnostics 네임스페이 스를 가져옵니다.
코드 예
Public Sub Main()
Dim myCounter As PerformanceCounter
Try
'Create the performance counter if it does not already exist.
If Not _
PerformanceCounterCategory.Exists("TaskExample") Then
PerformanceCounterCategory.Create("TaskExample", _
"Task Performance Counter Example", "Iterations", _
"Number of times this task has been called.")
End If
'Initialize the performance counter.
myCounter = New PerformanceCounter("TaskExample", _
"Iterations", String.Empty, False)
'Increment the performance counter.
myCounter.Increment()
myCounter.Close()
Dts.TaskResult = ScriptResults.Success
Catch ex As Exception
Dts.Events.FireError(0, _
"Task Performance Counter Example", _
ex.Message & ControlChars.CrLf & ex.StackTrace, _
String.Empty, 0)
Dts.TaskResult = ScriptResults.Failure
End Try
End Sub
public class ScriptMain
{
public void Main()
{
PerformanceCounter myCounter;
try
{
//Create the performance counter if it does not already exist.
if (!PerformanceCounterCategory.Exists("TaskExample"))
{
PerformanceCounterCategory.Create("TaskExample", "Task Performance Counter Example", "Iterations", "Number of times this task has been called.");
}
//Initialize the performance counter.
myCounter = new PerformanceCounter("TaskExample", "Iterations", String.Empty, false);
//Increment the performance counter.
myCounter.Increment();
myCounter.Close();
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception ex)
{
Dts.Events.FireError(0, "Task Performance Counter Example", ex.Message + "\r" + ex.StackTrace, String.Empty, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
Integration Services를 사용하여 최신 상태 유지
Microsoft의 최신 다운로드, 문서, 샘플 및 비디오와 커뮤니티에서 선택한 솔루션은 MSDN의 Integration Services 페이지를 방문하세요.
MSDN의 Integration Services 페이지 방문
이러한 업데이트에 대한 자동 알림을 보려면 페이지에서 사용할 수 있는 RSS 피드를 구독합니다.