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

# XSystemGetAnalyticsInfo

> XSystemGetAnalyticsInfo

# XSystemGetAnalyticsInfo

提供有关游戏所运行的操作系统和设备的诊断信息。

## 语法

```cpp theme={null}
XSystemAnalyticsInfo XSystemGetAnalyticsInfo(  
)  
```

### 参数

无。

### 返回值

类型：[XSystemAnalyticsInfo](/reference/system/xsystem/structs/xsystemanalyticsinfo)

返回一个 [XSystemAnalyticsInfo](/reference/system/xsystem/structs/xsystemanalyticsinfo) 结构，其中包含有关当前设备的信息。

## 备注

<Note>在时间敏感型线程上调用此函数不安全。有关详细信息，请参阅[时间敏感型线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

**XSystemGetAnalyticsInfo** 函数返回一个 [XSystemAnalyticsInfo](/reference/system/xsystem/structs/xsystemanalyticsinfo) 结构，其中包含有关当前设备的诊断信息。此信息包括游戏运行所在的操作系统的版本和启动游戏的操作系统的版本，以及设备的系列和形式。

以下示例说明如何通过调用 **XSystemGetAnalyticsInfo** 并连接 **XSystemAnalyticsInfo** 的 *osVersion* 成员中返回的结果，来检索游戏运行所在的操作系统的版本信息。

```cpp theme={null}
// Get the version of the operating system in which the game is running.
std::string Game::GetGameOSVersion()
{
    // Call XSystemGetAnalyticsInfo()
    XSystemAnalyticsInfo info = XSystemGetAnalyticsInfo();

    // Return a formatted string from the osVersion member of XSystemAnalyticsInfo.
    return std::to_string(info.osVersion.major) + "." +
        std::to_string(info.osVersion.minor) + "." +
        std::to_string(info.osVersion.build) + "." +
        std::to_string(info.osVersion.revision);

}
```

## 要求

**头文件：** XSystem.h

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 概念文档

* [时间敏感型线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另请参阅

[XSystem](/reference/system/xsystem/xsystem_members)\
[XSystemAnalyticsInfo](/reference/system/xsystem/structs/xsystemanalyticsinfo)


## Related topics

- [XSystemAnalyticsInfo](/zh-CN/reference/system/xsystem/structs/xsystemanalyticsinfo.md)
- [XSystem](/zh-CN/reference/system/xsystem/xsystem_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XSystemGetRuntimeInfo](/zh-CN/reference/system/xsystem/functions/xsystemgetruntimeinfo.md)
- [XVersion](/zh-CN/reference/system/xgameruntimetypes/structs/xversion.md)
