网站首页  词典首页

请输入您要查询的函数:

 

术语 pdhopenlog
释义 PdhOpenLog
语法:
C++
PDH_STATUS PdhOpenLog(
__in LPCTSTR szLogFileName,
__in DWORD dwAccessFlags,
__in LPDWORD lpdwLogType,
__in PDH_HQUERY hQuery,
__in DWORD dwMaxSize,
__in LPCTSTR szUserCaption,
__out PDH_HLOG *phLog
);
PdhOpenLog功能
打开读取或写入指定的日志文件。
参数
szLogFileName [in]
NULL结尾的字符串,指定日志文件的名称打开。该名称可以包含绝对或相对路径。
如果lpdwLogType参数PDH_LOG_TYPE_SQL,指定的形式中,SQL:数据源名称日志文件的名称!日志文件的名称。
dwAccessFlags [in]
类型的访问用来打开日志文件。指定下列值之一。
ValueMeaning
PDH_LOG_READ_ACCESSOpen日志文件的阅读。
PDH_LOG_WRITE_ACCESSOpen一写新的日志文件。
PDH_LOG_UPDATE_ACCESSOpen现有日志文件进行写操作。
您可以使用按位包容性的OR运算符(|)来组合的访问类型与一个或更多下列创造标志。
ValueMeaning
PDH_LOG_CREATE_NEWCreates具有指定名称的新日志文件。
PDH_LOG_CREATE_ALWAYSCreates具有指定名称的新日志文件。如果日志文件已经存在,该函数删除现有的日志,然后再创建新的文件。
PDH_LOG_OPEN_EXISTINGOpens现有日志文件具有指定名称。如果具有指定名称的日志文件不存在,这是等于PDH_LOG_CREATE_NEW。
PDH_LOG_OPEN_ALWAYSOpens现有日志文件具有指定名称或创建一个具有指定名称的新日志文件。
PDH_LOG_OPT_CIRCULARCreates具有指定名称的循环日志文件。当文件到达了dwMaxSize参数的值,数据包裹到日志文件的开头。您可以指定此标志只有lpdwLogType参数PDH_LOG_TYPE_BINARY。
lpdwLogType [in]
日志式文件将其打开。此参数可以是下列值之一。
ValueMeaning
PDH_LOG_TYPE_UNDEFINEDUndefined日志文件格式。如果指定的PDH确定日志文件的类型。您不能指定此值,如果dwAccessFlags参数PDH_LOG_WRITE_ACCESS。
PDH_LOG_TYPE_CSVText该文件包含的第一行中的列标题,个人资料和记录每个后续行。每个数据记录的字段以逗号分隔。
第一行还包含有关文件的格式的信息,版本的PDH用于创建日志文件的名称和路径的柜位。
PDH_LOG_TYPE_SQLThe数据日志文件的源是一个SQL数据库。
PDH_LOG_TYPE_TSVText文件包含在第一行的列标题,个人资料和记录每个后续行。每一个数据记录的字段是制表符分隔。
第一行还包含有关文件的格式的信息,版本的PDH用于创建日志文件的名称和路径的柜位。
PDH_LOG_TYPE_BINARYBinary日志文件格式。
hQuery [in]
指定查询处理,如果您正在编写查询数据到一个日志文件。该PdhOpenQuery函数返回此句柄。
此参数被忽略,应为NULL,如果您是从日志文件中读取。
dwMaxSize [in]
最大大小的日志文件,以字节为单位。指定的最大大小,如果您想限制文件的大小或dwAccessFlags指定PDH_LOG_OPT_CIRCULAR,否则,设置为0。
对于循环日志文件,您必须指定一个值足够大,至少举行一次样本。样本大小取决于所收集的数据。但是,指定至少1兆字节的值将覆盖大部分样本。
szUserCaption [in]
null结尾的字符串,指定用户定义日志文件的标题。日志文件标题一般描述了日志文件的内容。当现有日志文件被打开时,此参数值会被忽略。
phLog [out]
句柄打开日志文件。
返回值
如果函数成功,它返回ERROR_SUCCESS。
如果函数失败,返回值是一个系统错误代码或一种PDH错误代码。
备注
要使用此功能性能数据写入到一个日志文件,您必须打开一个查询使用PdhOpenQuery并添加所需的柜台,它在调用这个函数。
新的操作系统可以读取的日志是在旧版操作系统生成的文件,但日志中创建的Windows Vista和更高版本的操作系统不能在早期操作系统读取文件。
实例
有关示例,请参见性能数据写入到一个日志文件。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode和ANSI namesPdhOpenLogW(Unicode)和PdhOpenLogA(ANSI)的
参见
PdhOpenQuery
PdhUpdateLog
PdhUpdateLogFileCatalog
PdhGetLogFileSize
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月23日
==英文原文==PdhOpenLog Function
Opens the specified log file for reading or writing.
Syntax
C++
PDH_STATUS PdhOpenLog(
__in LPCTSTR szLogFileName,
__in DWORD dwAccessFlags,
__in LPDWORD lpdwLogType,
__in PDH_HQUERY hQuery,
__in DWORD dwMaxSize,
__in LPCTSTR szUserCaption,
__out PDH_HLOG *phLog
);
Parameters
szLogFileName [in]
Null-terminated string that specifies the name of the log file to open. The name can contain an absolute or relative path.
If the lpdwLogType parameter is PDH_LOG_TYPE_SQL, specify the name of the log file in the form, SQL:Data Source Name!Log File Name.
dwAccessFlags [in]
Type of access to use to open the log file. Specify one of the following values.
ValueMeaning
PDH_LOG_READ_ACCESSOpen the log file for reading.
PDH_LOG_WRITE_ACCESSOpen a new log file for writing.
PDH_LOG_UPDATE_ACCESSOpen an existing log file for writing.

