(b *testing.B)
| 485 | } |
| 486 | |
| 487 | func BenchmarkQueryWorkingSetBatch64Pages(b *testing.B) { |
| 488 | const pageSize = 4096 |
| 489 | const pages = 64 |
| 490 | |
| 491 | addr, err := windows.VirtualAlloc(0, pageSize*pages, windows.MEM_COMMIT|windows.MEM_RESERVE, windows.PAGE_READWRITE) |
| 492 | if err != nil { |
| 493 | b.Fatalf("VirtualAlloc failed: %v", err) |
| 494 | } |
| 495 | defer windows.VirtualFree(addr, 0, windows.MEM_RELEASE) |
| 496 | |
| 497 | ws := make([]sys.MemoryWorkingSetExInformation, pages) |
| 498 | for i := range ws { |
| 499 | ws[i].VirtualAddress = addr + uintptr(i*pageSize) |
| 500 | } |
| 501 | proc := windows.CurrentProcess() |
| 502 | |
| 503 | b.ResetTimer() |
| 504 | for i := 0; i < b.N; i++ { |
| 505 | QueryWorkingSet(proc, ws) |
| 506 | } |
| 507 | } |
nothing calls this directly
no test coverage detected