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

表示要包含在使用情况统计信息中的分区的标志的按位或组合。

| 标志                               | 说明                                                                                                                                                                 |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 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 的按位或组合 |

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

用于接收内存使用信息的 [XMEM\_WORKING\_SET\_STATISTICS](/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` 结构的形式获取有关内存利用率的统计信息。该结构提供有关为游戏进程配置的内存的总大小和使用情况的信息。有关为游戏配置内存的更多信息，请参阅[为游戏和开发工具包配置内存](/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" />

## 请参阅

[内存](/build/console-features/memory/system-memory-overview)\
[XMEM\_WORKING\_SET\_STATISTICS](/reference/system/xmem/structs/xmem_working_set_statistics)\
[XMem](/reference/system/xmem/xmem_members)


## Related topics

- [使用 Microsoft GDK 游戏 OS 内存管理器](/zh-CN/build/console-features/memory/system-memory-working.md)
- [NDA 主题目录 - Microsoft Learn 在线链接](/zh-CN/nda/nda-topic-directory.md)
- [XMemGetWin32HeapStatistics](/zh-CN/reference/system/xmem/functions/xmemgetwin32heapstatistics.md)
- [WIN32_HEAP_STATISTICS](/zh-CN/reference/system/xmem/structs/win32_heap_statistics.md)
- [SetDeleteOnDestroy](/zh-CN/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_setdeleteondestroy_public.md)
