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

# XMemGetWorkingSetStatistics

> XMemGetWorkingSetStatistics

# XMemGetWorkingSetStatistics

提供遊戲處理程序中記憶體確切使用量的詳細資料。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
WINAPI
XMemGetWorkingSetStatistics(
  _In_ DWORD WorkingSetFlags,
  _Out_ PXMEM_WORKING_SET_STATISTICS Statistics
  );
```

<a id="parametersSection" />

### 參數

*WorkingSetFlags*   \_In\_\
類型：DWORD

旗標的位元 OR 組合，代表使用量統計資料中包含的分割區。

| 旗標 | 描述 |
| - | - |
| XMEM\_WORKING\_SET\_TITLE | 遊戲分割區 |
| XMEM\_WORKING\_SET\_TOOLS | 工具分割區 |
| XMEM\_WORKING\_SET\_STACK | 執行緒堆疊 |
| XMEM\_WORKING\_SET\_KERNEL\_POOL | 核心集區 |
| XMEM\_WORKING\_SET\_CPU\_PTE | CPU 分頁表大小 |
| XMEM\_WORKING\_SET\_ALL | 全部<br />此旗標代表 XMEM\_WORKING\_SET\_TITLE、XMEM\_WORKING\_SET\_TOOLS、XMEM\_WORKING\_SET\_STACK、XMEM\_WORKING\_SET\_KERNEL\_POOL 和 XMEM\_WORKING\_SET\_CPU\_PTE 的位元 OR 組合 |

*Statistics*   \_Out\_\
類型：PXMEM\_WORKING\_SET\_STATISTICS

用來接收記憶體使用量資訊之 [XMEM\_WORKING\_SET\_STATISTICS](/zh-TW/reference/system/xmem/structs/xmem_working_set_statistics) 結構的位址。

<a id="retvalSection" />

### 傳回值

類型：BOOL

如果成功，則傳回 `TRUE`；否則傳回 `FALSE`。若要取得延伸錯誤資訊，請呼叫 <a href="https://msdn.microsoft.com/library/windows/desktop/ms679360(v=vs.85).aspx">GetLastError</a>。

<a id="remarksSection" />

## 備註

此函式會根據 `WorkingSetFlags` 中指定的旗標，以 `XMEM_WORKING_SET_STATISTICS` 結構擷取記憶體使用率的統計資料。此結構提供為遊戲處理程序設定之記憶體的總大小和使用量資訊。如需為您的遊戲設定記憶體的詳細資訊，請參閱[為您的遊戲和開發套件設定記憶體](/zh-TW/build/console-features/memory/system-memory-tooling)。

<br />

<br />

<Note>XMemGetWorkingSetStatistics 是作為診斷函式使用，一般而言，不保證擷取所要求資料所需執行時間的效能。此原則唯一的例外是 XMEM\_WORKING\_SET\_TITLE，它是專為可在效能敏感情境中使用而設計的。</Note>

<a id="requirementsSection" />

## 需求

**標頭：** xmem.h

**程式庫：** xmem.lib

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

<a id="seealsoSection" />

## 另請參閱

[記憶體](/zh-TW/build/console-features/memory/system-memory-overview)\
[XMEM\_WORKING\_SET\_STATISTICS](/zh-TW/reference/system/xmem/structs/xmem_working_set_statistics)\
[XMem](/zh-TW/reference/system/xmem/xmem_members)


## Related topics

- [XMemGetWorkingSetStatistics](/reference/system/xmem/functions/xmemgetworkingsetstatistics.md)
- [Working with the Microsoft GDK Game OS memory manager](/build/console-features/memory/system-memory-working.md)
- [Trabajo con el administrador de memoria del sistema operativo de juego del Microsoft GDK](/es/build/console-features/memory/system-memory-working.md)
- [使用 Microsoft GDK 游戏 OS 内存管理器](/zh-CN/build/console-features/memory/system-memory-working.md)
- [Microsoft GDK Game OS 메모리 관리자 사용](/ko/build/console-features/memory/system-memory-working.md)
