MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestQueryWorkingSetCurrentProcess

Function TestQueryWorkingSetCurrentProcess

pkg/util/va/ws_test.go:340–360  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

338}
339
340func TestQueryWorkingSetCurrentProcess(t *testing.T) {
341 // allocate a page so we have a known committed address to query
342 const size = 4096
343 addr, err := windows.VirtualAlloc(0, size, windows.MEM_COMMIT|windows.MEM_RESERVE, windows.PAGE_READWRITE)
344 if err != nil {
345 t.Fatalf("VirtualAlloc failed: %v", err)
346 }
347 defer windows.VirtualFree(addr, 0, windows.MEM_RELEASE)
348
349 ws := []sys.MemoryWorkingSetExInformation{
350 {VirtualAddress: addr},
351 }
352
353 result := QueryWorkingSet(windows.CurrentProcess(), ws)
354 if result == nil {
355 t.Fatal("QueryWorkingSet returned nil for a valid committed page")
356 }
357 if len(result) != 1 {
358 t.Fatalf("expected 1 result, got %d", len(result))
359 }
360}
361
362func TestQueryWorkingSetBatchAddresses(t *testing.T) {
363 const pageSize = 4096

Callers

nothing calls this directly

Calls 1

QueryWorkingSetFunction · 0.70

Tested by

no test coverage detected