> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 프로파일러 연결

> dotnet trace 또는 PIX와 같은 프로파일러를 PlayFab Multiplayer Servers 빌드에 연결하여 그래픽 및 성능을 디버깅하고 결과 출력 로그를 가져옵니다.

이 문서에서는 프로파일러 연결 방법과 출력 파일을 가져오는 방법을 설명합니다. 프로파일러는 게임 서버의 그래픽 및 성능 관련 문제를 디버깅하는 데 사용됩니다. dotnet trace 또는 PIX와 같은 도구를 사용하려면 먼저 원하는 프로파일러를 업로드해야 합니다. 그런 다음 이를 빌드에 연결하면 출력 파일이 로그 폴더에 저장됩니다.

프로덕션 빌드에는 프로파일러를 연결하지 않는 것이 좋습니다. 성능에 영향을 줄 수 있기 때문입니다.
프로파일러 연결 설정은 빌드 생성 시에 수행해야 합니다. 현재 Game Manager를 통한 프로파일러 연결은 지원되지 않으므로 API를 사용하여 빌드를 생성해야 합니다. 자세한 내용은 [연습: PowerShell/API를 사용한 빌드 배포](/services/playfab/multiplayer/servers/deploy-using-powershell-api)를 참조하세요.

빌드를 생성할 때 모니터링 구성 아래에 자산 참조 필드가 있습니다. 모니터링 구성에 자산 참조를 포함하세요. Game Manager에 자산이 업로드되어 있는지 확인하세요. 자세한 내용은 [빌드 개요의 자산 관리](/services/playfab/multiplayer/servers/build-overview)를 참조하세요.

Linux 서버의 경우, 아래는 프로파일러 실행 스크립트의 예제입니다.

```Bash Script theme={null}
sighdl()
{
    #This is the folder the monitoring output should be written to.
    monitoring_folder_path = "${PF_MONITORING_LOG_FOLDER}"

    #Code to end monitoring and copy the output 

    exit 0
}

#set up the trap function to catch the signals and exit gracefully
trap sighdl SIGKILL SIGINT SIGTERM
sleep 3600
```

Windows 서버의 경우, 아래는 프로파일러 실행 스크립트의 예제입니다.

```PowerShell theme={null}
#Sample function that checks for the sentinel file's existence in order to end.
function Check_Sentinel_File()
{
    $fullPath = $Env:PF_SENTINEL_FILE
    while(!(Test-Path $fullPath)) { Start-Sleep 10}

    #PF_MONITORING_LOG_FOLDER contains the log folder where the monitoring output should be saved
    
    $outputPath = "{0}/{1}" -f $Env:PF_MONITORING_LOG_FOLDER, "output.txt"
    "I've died!" | Out-File $outputPath 
}

Check_Sentinel_File
```

* 출력이 저장되도록 하려면 **PF\_MONITORING\_LOG\_FOLDER** 환경 변수로 설정된 폴더 내에 출력을 저장해야 합니다.
* 서버가 아카이브된 후에는 로그를 다운로드할 수 있으며, 그 안에서 **PlayfabProfilingOutput**이라는 폴더를 찾을 수 있습니다. 이 폴더에는 실행 스크립트에서 작성한 내용과 표준 출력 및 오류가 포함됩니다.


## Related topics

- [PIX로 지속 가능성 프로파일링](/ko/build/game-principles/sustainability/sustainability-pix-guide.md)
- [XBOX 타이틀을 위한 프로파일 기반 최적화 (PGO)](/ko/tools/tools-console/pgo/index.md)
- [PIX(Performance Investigator)로 Windows 타이틀 프로파일링하기](/ko/tools/tools-pc/pix-for-windows.md)
- [코어 간 메모리 비용](/ko/build/console-features/memory/Cross-Core-Memory-Costs.md)
- [게임 서버를 디버깅하기 위해 직접 연결](/ko/services/playfab/multiplayer/servers/directly-debugging-game-servers.md)
