// Tests a single region with PIE active (the test target is a Go program, so
// it also tests multithreading support, since the Go runtime automatically
// spawns threads).
Tests a single region with PIE active (the test target is a Go program, so
it also tests multithreading support, since the Go runtime automatically
spawns threads).
// Tests a single region with PIE active ( the test target is a Go program so // it also tests multithreading support since the Go runtime automatically // spawns threads ) .
func TestSingleRegion(t *testing.T) {
	runtime.LockOSThread()
	must(buildGo("test/sum.go", "test/sum", true, true), t)
	regions := []string{
		"main.sum",
	}
	events := []perf.Configurator{
		perf.Instructions,
		perf.BranchInstructions,
		perf.BranchMisses,
	}
	expected := TotalMetrics{
		NamedMetrics{
			Name: "main.sum",
			Metrics: Metrics{
				Results: []Result{
					{
						Label: "instructions",
						Value: 70000000,
					},
					{
						Label: "branch-instructions",
						Value: 10000000,
					},
					{
						Label: "branch-misses",
						Value: 10,
					},
				},
			},
		},
	}
	check("test/sum", regions, events, expected, t)
}
func TestSingleRegion ( t * testing . T ) { runtime . LockOSThread ( ) must ( buildGo ( " " , " " , true , true ) , t ) regions := [ ] string { " " , } events := [ ] perf . Configurator { perf . Instructions , perf . BranchInstructions , perf . BranchMisses , } expected := TotalMetrics { NamedMetrics { Name : " " , Metrics : Metrics { Results : [ ] Result { { Label : " " , Value : 70000000 , } , { Label : " " , Value : 10000000 , } , { Label : " " , Value : 10 , } , } , } , } , } check ( " " , regions , events , expected , t ) }
Tests a single region with PIE active (the test target is a Go program, so
it also tests multithreading support, since the Go runtime automatically
spawns threads).
Tests a single region with PIE active ( the test target is a Go program so it also tests multithreading support since the Go runtime automatically spawns threads ) .