ホーム › System.Performance › PdhCollectQueryDataWithTime
PdhCollectQueryDataWithTime
関数照会データを収集しタイムスタンプも取得する。
シグネチャ
// pdh.dll
#include <windows.h>
DWORD PdhCollectQueryDataWithTime(
PDH_HQUERY hQuery,
LONGLONG* pllTimeStamp
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hQuery | PDH_HQUERY | inout |
| pllTimeStamp | LONGLONG* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// pdh.dll
#include <windows.h>
DWORD PdhCollectQueryDataWithTime(
PDH_HQUERY hQuery,
LONGLONG* pllTimeStamp
);[DllImport("pdh.dll", ExactSpelling = true)]
static extern uint PdhCollectQueryDataWithTime(
IntPtr hQuery, // PDH_HQUERY in/out
out long pllTimeStamp // LONGLONG* out
);<DllImport("pdh.dll", ExactSpelling:=True)>
Public Shared Function PdhCollectQueryDataWithTime(
hQuery As IntPtr, ' PDH_HQUERY in/out
<Out> ByRef pllTimeStamp As Long ' LONGLONG* out
) As UInteger
End Function' hQuery : PDH_HQUERY in/out
' pllTimeStamp : LONGLONG* out
Declare PtrSafe Function PdhCollectQueryDataWithTime Lib "pdh" ( _
ByVal hQuery As LongPtr, _
ByRef pllTimeStamp As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PdhCollectQueryDataWithTime = ctypes.windll.pdh.PdhCollectQueryDataWithTime
PdhCollectQueryDataWithTime.restype = wintypes.DWORD
PdhCollectQueryDataWithTime.argtypes = [
wintypes.HANDLE, # hQuery : PDH_HQUERY in/out
ctypes.POINTER(ctypes.c_longlong), # pllTimeStamp : LONGLONG* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('pdh.dll')
PdhCollectQueryDataWithTime = Fiddle::Function.new(
lib['PdhCollectQueryDataWithTime'],
[
Fiddle::TYPE_VOIDP, # hQuery : PDH_HQUERY in/out
Fiddle::TYPE_VOIDP, # pllTimeStamp : LONGLONG* out
],
-Fiddle::TYPE_INT)#[link(name = "pdh")]
extern "system" {
fn PdhCollectQueryDataWithTime(
hQuery: *mut core::ffi::c_void, // PDH_HQUERY in/out
pllTimeStamp: *mut i64 // LONGLONG* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("pdh.dll")]
public static extern uint PdhCollectQueryDataWithTime(IntPtr hQuery, out long pllTimeStamp);
"@
$api = Add-Type -MemberDefinition $sig -Name 'pdh_PdhCollectQueryDataWithTime' -Namespace Win32 -PassThru
# $api::PdhCollectQueryDataWithTime(hQuery, pllTimeStamp)#uselib "pdh.dll"
#func global PdhCollectQueryDataWithTime "PdhCollectQueryDataWithTime" sptr, sptr
; PdhCollectQueryDataWithTime hQuery, varptr(pllTimeStamp) ; 戻り値は stat
; hQuery : PDH_HQUERY in/out -> "sptr"
; pllTimeStamp : LONGLONG* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "pdh.dll" #cfunc global PdhCollectQueryDataWithTime "PdhCollectQueryDataWithTime" sptr, var ; res = PdhCollectQueryDataWithTime(hQuery, pllTimeStamp) ; hQuery : PDH_HQUERY in/out -> "sptr" ; pllTimeStamp : LONGLONG* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "pdh.dll" #cfunc global PdhCollectQueryDataWithTime "PdhCollectQueryDataWithTime" sptr, sptr ; res = PdhCollectQueryDataWithTime(hQuery, varptr(pllTimeStamp)) ; hQuery : PDH_HQUERY in/out -> "sptr" ; pllTimeStamp : LONGLONG* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD PdhCollectQueryDataWithTime(PDH_HQUERY hQuery, LONGLONG* pllTimeStamp) #uselib "pdh.dll" #cfunc global PdhCollectQueryDataWithTime "PdhCollectQueryDataWithTime" intptr, var ; res = PdhCollectQueryDataWithTime(hQuery, pllTimeStamp) ; hQuery : PDH_HQUERY in/out -> "intptr" ; pllTimeStamp : LONGLONG* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD PdhCollectQueryDataWithTime(PDH_HQUERY hQuery, LONGLONG* pllTimeStamp) #uselib "pdh.dll" #cfunc global PdhCollectQueryDataWithTime "PdhCollectQueryDataWithTime" intptr, intptr ; res = PdhCollectQueryDataWithTime(hQuery, varptr(pllTimeStamp)) ; hQuery : PDH_HQUERY in/out -> "intptr" ; pllTimeStamp : LONGLONG* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
pdh = windows.NewLazySystemDLL("pdh.dll")
procPdhCollectQueryDataWithTime = pdh.NewProc("PdhCollectQueryDataWithTime")
)
// hQuery (PDH_HQUERY in/out), pllTimeStamp (LONGLONG* out)
r1, _, err := procPdhCollectQueryDataWithTime.Call(
uintptr(hQuery),
uintptr(pllTimeStamp),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PdhCollectQueryDataWithTime(
hQuery: THandle; // PDH_HQUERY in/out
pllTimeStamp: Pointer // LONGLONG* out
): DWORD; stdcall;
external 'pdh.dll' name 'PdhCollectQueryDataWithTime';result := DllCall("pdh\PdhCollectQueryDataWithTime"
, "Ptr", hQuery ; PDH_HQUERY in/out
, "Ptr", pllTimeStamp ; LONGLONG* out
, "UInt") ; return: DWORD●PdhCollectQueryDataWithTime(hQuery, pllTimeStamp) = DLL("pdh.dll", "dword PdhCollectQueryDataWithTime(void*, void*)")
# 呼び出し: PdhCollectQueryDataWithTime(hQuery, pllTimeStamp)
# hQuery : PDH_HQUERY in/out -> "void*"
# pllTimeStamp : LONGLONG* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。