Win32 API 日本語リファレンス
ホームSystem.Search › SQLPERF

SQLPERF

構造体
サイズx64: 160 バイト / x86: 160 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
TimerResolutionDWORD4+0+0パフォーマンス計測タイマーの分解能。ミリ秒単位。
SQLiduDWORD4+4+4実行された INSERT/DELETE/UPDATE 文の総数。
SQLiduRowsDWORD4+8+8INSERT/DELETE/UPDATE で影響を受けた行数の累計。
SQLSelectsDWORD4+12+12実行された SELECT 文の総数。
SQLSelectRowsDWORD4+16+16SELECT が返した行数の累計。
TransactionsDWORD4+20+20実行されたトランザクションの総数。
SQLPreparesDWORD4+24+24プリペア(SQLPrepare)実行の総数。
ExecDirectsDWORD4+28+28直接実行(SQLExecDirect)の総数。
SQLExecutesDWORD4+32+32プリペア済み文の実行(SQLExecute)総数。
CursorOpensDWORD4+36+36オープンされたカーソルの総数。
CursorSizeDWORD4+40+40オープンされたカーソルの総行数。
CursorUsedDWORD4+44+44実際に取得されたカーソル行数の累計。
PercentCursorUsedDOUBLE8+48+48カーソル取得率(CursorUsed/CursorSize)。百分率。
AvgFetchTimeDOUBLE8+56+561 フェッチあたりの平均所要時間。
AvgCursorSizeDOUBLE8+64+64カーソルの平均サイズ(行数)。
AvgCursorUsedDOUBLE8+72+72カーソルあたりの平均使用行数。
SQLFetchTimeDWORD4+80+80フェッチに要した総時間。
SQLFetchCountDWORD4+84+84実行されたフェッチの総回数。
CurrentStmtCountDWORD4+88+88現在オープン中のステートメント数。
MaxOpenStmtDWORD4+92+92同時オープンしたステートメント数の最大値。
SumOpenStmtDWORD4+96+96オープンされたステートメント数の累計。
CurrentConnectionCountDWORD4+100+100現在オープン中の接続数。
MaxConnectionsOpenedDWORD4+104+104同時オープンした接続数の最大値。
SumConnectionsOpenedDWORD4+108+108オープンされた接続数の累計。
SumConnectiontimeDWORD4+112+112接続が保持された総時間。
AvgTimeOpenedDOUBLE8+120+120接続あたりの平均オープン時間。
ServerRndTripsDWORD4+128+128サーバーとのラウンドトリップ総回数。
BuffersSentDWORD4+132+132サーバーへ送信したバッファ数の累計。
BuffersRecDWORD4+136+136サーバーから受信したバッファ数の累計。
BytesSentDWORD4+140+140サーバーへ送信した総バイト数。
BytesRecDWORD4+144+144サーバーから受信した総バイト数。
msExecutionTimeDWORD4+148+148実行に要した総時間。ミリ秒単位。
msNetWorkServerTimeDWORD4+152+152ネットワーク/サーバー処理に要した総時間。ミリ秒単位。

各言語での定義

#include <windows.h>

