Why one core becomes the bottleneck
When a network adapter receives packets, it raises an interrupt. Windows then does the actual work in a DPC (deferred procedure call) on the same core. If the adapter has only one receive queue, all of these DPCs run on a single core. Receive Side Scaling (RSS) can only spread the load when there are several queues.
Task Manager often shows a harmless total load. With 8 vCPUs, one core at full load is only 12.5 % of the total. Packets still pile up, and programs that want to run on that core have to wait. Typical effects are lag in remote sessions, choppy screen updates, slow file transfers and packet loss under load.
Proxmox: only one queue by default
In Proxmox VE every VirtIO network device has exactly one queue by default, as long as the Multiqueue field is empty. All network interrupts and DPCs of the VM then land on one vCPU, no matter how many cores the VM has. This mainly affects VMs with a lot of network traffic, such as terminal servers, file servers, database and web servers.
The fix is the Multiqueue setting:
- In the Proxmox web interface: VM → Hardware → network device → Edit → tick Advanced → set Multiqueue to the number of vCPUs. The number of vCPUs is sockets × cores. The GUI allows up to 8, the command line up to 16.
- Or on the command line. Read the existing line with
qm configand reuse it unchanged with,queues=Nadded, so the MAC address stays the same:
qm config 101 | grep ^net # net0: virtio=BC:24:11:12:34:56,bridge=vmbr0,firewall=1 qm set 101 --net0 virtio=BC:24:11:12:34:56,bridge=vmbr0,firewall=1,queues=4
- Shut the VM down and start it again from Proxmox. A reboot inside the guest is not enough.
- Use a current VirtIO driver (virtio-win) in the Windows guest. In Device Manager, under the network adapter → Advanced, Receive Side Scaling must be enabled. Check in PowerShell:
Get-NetAdapterRss.
You can see whether it worked in Device Manager under View → Resources by type → Interrupt request (IRQ). With one queue the VirtIO adapter has only a few entries there. With multiqueue there are about two per queue (send and receive) plus a few more. irqtop shows it most clearly: under load the network DPCs spread across several cores.
More queues also mean a little more CPU load on the host and in the guest, so the setting pays off mainly for VMs with heavy network traffic. The same principle applies to other hypervisors and to physical servers where RSS is disabled or the driver offers only one queue.
Download irqtop
Download irqtop.exe Source code as ZIP
| File | Size | SHA-256 |
|---|---|---|
irqtop.exe (version 1.2, Windows x64) | 1850 KB | 6c2dd4c34839d36e4de51fd1b103a36eb0395a2343e0c306ea25aeb160edf6f3 |
irqtop-1.2-source.zip | 9 KB | d0837c51048fdfad30992599f2425f4e285c4a04ba33d5e0cd3382a0108d4076 |
Check the hash after downloading, in PowerShell:
(Get-FileHash .\irqtop.exe -Algorithm SHA256).Hash -eq '6c2dd4c34839d36e4de51fd1b103a36eb0395a2343e0c306ea25aeb160edf6f3'
irqtop is a single file, no installation needed. It only reads performance counters and the process list: it changes no settings, writes nothing except the optional CSV file and opens no network connections. The file is not signed, so Windows SmartScreen may warn on first start. Click More info → Run anyway, or build it yourself from source (see below).
Usage
Open a command prompt or PowerShell, make the window at least 120 characters wide and start irqtop. Started as administrator, it also shows the user for every process. The output language follows Windows; -lang en or -lang de overrides it.
irqtop.exe # live, refresh every second irqtop.exe -i 2 # every 2 seconds irqtop.exe -n 60 -csv measurement.csv # 60 samples, then exit, values to CSV irqtop.exe -p 20 # show 20 instead of 12 processes irqtop.exe -lang en # English output
| Option | Meaning | Default |
|---|---|---|
-i | sample interval in seconds (at least 0.2) | 1 |
-n | number of samples, then exit | 0 = endless |
-p | number of processes shown | 12 |
-csv | write values per core to a CSV file (semicolon, for Excel). A second file …_processes.csv is created as well. | off |
-lang | output language: de or en | Windows language |
Quit with Ctrl+C. A measurement taken while the problem occurs is the most useful, so under real load or during a large file transfer.
Reading the output
Schematic, shortened example of a VM with 4 vCPUs and only one queue:
Core Load% Int% DPC% Interrupts/s DPCs/s Share of all DPCs 0 96.0 ███████████▌ 12.4 61.3 18450 17210 ███████████████░ 94 % 1 22.5 ██▋ 0.3 0.8 610 380 ░░░░░░░░░░░░░░░░ 2 % 2 18.1 ██▏ 0.2 0.6 540 350 ░░░░░░░░░░░░░░░░ 2 % 3 20.7 ██▌ 0.2 0.5 520 320 ░░░░░░░░░░░░░░░░ 2 % Network DPCs per core – Red Hat VirtIO Ethernet Adapter ... Verdict: 97 % of network DPCs run on core 0 (Red Hat VirtIO Ethernet Adapter). → Network load is stuck on one core. Probably only one queue active (check multiqueue/RSS).
| Section | What it shows |
|---|---|
| Core table | Load per core with a bar (yellow from 70 %, red from 90 %), share of time spent on interrupts and DPCs, interrupts and DPCs per second and the core's share of all DPCs. |
| Network DPCs per core | For every adapter with traffic: on which cores its DPCs, interrupts and received packets are processed. |
| Network adapters | Received and sent Mbit/s and packets per second. |
| Processes with waiting threads | Processes whose threads want to run but get no CPU, plus the total queue. Constantly more than two waiting threads per core means the CPU is the bottleneck. |
| Verdict | From 60 % of all network DPCs on one core, irqtop reports in red that the network load is stuck on one core. |
irqtop cannot show which process is waiting for packets. Packets pile up in the kernel before any process sees them. What you can see is the effect: one core is busy with network DPCs, and processes that want to run there have to wait.
Compare before and after
With -csv you can prove the effect of multiqueue. Before the change, run for example irqtop.exe -n 300 -csv before.csv under load, and the same with after.csv afterwards. A pivot table in Excel with core and net DPCs/s shows immediately whether the load is spread.
Build it yourself
If you prefer not to run someone else's EXE, build irqtop with Go yourself, on Windows, Linux or macOS. With Go 1.24.7 and these options you get exactly the file with the hash above:
# Linux/macOS GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags "-s -w -buildid=" -o irqtop.exe . # Windows (PowerShell) $env:GOOS="windows"; $env:GOARCH="amd64"; $env:CGO_ENABLED="0" go build -trimpath -buildvcs=false -ldflags "-s -w -buildid=" -o irqtop.exe .
For Windows on ARM set GOARCH=arm64. That variant is untested: irqtop reads the process list using fixed offsets of the 64-bit structures.
Source code
The complete source code (768 lines of Go), identical to the content of the ZIP file. The comments in the code are in German. irqtop uses only built-in Windows components: pdh.dll for the performance counters with English names (so it also works on non-English Windows), NtQuerySystemInformation for processes and threads, wtsapi32.dll for the user names of sessions.
go.mod (3 lines)
module irqtop go 1.24
main.go (615 lines)
//go:build windows
// IrqTop – zeigt Interrupts und DPCs pro CPU-Kern live an (ähnlich top/ntop).
// Nutzt die Windows-Leistungsindikatoren (PDH) mit englischen Counter-Namen,
// funktioniert daher auch auf deutschem Windows.
//
// IrqTop – live view of interrupts and DPCs per CPU core (like top/ntop).
//
// Quelle / source: https://www.hollop.net/irqtop-windows-network-dpc.html
// Nutzung auf eigene Gefahr, ohne Gewähr. / Use at your own risk, no warranty.
// Liest nur Leistungsindikatoren und Prozesslisten, ändert nichts am System.
// Read-only: queries performance counters and the process list, changes nothing.
package main
import (
"bufio"
"flag"
"fmt"
"math"
"os"
"os/signal"
"runtime"
"sort"
"strconv"
"strings"
"syscall"
"time"
"unsafe"
)
const version = "1.2"
var (
pdh = syscall.NewLazyDLL("pdh.dll")
procOpenQuery = pdh.NewProc("PdhOpenQueryW")
procAddEnglish = pdh.NewProc("PdhAddEnglishCounterW")
procCollect = pdh.NewProc("PdhCollectQueryData")
procGetArray = pdh.NewProc("PdhGetFormattedCounterArrayW")
procCloseQuery = pdh.NewProc("PdhCloseQuery")
kernel32 = syscall.NewLazyDLL("kernel32.dll")
procGetStdHandle = kernel32.NewProc("GetStdHandle")
procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
procSetOutputCP = kernel32.NewProc("SetConsoleOutputCP")
procUILang = kernel32.NewProc("GetUserDefaultUILanguage")
)
const (
pdhFmtDouble = 0x00000200
pdhFmtNoCap100 = 0x00008000
pdhMoreData = 0x800007D2
)
// PDH_FMT_COUNTERVALUE_ITEM_W (64 Bit)
type fmtItem struct {
name *uint16
status uint32
_ uint32
value float64
}
// ---------- Sprache ----------
// en ist true für englische Ausgabe: per -lang en|de oder automatisch nach der
// Windows-Anzeigesprache (Deutsch → de, sonst en).
var en = detectEN()
func detectEN() bool {
for i, a := range os.Args[1:] {
a = strings.TrimLeft(a, "-")
if strings.HasPrefix(a, "lang=") {
return !strings.EqualFold(strings.TrimPrefix(a, "lang="), "de")
}
if a == "lang" && i+2 < len(os.Args) {
return !strings.EqualFold(os.Args[i+2], "de")
}
}
id, _, _ := procUILang.Call()
return id&0x3FF != 0x07 // LANG_GERMAN
}
// T wählt den deutschen oder englischen Text.
func T(de, en_ string) string {
if en {
return en_
}
return de
}
func utf16ptr(p *uint16) string {
if p == nil {
return ""
}
var s []uint16
for ptr := unsafe.Pointer(p); ; ptr = unsafe.Add(ptr, 2) {
c := *(*uint16)(ptr)
if c == 0 {
break
}
s = append(s, c)
}
return syscall.UTF16ToString(s)
}
type counter struct {
h uintptr
ok bool
}
func addCounter(q uintptr, path string) counter {
var h uintptr
p, _ := syscall.UTF16PtrFromString(path)
r, _, _ := procAddEnglish.Call(q, uintptr(unsafe.Pointer(p)), 0, uintptr(unsafe.Pointer(&h)))
return counter{h: h, ok: r == 0}
}
func readArray(c counter) map[string]float64 {
m := map[string]float64{}
if !c.ok {
return m
}
var size, count uint32
r, _, _ := procGetArray.Call(c.h, pdhFmtDouble|pdhFmtNoCap100,
uintptr(unsafe.Pointer(&size)), uintptr(unsafe.Pointer(&count)), 0)
if uint32(r) != pdhMoreData || size == 0 {
return m
}
buf := make([]byte, size+16)
r, _, _ = procGetArray.Call(c.h, pdhFmtDouble|pdhFmtNoCap100,
uintptr(unsafe.Pointer(&size)), uintptr(unsafe.Pointer(&count)), uintptr(unsafe.Pointer(&buf[0])))
if r != 0 || count == 0 {
return m
}
items := unsafe.Slice((*fmtItem)(unsafe.Pointer(&buf[0])), count)
for _, it := range items {
if it.status == 0 || it.status == 1 {
v := it.value
if math.IsNaN(v) || math.IsInf(v, 0) {
v = 0
}
m[utf16ptr(it.name)] += v
}
}
runtime.KeepAlive(buf)
return m
}
func enableVT() {
h, _, _ := procGetStdHandle.Call(uintptr(0xFFFFFFF5)) // STD_OUTPUT_HANDLE
var mode uint32
if r, _, _ := procGetConsoleMode.Call(h, uintptr(unsafe.Pointer(&mode))); r != 0 {
procSetConsoleMode.Call(h, uintptr(mode|0x0004)) // ENABLE_VIRTUAL_TERMINAL_PROCESSING
}
procSetOutputCP.Call(65001)
}
// ---------- Darstellung ----------
const (
cReset = "\x1b[0m"
cBold = "\x1b[1m"
cDim = "\x1b[2m"
cRed = "\x1b[31m"
cGreen = "\x1b[32m"
cYellow = "\x1b[33m"
cCyan = "\x1b[36m"
)
func bar(share float64, width int) string {
if share < 0 {
share = 0
}
if share > 1 {
share = 1
}
n := int(math.Round(share * float64(width)))
return strings.Repeat("█", n) + strings.Repeat("░", width-n)
}
func colorFor(share float64, cores int) string {
if cores < 2 {
return ""
}
avg := 1.0 / float64(cores)
switch {
case share >= 0.6:
return cRed
case share >= 2*avg:
return cYellow
}
return cGreen
}
func loadColor(v float64) string {
switch {
case v >= 90:
return cRed
case v >= 70:
return cYellow
}
return cGreen
}
func trunc(s string, n int) string {
r := []rune(s)
if len(r) <= n {
return s
}
return string(r[:n-1]) + "…"
}
func num(v float64) string {
return strconv.FormatFloat(v, 'f', 0, 64)
}
func de(v float64, prec int) string {
s := strconv.FormatFloat(v, 'f', prec, 64)
if en {
return s
}
return strings.Replace(s, ".", ",", 1)
}
type nicCPU struct {
dpcs, ints, pkts float64
}
func main() {
interval := flag.Float64("i", 1, T("Messintervall in Sekunden", "Sample interval in seconds"))
csvPath := flag.String("csv", "", T("Werte zusätzlich in diese CSV-Datei schreiben (Semikolon, für Excel)", "Also write values to this CSV file (semicolon separated, for Excel)"))
samples := flag.Int("n", 0, T("Anzahl Messungen, danach beenden (0 = endlos)", "Number of samples, then exit (0 = endless)"))
flag.String("lang", "", T("Sprache der Ausgabe: de oder en (Standard: Windows-Sprache)", "Output language: de or en (default: Windows display language)"))
topN := flag.Int("p", 12, T("Anzahl der angezeigten Prozesse", "Number of processes shown"))
flag.Usage = func() {
fmt.Fprintf(os.Stderr, T("IrqTop %s – Interrupts und DPCs pro CPU-Kern\n\nAufruf: irqtop.exe [-i 1] [-n 0] [-p 12] [-csv datei.csv]\n\n", "IrqTop %s – interrupts and DPCs per CPU core\n\nUsage: irqtop.exe [-i 1] [-n 0] [-p 12] [-csv file.csv] [-lang de|en]\n\n"), version)
flag.PrintDefaults()
}
flag.Parse()
if *interval < 0.2 {
*interval = 0.2
}
enableVT()
var q uintptr
if r, _, _ := procOpenQuery.Call(0, 0, uintptr(unsafe.Pointer(&q))); r != 0 {
fmt.Fprintf(os.Stderr, T("PdhOpenQuery fehlgeschlagen: 0x%X\n", "PdhOpenQuery failed: 0x%X\n"), r)
os.Exit(1)
}
defer procCloseQuery.Call(q)
cpuLoad := addCounter(q, `\Processor(*)\% Processor Time`)
cpuInt := addCounter(q, `\Processor(*)\% Interrupt Time`)
cpuDpc := addCounter(q, `\Processor(*)\% DPC Time`)
cpuInts := addCounter(q, `\Processor(*)\Interrupts/sec`)
cpuDpcs := addCounter(q, `\Processor(*)\DPCs Queued/sec`)
nicRx := addCounter(q, `\Network Interface(*)\Bytes Received/sec`)
nicTx := addCounter(q, `\Network Interface(*)\Bytes Sent/sec`)
nicPRx := addCounter(q, `\Network Interface(*)\Packets Received/sec`)
nicPTx := addCounter(q, `\Network Interface(*)\Packets Sent/sec`)
ppDpcs := addCounter(q, `\Per Processor Network Interface Card Activity(*)\DPCs Queued/sec`)
ppInts := addCounter(q, `\Per Processor Network Interface Card Activity(*)\Interrupts/sec`)
ppPkts := addCounter(q, `\Per Processor Network Interface Card Activity(*)\Received Packets/sec`)
if !cpuLoad.ok || !cpuDpcs.ok {
fmt.Fprintln(os.Stderr, T("Die Leistungsindikatoren für Prozessoren sind nicht verfügbar.", "The processor performance counters are not available."))
fmt.Fprintln(os.Stderr, T("Ggf. mit 'lodctr /R' (als Administrator) neu aufbauen.", "Try rebuilding them with 'lodctr /R' (as administrator)."))
os.Exit(1)
}
var csvW, procCsvW *bufio.Writer
if *csvPath != "" {
f, err := os.OpenFile(*csvPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
fmt.Fprintf(os.Stderr, T("CSV-Datei kann nicht geöffnet werden: %v\n", "Cannot open CSV file: %v\n"), err)
os.Exit(1)
}
defer f.Close()
csvW = bufio.NewWriter(f)
if st, _ := f.Stat(); st != nil && st.Size() == 0 {
csvW.WriteString(T("Zeit;Kern;Last %;Interrupt %;DPC %;Interrupts/s;DPCs/s;Netz-DPCs/s;Netz-Interrupts/s;Pakete empf./s\r\n", "Time;Core;Load %;Interrupt %;DPC %;Interrupts/s;DPCs/s;Net DPCs/s;Net interrupts/s;Packets recv./s\r\n"))
}
defer csvW.Flush()
pPath := strings.TrimSuffix(*csvPath, ".csv") + T("_prozesse.csv", "_processes.csv")
pf, err := os.OpenFile(pPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err == nil {
defer pf.Close()
procCsvW = bufio.NewWriter(pf)
if st, _ := pf.Stat(); st != nil && st.Size() == 0 {
procCsvW.WriteString(T("Zeit;PID;Prozess;Benutzer;Sitzung;CPU %;Ø wartende Threads;max. wartende Threads;Zeitanteil wartend %\r\n", "Time;PID;Process;User;Session;CPU %;avg waiting threads;max waiting threads;time waiting %\r\n"))
}
defer procCsvW.Flush()
}
}
fmt.Print("\x1b[?25l\x1b[2J")
restore := func() { fmt.Print(cReset + "\x1b[?25h\n") }
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt)
go func() {
<-sig
if csvW != nil {
csvW.Flush()
}
if procCsvW != nil {
procCsvW.Flush()
}
restore()
os.Exit(0)
}()
defer restore()
procCollect.Call(q)
wait := time.Duration(*interval * float64(time.Second))
step := wait / 10
if step < 50*time.Millisecond {
step = 50 * time.Millisecond
}
numCPU := runtime.NumCPU()
prevCPU := map[procKey]int64{}
for k, v := range snapshotProcs() {
prevCPU[k] = v.cpu
}
prevTime := time.Now()
for n := 0; *samples == 0 || n < *samples; n++ {
// Prozess-Stichproben über das Intervall verteilt sammeln
acc := map[procKey]*procAcc{}
nSamples, totalReady := 0, 0
start := time.Now()
for time.Since(start) < wait {
time.Sleep(step)
snap := snapshotProcs()
if snap == nil {
continue
}
nSamples++
for k, sp := range snap {
a := acc[k]
if a == nil {
first := sp.cpu
if pc, ok := prevCPU[k]; ok {
first = pc
}
a = &procAcc{name: sp.name, session: sp.session, cpuFirst: first}
acc[k] = a
}
a.cpuLast = sp.cpu
a.samples++
a.readySum += sp.ready
if sp.ready > 0 {
a.hits++
}
if sp.ready > a.maxReady {
a.maxReady = sp.ready
}
totalReady += sp.ready
}
}
sampleEnd := time.Now()
elapsed := sampleEnd.Sub(prevTime).Seconds()
prevTime = sampleEnd
prevCPU = map[procKey]int64{}
var rows []procRow
for k, a := range acc {
prevCPU[k] = a.cpuLast
r := procRow{pid: k.pid, name: a.name, session: a.session, maxReady: a.maxReady}
if elapsed > 0 {
r.cpuPct = float64(a.cpuLast-a.cpuFirst) / (elapsed * 1e7 * float64(numCPU)) * 100
if r.cpuPct < 0 {
r.cpuPct = 0
}
}
if nSamples > 0 {
r.avgReady = float64(a.readySum) / float64(nSamples)
r.waitPct = float64(a.hits) / float64(nSamples) * 100
}
rows = append(rows, r)
}
sort.Slice(rows, func(i, j int) bool {
if rows[i].avgReady != rows[j].avgReady {
return rows[i].avgReady > rows[j].avgReady
}
return rows[i].cpuPct > rows[j].cpuPct
})
if len(rows) > *topN {
rows = rows[:*topN]
}
for i := range rows {
rows[i].user = sessionUser(rows[i].session)
}
avgQueue := 0.0
if nSamples > 0 {
avgQueue = float64(totalReady) / float64(nSamples)
}
procCollect.Call(q)
now := time.Now()
load, pInt, pDpc := readArray(cpuLoad), readArray(cpuInt), readArray(cpuDpc)
ints, dpcs := readArray(cpuInts), readArray(cpuDpcs)
// Kerne sortieren
var cores []int
for k := range load {
if c, err := strconv.Atoi(strings.TrimSpace(k)); err == nil {
cores = append(cores, c)
}
}
sort.Ints(cores)
// Netzwerk-Aktivität pro Kern und Adapter
pd, pi, pp := readArray(ppDpcs), readArray(ppInts), readArray(ppPkts)
perNic := map[string]map[int]*nicCPU{}
addPP := func(src map[string]float64, set func(*nicCPU, float64)) {
for k, v := range src {
parts := strings.SplitN(k, ",", 2)
if len(parts) != 2 {
continue
}
c, err := strconv.Atoi(strings.TrimSpace(parts[0]))
if err != nil {
continue
}
a := strings.TrimSpace(parts[1])
if perNic[a] == nil {
perNic[a] = map[int]*nicCPU{}
}
if perNic[a][c] == nil {
perNic[a][c] = &nicCPU{}
}
set(perNic[a][c], v)
}
}
addPP(pd, func(x *nicCPU, v float64) { x.dpcs += v })
addPP(pi, func(x *nicCPU, v float64) { x.ints += v })
addPP(pp, func(x *nicCPU, v float64) { x.pkts += v })
var b strings.Builder
w := func(format string, a ...any) { fmt.Fprintf(&b, format+"\x1b[K\n", a...) }
w(T("%sIrqTop %s%s – Interrupts und DPCs pro Kern %s%s · Intervall %s s · Strg+C beendet%s", "%sIrqTop %s%s – interrupts and DPCs per core %s%s · interval %s s · Ctrl+C quits%s"),
cBold, version, cReset, cDim, now.Format(T("02.01.2006 15:04:05", "2006-01-02 15:04:05")), de(*interval, 1), cReset)
w("")
// --- CPU-Tabelle ---
var sumDpcs float64
for _, c := range cores {
sumDpcs += dpcs[strconv.Itoa(c)]
}
w("%s%-5s %7s %-12s %7s %7s %14s %11s %-22s%s", cBold, T("Kern", "Core"), T("Last%", "Load%"), "", "Int%", "DPC%", "Interrupts/s", "DPCs/s", T("Anteil an allen DPCs", "Share of all DPCs"), cReset)
topCore, topShare := -1, 0.0
for _, c := range cores {
k := strconv.Itoa(c)
share := 0.0
if sumDpcs > 0 {
share = dpcs[k] / sumDpcs
}
if share > topShare {
topCore, topShare = c, share
}
col := colorFor(share, len(cores))
w("%-5d %7s %s%s%s %7s %7s %14s %11s %s%s %3.0f %%%s",
c, de(load[k], 1), loadColor(load[k]), bar(load[k]/100, 12), cReset,
de(pInt[k], 1), de(pDpc[k], 1), num(ints[k]), num(dpcs[k]),
col, bar(share, 16), share*100, cReset)
}
t := "_Total"
w("%s%-5s %7s %-12s %7s %7s %14s %11s%s", cDim, T("Summe", "Total"), de(load[t], 1), "", de(pInt[t], 1), de(pDpc[t], 1), num(ints[t]), num(dpcs[t]), cReset)
w("")
// --- Netzwerk pro Kern ---
var nicNames []string
for a := range perNic {
nicNames = append(nicNames, a)
}
sort.Strings(nicNames)
var verdictShare float64 = -1
verdictCore := -1
verdictNic := ""
shown := 0
for _, a := range nicNames {
var sum, sumPk float64
for _, x := range perNic[a] {
sum += x.dpcs
sumPk += x.pkts
}
if sum < 1 && sumPk < 1 {
continue
}
shown++
w(T("%sNetzwerk-DPCs pro Kern – %s%s", "%sNetwork DPCs per core – %s%s"), cBold, trunc(a, 60), cReset)
w("%s%-5s %11s %14s %16s %-22s%s", cBold, T("Kern", "Core"), "DPCs/s", "Interrupts/s", T("Pakete empf./s", "Packets recv./s"), T("Anteil Netz-DPCs", "Share of net DPCs"), cReset)
best, bestC := 0.0, -1
for _, c := range cores {
x := perNic[a][c]
if x == nil {
x = &nicCPU{}
}
share := 0.0
if sum > 0 {
share = x.dpcs / sum
}
if share > best {
best, bestC = share, c
}
col := colorFor(share, len(cores))
w("%-5d %11s %14s %16s %s%s %3.0f %%%s", c, num(x.dpcs), num(x.ints), num(x.pkts), col, bar(share, 16), share*100, cReset)
}
w("")
if best > verdictShare {
verdictShare, verdictCore, verdictNic = best, bestC, a
}
}
if !ppDpcs.ok {
w(T("%sNetzwerk-DPCs pro Kern: Leistungsindikator auf diesem System nicht verfügbar.%s", "%sNetwork DPCs per core: counter not available on this system.%s"), cDim, cReset)
w("")
} else if shown == 0 {
w(T("%sNetzwerk-DPCs pro Kern: derzeit kein Netzwerkverkehr gemessen.%s", "%sNetwork DPCs per core: no network traffic measured right now.%s"), cDim, cReset)
w("")
}
// --- Netzwerkkarten ---
rx, tx, prx, ptx := readArray(nicRx), readArray(nicTx), readArray(nicPRx), readArray(nicPTx)
var adapters []string
for a := range rx {
l := strings.ToLower(a)
if strings.Contains(l, "isatap") || strings.Contains(l, "teredo") || strings.Contains(l, "loopback") || strings.Contains(l, "6to4") {
continue
}
adapters = append(adapters, a)
}
sort.Strings(adapters)
if len(adapters) > 0 {
w("%s%-44s %13s %13s %13s %13s%s", cBold, T("Netzwerkkarte", "Network adapter"), T("Empf. Mbit/s", "Recv. Mbit/s"), T("Send. Mbit/s", "Sent Mbit/s"), T("Pakete ein/s", "Packets in/s"), T("Pakete aus/s", "Packets out/s"), cReset)
for _, a := range adapters {
w("%-44s %13s %13s %13s %13s", trunc(a, 44), de(rx[a]*8/1e6, 2), de(tx[a]*8/1e6, 2), num(prx[a]), num(ptx[a]))
}
w("")
}
// --- Prozesse ---
qCol := cGreen
if avgQueue > 2*float64(numCPU) {
qCol = cRed
} else if avgQueue > float64(numCPU) {
qCol = cYellow
}
w(T("%sProzesse mit wartenden Threads%s (bereit, aber keine CPU frei) Warteschlange gesamt: %sØ %s Threads%s bei %d Kernen", "%sProcesses with waiting threads%s (ready, but no CPU free) total queue: %savg %s threads%s on %d cores"),
cBold, cReset, qCol, de(avgQueue, 1), cReset, numCPU)
w("%s%-7s %-28s %-18s %7s %10s %6s %10s%s", cBold, "PID", T("Prozess", "Process"), T("Benutzer", "User"), "CPU %", T("Ø wartend", "avg wait"), "max.", T("Zeit wart.", "time wait"), cReset)
for _, r := range rows {
col := ""
if r.avgReady >= 1 {
col = cRed
} else if r.avgReady > 0.2 {
col = cYellow
}
w("%s%-7d %-28s %-18s %7s %10s %6d %9.0f %%%s", col, r.pid, trunc(r.name, 28), trunc(r.user, 18),
de(r.cpuPct, 1), de(r.avgReady, 2), r.maxReady, r.waitPct, cReset)
}
w("")
// --- Bewertung ---
if verdictShare >= 0 && len(cores) > 1 {
if verdictShare >= 0.6 {
w(T("%sBewertung: %.0f %% der Netzwerk-DPCs laufen auf Kern %d (%s).%s", "%sVerdict: %.0f %% of network DPCs run on core %d (%s).%s"), cRed+cBold, verdictShare*100, verdictCore, trunc(verdictNic, 40), cReset)
w(T("%s→ Netzwerklast hängt an einem Kern. Vermutlich nur eine Queue aktiv (Multiqueue/RSS prüfen).%s", "%s→ Network load is stuck on one core. Probably only one queue active (check multiqueue/RSS).%s"), cRed, cReset)
} else {
w(T("%sBewertung: Netzwerk-DPCs sind verteilt (größter Anteil %.0f %% auf Kern %d).%s", "%sVerdict: network DPCs are spread (largest share %.0f %% on core %d).%s"), cGreen+cBold, verdictShare*100, verdictCore, cReset)
}
} else if topCore >= 0 && len(cores) > 1 {
col := cGreen
if topShare >= 0.6 {
col = cRed
}
w(T("%sAlle DPCs: größter Anteil %.0f %% auf Kern %d.%s", "%sAll DPCs: largest share %.0f %% on core %d.%s"), col, topShare*100, topCore, cReset)
}
if csvW != nil {
w("%sCSV: %s%s", cDim, *csvPath, cReset)
}
fmt.Print("\x1b[H" + b.String() + "\x1b[J")
// --- CSV ---
if csvW != nil {
ts := now.Format("2006-01-02 15:04:05")
for _, c := range cores {
k := strconv.Itoa(c)
var nd, ni, np float64
for _, m := range perNic {
if x := m[c]; x != nil {
nd += x.dpcs
ni += x.ints
np += x.pkts
}
}
fmt.Fprintf(csvW, "%s;%d;%s;%s;%s;%s;%s;%s;%s;%s\r\n", ts, c,
de(load[k], 1), de(pInt[k], 1), de(pDpc[k], 1), num(ints[k]), num(dpcs[k]), num(nd), num(ni), num(np))
}
csvW.Flush()
}
if procCsvW != nil {
ts := now.Format("2006-01-02 15:04:05")
for _, r := range rows {
fmt.Fprintf(procCsvW, "%s;%d;%s;%s;%d;%s;%s;%d;%s\r\n", ts, r.pid, r.name, r.user, r.session,
de(r.cpuPct, 1), de(r.avgReady, 2), r.maxReady, de(r.waitPct, 0))
}
procCsvW.Flush()
}
}
}
procs.go (150 lines)
//go:build windows
package main
import (
"syscall"
"unsafe"
)
// Prozess- und Thread-Informationen über NtQuerySystemInformation(SystemProcessInformation).
// Daraus werden CPU-Zeit pro Prozess und die Zahl der Threads im Zustand
// "bereit" (Ready/Standby/DeferredReady) bestimmt – also Threads, die laufen
// wollen, aber gerade keine CPU bekommen.
var (
ntdll = syscall.NewLazyDLL("ntdll.dll")
procNtQSI = ntdll.NewProc("NtQuerySystemInformation")
wtsapi = syscall.NewLazyDLL("wtsapi32.dll")
procWTSQuery = wtsapi.NewProc("WTSQuerySessionInformationW")
procWTSFree = wtsapi.NewProc("WTSFreeMemory")
)
const (
systemProcessInformation = 5
statusInfoLengthMismatch = 0xC0000004
procInfoSize = 256 // SYSTEM_PROCESS_INFORMATION (x64)
threadInfoSize = 80 // SYSTEM_THREAD_INFORMATION (x64)
)
type procKey struct {
pid uintptr
create int64
}
type procSample struct {
name string
session uint32
cpu int64 // Kernel+User in 100 ns
threads int
ready int
}
var qsiBuf = make([]byte, 1<<20)
func snapshotProcs() map[procKey]procSample {
var ret uint32
for {
r, _, _ := procNtQSI.Call(systemProcessInformation,
uintptr(unsafe.Pointer(&qsiBuf[0])), uintptr(len(qsiBuf)), uintptr(unsafe.Pointer(&ret)))
if uint32(r) == statusInfoLengthMismatch {
n := len(qsiBuf) * 2
if int(ret) > n {
n = int(ret) + 65536
}
qsiBuf = make([]byte, n)
continue
}
if r != 0 {
return nil
}
break
}
out := make(map[procKey]procSample, 256)
base := unsafe.Pointer(&qsiBuf[0])
off := uintptr(0)
for {
p := unsafe.Add(base, off)
next := *(*uint32)(p)
nThreads := *(*uint32)(unsafe.Add(p, 4))
create := *(*int64)(unsafe.Add(p, 32))
user := *(*int64)(unsafe.Add(p, 40))
kern := *(*int64)(unsafe.Add(p, 48))
nameLen := *(*uint16)(unsafe.Add(p, 56))
nameBuf := *(**uint16)(unsafe.Add(p, 64))
pid := *(*uintptr)(unsafe.Add(p, 80))
session := *(*uint32)(unsafe.Add(p, 100))
if pid != 0 { // Leerlaufprozess auslassen
name := ""
if nameBuf != nil && nameLen > 0 {
name = syscall.UTF16ToString(unsafe.Slice(nameBuf, int(nameLen/2)))
}
if pid == 4 && name == "" {
name = "System"
}
ready := 0
th := unsafe.Add(p, procInfoSize)
for i := uint32(0); i < nThreads; i++ {
state := *(*uint32)(unsafe.Add(th, uintptr(i)*threadInfoSize+68))
// 1 Ready, 3 Standby, 7 DeferredReady
if state == 1 || state == 3 || state == 7 {
ready++
}
}
out[procKey{pid, create}] = procSample{name: name, session: session, cpu: user + kern, threads: int(nThreads), ready: ready}
}
if next == 0 {
break
}
off += uintptr(next)
}
return out
}
var sessionNames = map[uint32]string{}
func sessionUser(id uint32) string {
if id == 0 {
return T("Dienste", "Services")
}
if s, ok := sessionNames[id]; ok {
return s
}
var buf *uint16
var n uint32
name := ""
r, _, _ := procWTSQuery.Call(0, uintptr(id), 5 /* WTSUserName */, uintptr(unsafe.Pointer(&buf)), uintptr(unsafe.Pointer(&n)))
if r != 0 && buf != nil {
name = utf16ptr(buf)
procWTSFree.Call(uintptr(unsafe.Pointer(buf)))
}
if name == "" {
name = T("Sitzung", "Session")
}
sessionNames[id] = name
return name
}
// procAcc sammelt die Stichproben eines Messintervalls.
type procAcc struct {
name string
session uint32
readySum int
maxReady int
hits int
samples int
cpuFirst int64
cpuLast int64
}
type procRow struct {
pid uintptr
name string
user string
session uint32
cpuPct float64 // Anteil an der Gesamt-CPU (wie Task-Manager)
avgReady float64
maxReady int
waitPct float64 // Anteil der Stichproben mit mind. einem wartenden Thread
}
Use at your own risk
irqtop is provided free of charge and without warranty. You use it at your own risk. There is no guarantee that the program runs without errors on every system or shows correct values. Test it on a non-critical system first. No liability is accepted for damage or outages caused by its use. This also applies to changes such as multiqueue that you make based on the measurements.
FAQ
Which Windows versions does irqtop run on?
irqtop is built for 64-bit Windows, that is Windows 10 and 11 and Windows Server 2016 or later. The per-adapter, per-core values come from the counter “Per Processor Network Interface Card Activity”. If it is missing, irqtop still shows the other values.
Does irqtop need administrator rights?
Not for the performance counters. Started as administrator, it can also show the user names of other sessions.
Does irqtop change anything on the system?
No. It only reads performance counters and the process list. The only thing it writes is the CSV file if you pass -csv.
I set multiqueue, but everything still runs on one core. Why?
Check that the VM was restarted from Proxmox, that a current VirtIO driver is installed and that Receive Side Scaling is enabled in the driver. With very little traffic an uneven spread is normal; only a measurement under load is meaningful.
Why doesn't Task Manager show this?
Task Manager shows the load per core, but not what it is spent on. irqtop separates interrupt and DPC time and assigns network DPCs to cores.