大网数据广告活动
磁盘与文件系统

JetGetThreadStats Function

· 52CE 我爱测

Learn more about: JetGetThreadStats Function

Applies to: Windows | Windows Server

JetGetThreadStats Function

The JetGetThreadStats function retrieves performance information from the database engine for the current thread. Multiple calls can be used to collect statistics that reflect the activity of the database engine on this thread between those calls.

Windows Vista:  JetGetThreadStats is introduced in Windows Vista.

    JET_ERR JET_API JetGetThreadStats(
      __out         void* pvResult,
      __in          unsigned long cbMax
    );

Parameters

pvResult

The output buffer which receives the thread statistics data. The buffer contains a JET_THREADSTATS structure after a successful call.

cbMax

The maximum size in bytes of the output buffer.

Return Value

This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.

Return code Description
JET_errSuccess The operation completed successfully.
JET_errBufferTooSmall The operation failed because the provided output buffer was too small to contain the requested data. The JetGetThreadStats function will return this error when the output buffer is too small to contain the smallest version of the <a href="gg269227(v=exchg.10).md">JET_THREADSTATS</a> structure supported by the database engine.

On success, the output buffer will contain a JET_THREADSTATS structure that contains database engine statistics for the current thread.

On failure, the state of the output buffer is undefined.

Remarks

The information provided by two consecutive calls of this API are intended to be used to compute the expense of any other database engine operations on the current thread. Generally, this is done by taking a before and after reading of the statistics and subtracting the after count from the before count to get the net count of operations performed.

For example, an application could call JetGetThreadStats once to get an initial reading of the statistics for the current thread. It could then call the JetMove function with the cRow parameter set to JET_MoveNext to move to the next index entry on an index. It could then call JetGetThreadStats again to get another reading of the thread's statistics. It could then subtract the cPageReferenced counter from the second reading from the first. The result would be the number of database pages referenced by the database engine to perform the JetMove operation.

The statistics for each thread are accumulated for the lifetime of that thread. The statistics are reset if the database engine's DLL is unloaded from the host process.

The JET_THREADSTATS structure will likely be expanded in the future to contain more statistics. New statistics will be added to the end of the structure and can be retrieved with an increased output buffer size. The presence of additional statistics can be inferred by a larger cbStruct value.

Requirements
Requirement Value
Client Requires Windows Vista.
Server Requires Windows Server 2008.
Header Declared in Esent.h.
Library Use ESENT.lib.
DLL Requires ESENT.dll.
See Also

JET_ERR
JET_THREADSTATS
JetMove

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 04/11/2016
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。