// SQLPERF  (x64 160 / x86 160 バイト)
typedef struct SQLPERF {
    DWORD TimerResolution;
    DWORD SQLidu;
    DWORD SQLiduRows;
    DWORD SQLSelects;
    DWORD SQLSelectRows;
    DWORD Transactions;
    DWORD SQLPrepares;
    DWORD ExecDirects;
    DWORD SQLExecutes;
    DWORD CursorOpens;
    DWORD CursorSize;
    DWORD CursorUsed;
    DOUBLE PercentCursorUsed;
    DOUBLE AvgFetchTime;
    DOUBLE AvgCursorSize;
    DOUBLE AvgCursorUsed;
    DWORD SQLFetchTime;
    DWORD SQLFetchCount;
    DWORD CurrentStmtCount;
    DWORD MaxOpenStmt;
    DWORD SumOpenStmt;
    DWORD CurrentConnectionCount;
    DWORD MaxConnectionsOpened;
    DWORD SumConnectionsOpened;
    DWORD SumConnectiontime;
    DOUBLE AvgTimeOpened;
    DWORD ServerRndTrips;
    DWORD BuffersSent;
    DWORD BuffersRec;
    DWORD BytesSent;
    DWORD BytesRec;
    DWORD msExecutionTime;
    DWORD msNetWorkServerTime;
} SQLPERF;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SQLPERF
{
    public uint TimerResolution;
    public uint SQLidu;
    public uint SQLiduRows;
    public uint SQLSelects;
    public uint SQLSelectRows;
    public uint Transactions;
    public uint SQLPrepares;
    public uint ExecDirects;
    public uint SQLExecutes;
    public uint CursorOpens;
    public uint CursorSize;
    public uint CursorUsed;
    public double PercentCursorUsed;
    public double AvgFetchTime;
    public double AvgCursorSize;
    public double AvgCursorUsed;
    public uint SQLFetchTime;
    public uint SQLFetchCount;
    public uint CurrentStmtCount;
    public uint MaxOpenStmt;
    public uint SumOpenStmt;
    public uint CurrentConnectionCount;
    public uint MaxConnectionsOpened;
    public uint SumConnectionsOpened;
    public uint SumConnectiontime;
    public double AvgTimeOpened;
    public uint ServerRndTrips;
    public uint BuffersSent;
    public uint BuffersRec;
    public uint BytesSent;
    public uint BytesRec;
    public uint msExecutionTime;
    public uint msNetWorkServerTime;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SQLPERF
    Public TimerResolution As UInteger
    Public SQLidu As UInteger
    Public SQLiduRows As UInteger
    Public SQLSelects As UInteger
    Public SQLSelectRows As UInteger
    Public Transactions As UInteger
    Public SQLPrepares As UInteger
    Public ExecDirects As UInteger
    Public SQLExecutes As UInteger
    Public CursorOpens As UInteger
    Public CursorSize As UInteger
    Public CursorUsed As UInteger
    Public PercentCursorUsed As Double
    Public AvgFetchTime As Double
    Public AvgCursorSize As Double
    Public AvgCursorUsed As Double
    Public SQLFetchTime As UInteger
    Public SQLFetchCount As UInteger
    Public CurrentStmtCount As UInteger
    Public MaxOpenStmt As UInteger
    Public SumOpenStmt As UInteger
    Public CurrentConnectionCount As UInteger
    Public MaxConnectionsOpened As UInteger
    Public SumConnectionsOpened As UInteger
    Public SumConnectiontime As UInteger
    Public AvgTimeOpened As Double
    Public ServerRndTrips As UInteger
    Public BuffersSent As UInteger
    Public BuffersRec As UInteger
    Public BytesSent As UInteger
    Public BytesRec As UInteger
    Public msExecutionTime As UInteger
    Public msNetWorkServerTime As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SQLPERF(ctypes.Structure):
    _fields_ = [
        ("TimerResolution", wintypes.DWORD),
        ("SQLidu", wintypes.DWORD),
        ("SQLiduRows", wintypes.DWORD),
        ("SQLSelects", wintypes.DWORD),
        ("SQLSelectRows", wintypes.DWORD),
        ("Transactions", wintypes.DWORD),
        ("SQLPrepares", wintypes.DWORD),
        ("ExecDirects", wintypes.DWORD),
        ("SQLExecutes", wintypes.DWORD),
        ("CursorOpens", wintypes.DWORD),
        ("CursorSize", wintypes.DWORD),
        ("CursorUsed", wintypes.DWORD),
        ("PercentCursorUsed", ctypes.c_double),
        ("AvgFetchTime", ctypes.c_double),
        ("AvgCursorSize", ctypes.c_double),
        ("AvgCursorUsed", ctypes.c_double),
        ("SQLFetchTime", wintypes.DWORD),
        ("SQLFetchCount", wintypes.DWORD),
        ("CurrentStmtCount", wintypes.DWORD),
        ("MaxOpenStmt", wintypes.DWORD),
        ("SumOpenStmt", wintypes.DWORD),
        ("CurrentConnectionCount", wintypes.DWORD),
        ("MaxConnectionsOpened", wintypes.DWORD),
        ("SumConnectionsOpened", wintypes.DWORD),
        ("SumConnectiontime", wintypes.DWORD),
        ("AvgTimeOpened", ctypes.c_double),
        ("ServerRndTrips", wintypes.DWORD),
        ("BuffersSent", wintypes.DWORD),
        ("BuffersRec", wintypes.DWORD),
        ("BytesSent", wintypes.DWORD),
        ("BytesRec", wintypes.DWORD),
        ("msExecutionTime", wintypes.DWORD),
        ("msNetWorkServerTime", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SQLPERF {
    pub TimerResolution: u32,
    pub SQLidu: u32,
    pub SQLiduRows: u32,
    pub SQLSelects: u32,
    pub SQLSelectRows: u32,
    pub Transactions: u32,
    pub SQLPrepares: u32,
    pub ExecDirects: u32,
    pub SQLExecutes: u32,
    pub CursorOpens: u32,
    pub CursorSize: u32,
    pub CursorUsed: u32,
    pub PercentCursorUsed: f64,
    pub AvgFetchTime: f64,
    pub AvgCursorSize: f64,
    pub AvgCursorUsed: f64,
    pub SQLFetchTime: u32,
    pub SQLFetchCount: u32,
    pub CurrentStmtCount: u32,
    pub MaxOpenStmt: u32,
    pub SumOpenStmt: u32,
    pub CurrentConnectionCount: u32,
    pub MaxConnectionsOpened: u32,
    pub SumConnectionsOpened: u32,
    pub SumConnectiontime: u32,
    pub AvgTimeOpened: f64,
    pub ServerRndTrips: u32,
    pub BuffersSent: u32,
    pub BuffersRec: u32,
    pub BytesSent: u32,
    pub BytesRec: u32,
    pub msExecutionTime: u32,
    pub msNetWorkServerTime: u32,
}
import "golang.org/x/sys/windows"

type SQLPERF struct {
	TimerResolution uint32
	SQLidu uint32
	SQLiduRows uint32
	SQLSelects uint32
	SQLSelectRows uint32
	Transactions uint32
	SQLPrepares uint32
	ExecDirects uint32
	SQLExecutes uint32
	CursorOpens uint32
	CursorSize uint32
	CursorUsed uint32
	PercentCursorUsed float64
	AvgFetchTime float64
	AvgCursorSize float64
	AvgCursorUsed float64
	SQLFetchTime uint32
	SQLFetchCount uint32
	CurrentStmtCount uint32
	MaxOpenStmt uint32
	SumOpenStmt uint32
	CurrentConnectionCount uint32
	MaxConnectionsOpened uint32
	SumConnectionsOpened uint32
	SumConnectiontime uint32
	AvgTimeOpened float64
	ServerRndTrips uint32
	BuffersSent uint32
	BuffersRec uint32
	BytesSent uint32
	BytesRec uint32
	msExecutionTime uint32
	msNetWorkServerTime uint32
}
type
  SQLPERF = record
    TimerResolution: DWORD;
    SQLidu: DWORD;
    SQLiduRows: DWORD;
    SQLSelects: DWORD;
    SQLSelectRows: DWORD;
    Transactions: DWORD;
    SQLPrepares: DWORD;
    ExecDirects: DWORD;
    SQLExecutes: DWORD;
    CursorOpens: DWORD;
    CursorSize: DWORD;
    CursorUsed: DWORD;
    PercentCursorUsed: Double;
    AvgFetchTime: Double;
    AvgCursorSize: Double;
    AvgCursorUsed: Double;
    SQLFetchTime: DWORD;
    SQLFetchCount: DWORD;
    CurrentStmtCount: DWORD;
    MaxOpenStmt: DWORD;
    SumOpenStmt: DWORD;
    CurrentConnectionCount: DWORD;
    MaxConnectionsOpened: DWORD;
    SumConnectionsOpened: DWORD;
    SumConnectiontime: DWORD;
    AvgTimeOpened: Double;
    ServerRndTrips: DWORD;
    BuffersSent: DWORD;
    BuffersRec: DWORD;
    BytesSent: DWORD;
    BytesRec: DWORD;
    msExecutionTime: DWORD;
    msNetWorkServerTime: DWORD;
  end;
const SQLPERF = extern struct {
    TimerResolution: u32,
    SQLidu: u32,
    SQLiduRows: u32,
    SQLSelects: u32,
    SQLSelectRows: u32,
    Transactions: u32,
    SQLPrepares: u32,
    ExecDirects: u32,
    SQLExecutes: u32,
    CursorOpens: u32,
    CursorSize: u32,
    CursorUsed: u32,
    PercentCursorUsed: f64,
    AvgFetchTime: f64,
    AvgCursorSize: f64,
    AvgCursorUsed: f64,
    SQLFetchTime: u32,
    SQLFetchCount: u32,
    CurrentStmtCount: u32,
    MaxOpenStmt: u32,
    SumOpenStmt: u32,
    CurrentConnectionCount: u32,
    MaxConnectionsOpened: u32,
    SumConnectionsOpened: u32,
    SumConnectiontime: u32,
    AvgTimeOpened: f64,
    ServerRndTrips: u32,
    BuffersSent: u32,
    BuffersRec: u32,
    BytesSent: u32,
    BytesRec: u32,
    msExecutionTime: u32,
    msNetWorkServerTime: u32,
};
type
  SQLPERF {.bycopy.} = object
    TimerResolution: uint32
    SQLidu: uint32
    SQLiduRows: uint32
    SQLSelects: uint32
    SQLSelectRows: uint32
    Transactions: uint32
    SQLPrepares: uint32
    ExecDirects: uint32
    SQLExecutes: uint32
    CursorOpens: uint32
    CursorSize: uint32
    CursorUsed: uint32
    PercentCursorUsed: float64
    AvgFetchTime: float64
    AvgCursorSize: float64
    AvgCursorUsed: float64
    SQLFetchTime: uint32
    SQLFetchCount: uint32
    CurrentStmtCount: uint32
    MaxOpenStmt: uint32
    SumOpenStmt: uint32
    CurrentConnectionCount: uint32
    MaxConnectionsOpened: uint32
    SumConnectionsOpened: uint32
    SumConnectiontime: uint32
    AvgTimeOpened: float64
    ServerRndTrips: uint32
    BuffersSent: uint32
    BuffersRec: uint32
    BytesSent: uint32
    BytesRec: uint32
    msExecutionTime: uint32
    msNetWorkServerTime: uint32
struct SQLPERF
{
    uint TimerResolution;
    uint SQLidu;
    uint SQLiduRows;
    uint SQLSelects;
    uint SQLSelectRows;
    uint Transactions;
    uint SQLPrepares;
    uint ExecDirects;
    uint SQLExecutes;
    uint CursorOpens;
    uint CursorSize;
    uint CursorUsed;
    double PercentCursorUsed;
    double AvgFetchTime;
    double AvgCursorSize;
    double AvgCursorUsed;
    uint SQLFetchTime;
    uint SQLFetchCount;
    uint CurrentStmtCount;
    uint MaxOpenStmt;
    uint SumOpenStmt;
    uint CurrentConnectionCount;
    uint MaxConnectionsOpened;
    uint SumConnectionsOpened;
    uint SumConnectiontime;
    double AvgTimeOpened;
    uint ServerRndTrips;
    uint BuffersSent;
    uint BuffersRec;
    uint BytesSent;
    uint BytesRec;
    uint msExecutionTime;
    uint msNetWorkServerTime;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SQLPERF サイズ: 160 バイト(x64)
dim st, 40    ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; TimerResolution : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SQLidu : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; SQLiduRows : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SQLSelects : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; SQLSelectRows : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Transactions : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; SQLPrepares : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ExecDirects : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; SQLExecutes : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; CursorOpens : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; CursorSize : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; CursorUsed : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; PercentCursorUsed : DOUBLE (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; AvgFetchTime : DOUBLE (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; AvgCursorSize : DOUBLE (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; AvgCursorUsed : DOUBLE (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; SQLFetchTime : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; SQLFetchCount : DWORD (+84, 4byte)  st.21 = 値  /  値 = st.21   (lpoke/lpeek も可)
; CurrentStmtCount : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; MaxOpenStmt : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; SumOpenStmt : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; CurrentConnectionCount : DWORD (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; MaxConnectionsOpened : DWORD (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; SumConnectionsOpened : DWORD (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; SumConnectiontime : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; AvgTimeOpened : DOUBLE (+120, 8byte)  qpoke st,120,値 / qpeek(st,120)  ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; ServerRndTrips : DWORD (+128, 4byte)  st.32 = 値  /  値 = st.32   (lpoke/lpeek も可)
; BuffersSent : DWORD (+132, 4byte)  st.33 = 値  /  値 = st.33   (lpoke/lpeek も可)
; BuffersRec : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; BytesSent : DWORD (+140, 4byte)  st.35 = 値  /  値 = st.35   (lpoke/lpeek も可)
; BytesRec : DWORD (+144, 4byte)  st.36 = 値  /  値 = st.36   (lpoke/lpeek も可)
; msExecutionTime : DWORD (+148, 4byte)  st.37 = 値  /  値 = st.37   (lpoke/lpeek も可)
; msNetWorkServerTime : DWORD (+152, 4byte)  st.38 = 値  /  値 = st.38   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SQLPERF
    #field int TimerResolution
    #field int SQLidu
    #field int SQLiduRows
    #field int SQLSelects
    #field int SQLSelectRows
    #field int Transactions
    #field int SQLPrepares
    #field int ExecDirects
    #field int SQLExecutes
    #field int CursorOpens
    #field int CursorSize
    #field int CursorUsed
    #field double PercentCursorUsed
    #field double AvgFetchTime
    #field double AvgCursorSize
    #field double AvgCursorUsed
    #field int SQLFetchTime
    #field int SQLFetchCount
    #field int CurrentStmtCount
    #field int MaxOpenStmt
    #field int SumOpenStmt
    #field int CurrentConnectionCount
    #field int MaxConnectionsOpened
    #field int SumConnectionsOpened
    #field int SumConnectiontime
    #field double AvgTimeOpened
    #field int ServerRndTrips
    #field int BuffersSent
    #field int BuffersRec
    #field int BytesSent
    #field int BytesRec
    #field int msExecutionTime
    #field int msNetWorkServerTime
#endstruct

stdim st, SQLPERF        ; NSTRUCT 変数を確保
st->TimerResolution = 100
mes "TimerResolution=" + st->TimerResolution