(b *testing.B)
| 468 | } |
| 469 | |
| 470 | func BenchmarkQueryWorkingSetSinglePage(b *testing.B) { |
| 471 | const pageSize = 4096 |
| 472 | addr, err := windows.VirtualAlloc(0, pageSize, windows.MEM_COMMIT|windows.MEM_RESERVE, windows.PAGE_READWRITE) |
| 473 | if err != nil { |
| 474 | b.Fatalf("VirtualAlloc failed: %v", err) |
| 475 | } |
| 476 | defer windows.VirtualFree(addr, 0, windows.MEM_RELEASE) |
| 477 | |
| 478 | ws := []sys.MemoryWorkingSetExInformation{{VirtualAddress: addr}} |
| 479 | proc := windows.CurrentProcess() |
| 480 | |
| 481 | b.ResetTimer() |
| 482 | for i := 0; i < b.N; i++ { |
| 483 | QueryWorkingSet(proc, ws) |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | func BenchmarkQueryWorkingSetBatch64Pages(b *testing.B) { |
| 488 | const pageSize = 4096 |
nothing calls this directly
no test coverage detected