| 1 |
// Copyright 2022 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package pprof |
| 6 |
|
| 7 |
import ( |
| 8 |
"fmt" |
| 9 |
"internal/syscall/windows" |
| 10 |
"io" |
| 11 |
"syscall" |
| 12 |
"unsafe" |
| 13 |
) |
| 14 |
|
| 15 |
func addMaxRSS(w io.Writer) { |
| 16 |
var m windows.PROCESS_MEMORY_COUNTERS |
| 17 |
p, _ := syscall.GetCurrentProcess() |
| 18 |
err := windows.GetProcessMemoryInfo(p, &m, uint32(unsafe.Sizeof(m))) |
| 19 |
if err == nil { |
| 20 |
fmt.Fprintf(w, "# MaxRSS = %d\n", m.PeakWorkingSetSize) |
| 21 |
} |
| 22 |
} |