IntelliTrace 쓰기 작업 중지

Microsoft.SystemCenter.IntelliTraceProfiling.StopIntelliTrace.WriteAction (WriteActionModuleType)

IIS 응용 프로그램 풀에 대한 IntelliTrace 프로파일링을 중지합니다.

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData

Member Modules:

ID Module Type TypeId RunAs 
PA ProbeAction Microsoft.SystemCenter.IntelliTraceProfiling.GetApplicationPool.ProbeActionType Default
WA2 WriteAction Microsoft.Windows.PowerShellWriteAction Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IISApplicationPathstring$Config/IISApplicationPath$IIS 응용 프로그램 경로IIS 응용 프로그램 경로
TimeoutSecondsint$Config/TimeoutSeconds$시간 제한(초)시간 제한(초)

Source Code:

<WriteActionModuleType ID="Microsoft.SystemCenter.IntelliTraceProfiling.StopIntelliTrace.WriteAction" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IISApplicationPath" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:unsignedInt"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IISApplicationPath" Selector="$Config/IISApplicationPath$" ParameterType="string"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PA" TypeID="Microsoft.SystemCenter.IntelliTraceProfiling.GetApplicationPool.ProbeActionType">
<IISApplicationPath>$Config/IISApplicationPath$</IISApplicationPath>
</ProbeAction>
<WriteAction ID="WA2" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>StopIntelliTrace.ps1</ScriptName>
<ScriptBody><Script>

param($intelliTraceInstallPath, $applicationPoolName)

$ErrorActionPreference = "Stop"

Import-Module "$($intelliTraceInstallPath)\Microsoft.VisualStudio.IntelliTrace.PowerShell.dll"

$traceStatus = Get-IntelliTraceCollectionStatus | Where-Object {$_.OutputPath -ne $null -and $_.CollectionPlanPath -ne $null -and $_.ApplicationPool -eq $applicationPoolName} | Select-Object -First 1

try
{
$lock = [System.IO.File]::Open( [System.IO.Path]::Combine($traceDirectory, ".lock") , [System.IO.FileMode]::OpenOrCreate, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None)
}
catch [System.IO.IOException]
{
throw "IntelliTrace cannot stop right now. The collect snapshot operation is currently running for the selected application pool. Wait for collection to complete, and then try to stop IntelliTrace again."
exit 1
}

try
{
Stop-IntelliTraceCollection $applicationPoolName -Confirm:$false
Start-Sleep -Seconds 5
}
finally
{
if($traceStatus -ne $null)
{
try
{
$traceDirectory = [System.IO.Path]::GetDirectoryName($traceStatus.OutputPath)
Remove-Item $traceDirectory -Force -Recurse
}
catch {}
}

$lock.Close()
}

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>IntelliTraceInstallPath</Name>
<Value>$Data/Property[@Name='IntelliTraceInstallPath']$</Value>
</Parameter>
<Parameter>
<Name>ApplicationPoolName</Name>
<Value>$Data/Property[@Name='ApplicationPoolName']$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="WA2">
<Node ID="PA"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>