> ## 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.

# PIXBeginCapture

> PIXBeginCapture

# PIXBeginCapture

프로그래밍 방식으로 제어되는 PIX 타이밍 캡처를 시작합니다.

## 구문

```cpp theme={null}
HRESULT PIXBeginCapture(  
         DWORD captureFlags,  
         const PPIXCaptureParameters captureParameters  
)  
```

### 매개변수

*captureFlags*   \
형식: DWORD

수행할 캡처 유형을 나타내는 플래그입니다. 한 번에 하나의 캡처 플래그만 `PIXBeginCapture`에 전달할 수 있습니다.

*captureParameters*   \_In\_opt\_\
형식: PPIXCaptureParameters

타이밍 캡처의 경우 `TimingCaptureParameters` 구조체에 대한 포인터를 전달하거나 `TimingCaptureParameters` 구조체를 포함하는 [PIXCaptureParameters](https://devdocs.xbox.com/ko/reference/tools/pix3/structs/pixcaptureparameters.md) 공용 구조체에 대한 포인터를 전달합니다.

### 반환값

형식: HRESULT

캡처가 성공적으로 시작되었는지 여부를 나타냅니다. 성공 시 S\_FALSE가 반환됩니다. 한 번에 하나의 캡처만 실행할 수 있습니다. 다른 캡처가 현재 실행 중일 때 `PIXBeginCapture`가 호출되면 E\_PENDING이 반환되고 호출은 아무런 효과가 없습니다.

#### 플래그

| 플래그 | 값 | 설명 |
| - | - | - |
| PIX\_CAPTURE\_TIMING | (1 \<\< 0) | 시스템 타이밍. |
| PIX\_CAPTURE\_GPU | (1 \<\< 1) | GPU에 전송된 모든 명령과 그 입력을 캡처하여 재생 및 분석할 수 있도록 합니다. |
| PIX\_CAPTURE\_FUNCTION\_SUMMARY | (1 \<\< 2) | **Home** 탭에서 함수 요약 캡처가 시작되었습니다. |
| PIX\_CAPTURE\_FUNCTION\_DETAILS | (1 \<\< 3) | 함수 요약 또는 콜그래프 캡처에서 **Capture Additional Calls** 버튼을 사용하여 추가 함수 세부 정보에 대한 요청이 시작되었습니다. |
| PIX\_CAPTURE\_CALLGRAPH | (1 \<\< 4) | PIX에서 또는 `PIXBeginCapture` 호출을 통해 프로그래밍 방식으로 콜그래프 캡처가 시작되었습니다. |
| PIX\_CAPTURE\_INSTRUCTION\_TRACE | (1 \<\< 5) | CPU 명령 추적 캡처가 진행 중입니다. |
| PIX\_CAPTURE\_SYSTEM\_MONITOR\_COUNTERS | (1 \<\< 6) | 시스템 모니터 카운터. |
| PIX\_CAPTURE\_VIDEO | (1 \<\< 7) | 비디오 재생. |
| PIX\_CAPTURE\_AUDIO | (1 \<\< 8) | 오디오 재생. |
| PIX\_CAPTURE\_GPU\_TRACE | (1 \<\< 9) | GPU Streaming Performance Monitor(SPM) 카운터와 거의 모든 GPU 블록의 Shader Queue Thread Tracing(SQTT) 데이터를 캡처합니다. |
| PIX\_CAPTURE\_RESERVED | (1 \<\< 15) | 향후 또는 특수한 캡처 시나리오를 위해 PIX가 내부적으로 사용하는 자리 표시자 플래그입니다. |

## 설명

이 함수는 타이틀 코드에서 PIX 캡처를 시작합니다. `PIXBeginCapture`는 현재 [timing capture(NDA 항목)](https://devdocs.xbox.com/ko/tools/tools-console/pix/new-timing-captures.md)를 수행하는 데에만 사용할 수 있습니다.

`PIXBeginCapture`는 캡처 데이터를 콘솔의 툴링 메모리에 저장합니다. 캡처에 사용할 수 있는 툴링 메모리의 양은 [PIXCaptureParameters](https://devdocs.xbox.com/ko/reference/tools/pix3/structs/pixcaptureparameters.md) 구조체에서 `MaximumToolingMemorySizeMb` 필드를 설정하여 지정합니다.

프로그래밍 방식의 타이밍 캡처는 [PIXCaptureParameters](https://devdocs.xbox.com/ko/reference/tools/pix3/structs/pixcaptureparameters.md) 구조체의 `PIXCaptureStorage` 열거형 값으로 정의된 두 가지 모드 중 하나로 수행할 수 있습니다. `PIXCaptureStorage`가 *Memory*로 설정되면 `PIXBeginCapture`는 사용 가능한 툴링 메모리를 채운 다음 들어오는 새 데이터를 폐기합니다. `PIXCaptureStorage`가 *MemoryCircular*로 설정되면 `PIXBeginCapture`는 툴링 메모리를 링 버퍼로 사용합니다. 캡처는 툴링 메모리가 가득 찰 때까지 실행되지만, 캡처를 중단하지 않고 가장 오래된 데이터를 만료시켜 새 데이터를 위한 공간을 만듭니다. 캡처는 계속 실행됩니다. *MemoryCircular* 캡처는 콘솔에서 사용 가능한 툴링 메모리를 소진하지 않으면서 장시간 실행되도록 설계되었습니다.

`PIXBeginCapture`를 사용하여 수행한 타이밍 캡처는 PIX에서 볼 수 있도록 PC로 다시 복사하여 .xpix 파일로 변환해야 합니다. PIX에서 프로그래밍 방식의 캡처를 보기 위해 필요한 단계에 대한 설명은 [Opening Programmatic Timing Captures(NDA 항목)](https://devdocs.xbox.com/ko/tools/tools-console/pix/open-offline-timing-captures.md)를 참조하십시오.

타이틀 코드에서 PIX 캡처를 중지하려면 [PIXEndCapture](https://devdocs.xbox.com/ko/reference/tools/pix3/functions/pixendcapture.md)를 사용합니다.

```cpp theme={null}
//
//  timing capture
//
PIXCaptureParameters captureParams = {};

captureParams.TimingCaptureParameters.CaptureGpuTiming = TRUE;
captureParams.TimingCaptureParameters.CaptureCallstacks = TRUE;
captureParams.TimingCaptureParameters.CaptureCpuSamples = TRUE;
captureParams.TimingCaptureParameters.CpuSamplesPerSecond = 4000;

captureParams.TimingCaptureParameters.CaptureStorage = PIXCaptureParameters::Memory;
captureParams.TimingCaptureParameters.FileName = wstrFilename;
captureParams.TimingCaptureParameters.MaximumToolingMemorySizeMb = 4096;

XSF_ERROR_IF_FAILED(PIXBeginCapture(PIX_CAPTURE_TIMING, &captureParams));

```

## 요구 사항

**헤더:** pix3.h

**라이브러리:** pixevt.lib

**지원되는 플랫폼:** XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 문서

* [Analyzing CPU performance (contents)](https://devdocs.xbox.com/ko/tools/tools-console/pix/cpu-performance.md)

## 함께 보기

[PIXEndCapture](https://devdocs.xbox.com/ko/reference/tools/pix3/functions/pixendcapture.md)\
[PIXCaptureParameters](https://devdocs.xbox.com/ko/reference/tools/pix3/structs/pixcaptureparameters.md)\
[PIX3](https://devdocs.xbox.com/ko/reference/tools/pix3/pix3_members.md)\
[PIX(NDA 항목)](https://devdocs.xbox.com/ko/tools/tools-console/pix/pix.md)


## Related topics

- [PIXCaptureParameters](https://devdocs.xbox.com/ko/reference/tools/pix3/structs/pixcaptureparameters.md)
- [PIXEndCapture](https://devdocs.xbox.com/ko/reference/tools/pix3/functions/pixendcapture.md)
- [PIXGetCaptureState](https://devdocs.xbox.com/ko/reference/tools/pix3/functions/pixgetcapturestate.md)
- [PIX3 (API 콘텐츠)](https://devdocs.xbox.com/ko/reference/tools/pix3/pix3_members.md)
- [XtfCaptureOutputBegin](https://devdocs.xbox.com/ko/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputbegin-xtfapi-xbox-windows-m.md)