You can use the bitwise inclusive OR operator (|) to combine the access type with one or more of the following creation flags.
ValueMeaning
PDH_LOG_CREATE_NEWCreates a new log file with the specified name.
PDH_LOG_CREATE_ALWAYSCreates a new log file with the specified name. If the log file already exists, the function removes the existing log file before creating the new file.
PDH_LOG_OPEN_EXISTINGOpens an existing log file with the specified name. If a log file with the specified name does not exist, this is equal to PDH_LOG_CREATE_NEW.
PDH_LOG_OPEN_ALWAYSOpens an existing log file with the specified name or creates a new log file with the specified name.
PDH_LOG_OPT_CIRCULARCreates a circular log file with the specified name. When the file reaches the value of the dwMaxSize parameter, data wraps to the beginning of the log file. You can specify this flag only if the lpdwLogType parameter is PDH_LOG_TYPE_BINARY.

lpdwLogType [in]
Type of log file to open. This parameter can be one of the following values.
ValueMeaning
PDH_LOG_TYPE_UNDEFINEDUndefined log file format. If specified, PDH determines the log file type. You cannot specify this value if the dwAccessFlags parameter is PDH_LOG_WRITE_ACCESS.
PDH_LOG_TYPE_CSVText file containing column headers in the first line, and individual data records in each subsequent line. The fields of each data record are comma-delimited.
The first line also contains information about the format of the file, the PDH version used to create the log file, and the names and paths of each of the counters.
PDH_LOG_TYPE_SQLThe data source of the log file is an SQL database.
PDH_LOG_TYPE_TSVText file containing column headers in the first line, and individual data records in each subsequent line. The fields of each data record are tab-delimited.
The first line also contains information about the format of the file, the PDH version used to create the log file, and the names and paths of each of the counters.
PDH_LOG_TYPE_BINARYBinary log file format.

hQuery [in]
Specify a query handle if you are writing query data to a log file. The PdhOpenQuery function returns this handle.
This parameter is ignored and should be NULL if you are reading from the log file.
dwMaxSize [in]
Maximum size of the log file, in bytes. Specify the maximum size if you want to limit the file size or if dwAccessFlags specifies PDH_LOG_OPT_CIRCULAR; otherwise, set to 0.
For circular log files, you must specify a value large enough to hold at least one sample. Sample size depends on data being collected. However, specifying a value of at least one megabyte will cover most samples.
szUserCaption [in]
Null-terminated string that specifies the user-defined caption of the log file. A log file caption generally describes the contents of the log file. When an existing log file is opened, the value of this parameter is ignored.
phLog [out]
Handle to the opened log file.
Return Value
If the function succeeds, it returns ERROR_SUCCESS.
If the function fails, the return value is a system error code or a PDH error code .
Remarks
To use this function to write performance data to a log file, you must open a query using PdhOpenQuery and add the desired counters to it, before calling this function.
Newer operating systems can read log files that were generated on older operating systems; however, log files that were created on Windows Vista and later operating systems cannot be read on earlier operating systems.
Examples
For an example, see Writing Performance Data to a Log File .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode and ANSI namesPdhOpenLogW (Unicode) and PdhOpenLogA (ANSI)
See Also
PdhOpenQuery
PdhUpdateLog
PdhUpdateLogFileCatalog
PdhGetLogFileSize
Send comments about this topic to Microsoft
Build date: 7/23/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa372651(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:24:13