You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: memory_monitoring_profiler_test.go
    path of file: ./repos/cockroach/pkg/server/profiler
    
    the code of the file until where you have to start completion: // Copyright 2023 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package profiler

import (
	"context"
	"fmt"
	"io"
	"math"
	"testing"

	"github.com/cockroachdb/cockroach/pkg/settings/cluster"
	"github.com/cockroachdb/cockroach/pkg/util/mon"
	"github.com/cockroachdb/redact"
	"github.com/stretchr/testify/require"
)

func addMonitor(
	t *testing.T,
	ctx context.Context,
	st *cluster.Settings,
    
func TestGetMonitorStateCb(t *testing.T) {
	ctx := context.Background()
	st := cluster.MakeTestingClusterSettings()

	root := addMonitor(t, ctx, st, "root", nil /* parent */, 0 /* usedBytes */, 1<<30 /* reservedBytes */)
	// Monitor with usage that counts towards its parent.
	child1 := addMonitor(t, ctx, st, "child1", root, 1<<20 /* usedBytes */, 0 /* reservedBytes */)
	// Monitor with usage that counts towards its reserved account.
	addMonitor(t, ctx, st, "child2", root, 1<<10 /* usedBytes */, 2<<10 /* reservedBytes */)
	// Monitor with no usage and no reservation should be omitted.
	addMonitor(t, ctx, st, "child3", root, 0 /* usedBytes */, 0 /* reservedBytes */)
	// Monitor at a deeper level.
	addMonitor(t, ctx, st, "grandchild1", child1, 1 /* usedBytes */, 0 /* reservedBytes */)

	var w testWriter
	require.NoError(t, root.TraverseTree(getMonitorStateCb(&w)))

	expected := `
root 1.0 MiB (1.0 GiB / 0 B)
    child2 1.0 KiB (2.0 KiB / 0 B)
    child1 1.0 MiB
        grandchild1 1 B
`
	// Note that we prepend a newline symbol for prettier expected string.
	require.Equal(t, expected, fmt.Sprintf("\n%s", w.buf))
}