ホーム › Devices.Usb › USB_DEVICE_PERFORMANCE_INFO
USB_DEVICE_PERFORMANCE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| BulkBytes | DWORD | 4 | +0 | +0 | バルク転送の総バイト数。 |
| ControlDataBytes | DWORD | 4 | +4 | +4 | コントロール転送のデータバイト数。 |
| IsoBytes | DWORD | 4 | +8 | +8 | アイソクロナス転送の総バイト数。 |
| InterruptBytes | DWORD | 4 | +12 | +12 | インタラプト転送の総バイト数。 |
| BulkUrbCount | DWORD | 4 | +16 | +16 | バルク転送のURB数。 |
| ControlUrbCount | DWORD | 4 | +20 | +20 | コントロール転送のURB数。 |
| IsoUrbCount | DWORD | 4 | +24 | +24 | アイソクロナス転送のURB数。 |
| InterruptUrbCount | DWORD | 4 | +28 | +28 | インタラプト転送のURB数。 |
| AllocedInterrupt | DWORD | 24 | +32 | +32 | 割り当て済みインタラプト帯域。 |
| AllocedIso | DWORD | 4 | +56 | +56 | 割り当て済みアイソクロナス帯域。 |
| Total32secBandwidth | DWORD | 4 | +60 | +60 | 直近32秒間の総帯域使用量。 |
| TotalTtBandwidth | DWORD | 4 | +64 | +64 | トランザクショントランスレータの総帯域。 |
| DeviceDescription | WCHAR | 120 | +68 | +68 | デバイス説明のワイド文字列。 |
| DeviceSpeed | USB_DEVICE_SPEED | 4 | +188 | +188 | デバイスの動作速度(USB_DEVICE_SPEED列挙)。 |
| TotalIsoLatency | DWORD | 4 | +192 | +192 | アイソクロナス転送の総レイテンシ。 |
| DroppedIsoPackets | DWORD | 4 | +196 | +196 | 破棄されたアイソクロナスパケット数。 |
| TransferErrors | DWORD | 4 | +200 | +200 | 発生した転送エラーの総数。 |
| PciInterruptCount | DWORD | 4 | +204 | +204 | PCI割り込みの発生回数。 |
| HcIdleState | DWORD | 4 | +208 | +208 | ホストコントローラのアイドル状態値。 |
| HcAsyncIdleState | DWORD | 4 | +212 | +212 | 非同期スケジュールのアイドル状態値。 |
| HcAsyncCacheFlushCount | DWORD | 4 | +216 | +216 | 非同期キャッシュフラッシュ回数。 |
| HcPeriodicIdleState | DWORD | 4 | +220 | +220 | 周期スケジュールのアイドル状態値。 |
| HcPeriodicCacheFlushCount | DWORD | 4 | +224 | +224 | 周期キャッシュフラッシュ回数。 |
各言語での定義
#include <windows.h>
// USB_DEVICE_PERFORMANCE_INFO (x64 228 / x86 228 バイト)
#pragma pack(push, 1)
typedef struct USB_DEVICE_PERFORMANCE_INFO {
DWORD BulkBytes;
DWORD ControlDataBytes;
DWORD IsoBytes;
DWORD InterruptBytes;
DWORD BulkUrbCount;
DWORD ControlUrbCount;
DWORD IsoUrbCount;
DWORD InterruptUrbCount;
DWORD AllocedInterrupt[6];
DWORD AllocedIso;
DWORD Total32secBandwidth;
DWORD TotalTtBandwidth;
WCHAR DeviceDescription[60];
USB_DEVICE_SPEED DeviceSpeed;
DWORD TotalIsoLatency;
DWORD DroppedIsoPackets;
DWORD TransferErrors;
DWORD PciInterruptCount;
DWORD HcIdleState;
DWORD HcAsyncIdleState;
DWORD HcAsyncCacheFlushCount;
DWORD HcPeriodicIdleState;
DWORD HcPeriodicCacheFlushCount;
} USB_DEVICE_PERFORMANCE_INFO;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_DEVICE_PERFORMANCE_INFO
{
public uint BulkBytes;
public uint ControlDataBytes;
public uint IsoBytes;
public uint InterruptBytes;
public uint BulkUrbCount;
public uint ControlUrbCount;
public uint IsoUrbCount;
public uint InterruptUrbCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public uint[] AllocedInterrupt;
public uint AllocedIso;
public uint Total32secBandwidth;
public uint TotalTtBandwidth;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 60)] public string DeviceDescription;
public int DeviceSpeed;
public uint TotalIsoLatency;
public uint DroppedIsoPackets;
public uint TransferErrors;
public uint PciInterruptCount;
public uint HcIdleState;
public uint HcAsyncIdleState;
public uint HcAsyncCacheFlushCount;
public uint HcPeriodicIdleState;
public uint HcPeriodicCacheFlushCount;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_DEVICE_PERFORMANCE_INFO
Public BulkBytes As UInteger
Public ControlDataBytes As UInteger
Public IsoBytes As UInteger
Public InterruptBytes As UInteger
Public BulkUrbCount As UInteger
Public ControlUrbCount As UInteger
Public IsoUrbCount As UInteger
Public InterruptUrbCount As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public AllocedInterrupt() As UInteger
Public AllocedIso As UInteger
Public Total32secBandwidth As UInteger
Public TotalTtBandwidth As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=60)> Public DeviceDescription As String
Public DeviceSpeed As Integer
Public TotalIsoLatency As UInteger
Public DroppedIsoPackets As UInteger
Public TransferErrors As UInteger
Public PciInterruptCount As UInteger
Public HcIdleState As UInteger
Public HcAsyncIdleState As UInteger
Public HcAsyncCacheFlushCount As UInteger
Public HcPeriodicIdleState As UInteger
Public HcPeriodicCacheFlushCount As UInteger
End Structureimport ctypes
from ctypes import wintypes
class USB_DEVICE_PERFORMANCE_INFO(ctypes.Structure):
_pack_ = 1
_fields_ = [
("BulkBytes", wintypes.DWORD),
("ControlDataBytes", wintypes.DWORD),
("IsoBytes", wintypes.DWORD),
("InterruptBytes", wintypes.DWORD),
("BulkUrbCount", wintypes.DWORD),
("ControlUrbCount", wintypes.DWORD),
("IsoUrbCount", wintypes.DWORD),
("InterruptUrbCount", wintypes.DWORD),
("AllocedInterrupt", wintypes.DWORD * 6),
("AllocedIso", wintypes.DWORD),
("Total32secBandwidth", wintypes.DWORD),
("TotalTtBandwidth", wintypes.DWORD),
("DeviceDescription", ctypes.c_wchar * 60),
("DeviceSpeed", ctypes.c_int),
("TotalIsoLatency", wintypes.DWORD),
("DroppedIsoPackets", wintypes.DWORD),
("TransferErrors", wintypes.DWORD),
("PciInterruptCount", wintypes.DWORD),
("HcIdleState", wintypes.DWORD),
("HcAsyncIdleState", wintypes.DWORD),
("HcAsyncCacheFlushCount", wintypes.DWORD),
("HcPeriodicIdleState", wintypes.DWORD),
("HcPeriodicCacheFlushCount", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct USB_DEVICE_PERFORMANCE_INFO {
pub BulkBytes: u32,
pub ControlDataBytes: u32,
pub IsoBytes: u32,
pub InterruptBytes: u32,
pub BulkUrbCount: u32,
pub ControlUrbCount: u32,
pub IsoUrbCount: u32,
pub InterruptUrbCount: u32,
pub AllocedInterrupt: [u32; 6],
pub AllocedIso: u32,
pub Total32secBandwidth: u32,
pub TotalTtBandwidth: u32,
pub DeviceDescription: [u16; 60],
pub DeviceSpeed: i32,
pub TotalIsoLatency: u32,
pub DroppedIsoPackets: u32,
pub TransferErrors: u32,
pub PciInterruptCount: u32,
pub HcIdleState: u32,
pub HcAsyncIdleState: u32,
pub HcAsyncCacheFlushCount: u32,
pub HcPeriodicIdleState: u32,
pub HcPeriodicCacheFlushCount: u32,
}import "golang.org/x/sys/windows"
type USB_DEVICE_PERFORMANCE_INFO struct {
BulkBytes uint32
ControlDataBytes uint32
IsoBytes uint32
InterruptBytes uint32
BulkUrbCount uint32
ControlUrbCount uint32
IsoUrbCount uint32
InterruptUrbCount uint32
AllocedInterrupt [6]uint32
AllocedIso uint32
Total32secBandwidth uint32
TotalTtBandwidth uint32
DeviceDescription [60]uint16
DeviceSpeed int32
TotalIsoLatency uint32
DroppedIsoPackets uint32
TransferErrors uint32
PciInterruptCount uint32
HcIdleState uint32
HcAsyncIdleState uint32
HcAsyncCacheFlushCount uint32
HcPeriodicIdleState uint32
HcPeriodicCacheFlushCount uint32
}type
USB_DEVICE_PERFORMANCE_INFO = packed record
BulkBytes: DWORD;
ControlDataBytes: DWORD;
IsoBytes: DWORD;
InterruptBytes: DWORD;
BulkUrbCount: DWORD;
ControlUrbCount: DWORD;
IsoUrbCount: DWORD;
InterruptUrbCount: DWORD;
AllocedInterrupt: array[0..5] of DWORD;
AllocedIso: DWORD;
Total32secBandwidth: DWORD;
TotalTtBandwidth: DWORD;
DeviceDescription: array[0..59] of WideChar;
DeviceSpeed: Integer;
TotalIsoLatency: DWORD;
DroppedIsoPackets: DWORD;
TransferErrors: DWORD;
PciInterruptCount: DWORD;
HcIdleState: DWORD;
HcAsyncIdleState: DWORD;
HcAsyncCacheFlushCount: DWORD;
HcPeriodicIdleState: DWORD;
HcPeriodicCacheFlushCount: DWORD;
end;const USB_DEVICE_PERFORMANCE_INFO = extern struct {
BulkBytes: u32,
ControlDataBytes: u32,
IsoBytes: u32,
InterruptBytes: u32,
BulkUrbCount: u32,
ControlUrbCount: u32,
IsoUrbCount: u32,
InterruptUrbCount: u32,
AllocedInterrupt: [6]u32,
AllocedIso: u32,
Total32secBandwidth: u32,
TotalTtBandwidth: u32,
DeviceDescription: [60]u16,
DeviceSpeed: i32,
TotalIsoLatency: u32,
DroppedIsoPackets: u32,
TransferErrors: u32,
PciInterruptCount: u32,
HcIdleState: u32,
HcAsyncIdleState: u32,
HcAsyncCacheFlushCount: u32,
HcPeriodicIdleState: u32,
HcPeriodicCacheFlushCount: u32,
};type
USB_DEVICE_PERFORMANCE_INFO {.packed.} = object
BulkBytes: uint32
ControlDataBytes: uint32
IsoBytes: uint32
InterruptBytes: uint32
BulkUrbCount: uint32
ControlUrbCount: uint32
IsoUrbCount: uint32
InterruptUrbCount: uint32
AllocedInterrupt: array[6, uint32]
AllocedIso: uint32
Total32secBandwidth: uint32
TotalTtBandwidth: uint32
DeviceDescription: array[60, uint16]
DeviceSpeed: int32
TotalIsoLatency: uint32
DroppedIsoPackets: uint32
TransferErrors: uint32
PciInterruptCount: uint32
HcIdleState: uint32
HcAsyncIdleState: uint32
HcAsyncCacheFlushCount: uint32
HcPeriodicIdleState: uint32
HcPeriodicCacheFlushCount: uint32align(1)
struct USB_DEVICE_PERFORMANCE_INFO
{
uint BulkBytes;
uint ControlDataBytes;
uint IsoBytes;
uint InterruptBytes;
uint BulkUrbCount;
uint ControlUrbCount;
uint IsoUrbCount;
uint InterruptUrbCount;
uint[6] AllocedInterrupt;
uint AllocedIso;
uint Total32secBandwidth;
uint TotalTtBandwidth;
wchar[60] DeviceDescription;
int DeviceSpeed;
uint TotalIsoLatency;
uint DroppedIsoPackets;
uint TransferErrors;
uint PciInterruptCount;
uint HcIdleState;
uint HcAsyncIdleState;
uint HcAsyncCacheFlushCount;
uint HcPeriodicIdleState;
uint HcPeriodicCacheFlushCount;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_DEVICE_PERFORMANCE_INFO サイズ: 228 バイト(x64)
dim st, 57 ; 4byte整数×57(構造体サイズ 228 / 4 切り上げ)
; BulkBytes : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ControlDataBytes : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; IsoBytes : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; InterruptBytes : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; BulkUrbCount : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ControlUrbCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; IsoUrbCount : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; InterruptUrbCount : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; AllocedInterrupt : DWORD (+32, 24byte) varptr(st)+32 を基点に操作(24byte:入れ子/配列)
; AllocedIso : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; Total32secBandwidth : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; TotalTtBandwidth : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; DeviceDescription : WCHAR (+68, 120byte) varptr(st)+68 を基点に操作(120byte:入れ子/配列)
; DeviceSpeed : USB_DEVICE_SPEED (+188, 4byte) st.47 = 値 / 値 = st.47 (lpoke/lpeek も可)
; TotalIsoLatency : DWORD (+192, 4byte) st.48 = 値 / 値 = st.48 (lpoke/lpeek も可)
; DroppedIsoPackets : DWORD (+196, 4byte) st.49 = 値 / 値 = st.49 (lpoke/lpeek も可)
; TransferErrors : DWORD (+200, 4byte) st.50 = 値 / 値 = st.50 (lpoke/lpeek も可)
; PciInterruptCount : DWORD (+204, 4byte) st.51 = 値 / 値 = st.51 (lpoke/lpeek も可)
; HcIdleState : DWORD (+208, 4byte) st.52 = 値 / 値 = st.52 (lpoke/lpeek も可)
; HcAsyncIdleState : DWORD (+212, 4byte) st.53 = 値 / 値 = st.53 (lpoke/lpeek も可)
; HcAsyncCacheFlushCount : DWORD (+216, 4byte) st.54 = 値 / 値 = st.54 (lpoke/lpeek も可)
; HcPeriodicIdleState : DWORD (+220, 4byte) st.55 = 値 / 値 = st.55 (lpoke/lpeek も可)
; HcPeriodicCacheFlushCount : DWORD (+224, 4byte) st.56 = 値 / 値 = st.56 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_DEVICE_PERFORMANCE_INFO, pack=1
#field int BulkBytes
#field int ControlDataBytes
#field int IsoBytes
#field int InterruptBytes
#field int BulkUrbCount
#field int ControlUrbCount
#field int IsoUrbCount
#field int InterruptUrbCount
#field int AllocedInterrupt 6
#field int AllocedIso
#field int Total32secBandwidth
#field int TotalTtBandwidth
#field wchar DeviceDescription 60
#field int DeviceSpeed
#field int TotalIsoLatency
#field int DroppedIsoPackets
#field int TransferErrors
#field int PciInterruptCount
#field int HcIdleState
#field int HcAsyncIdleState
#field int HcAsyncCacheFlushCount
#field int HcPeriodicIdleState
#field int HcPeriodicCacheFlushCount
#endstruct
stdim st, USB_DEVICE_PERFORMANCE_INFO ; NSTRUCT 変数を確保
st->BulkBytes = 100
mes "BulkBytes=" + st->BulkBytes