// Code generated by cmd/cgo; DO NOT EDIT.

//line /home/evie/packages/go/go-1.18-0/go/src/runtime/testdata/testprogcgo/gprof.go:1:1
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

// Test taking a goroutine profile with C traceback.

/*
// Defined in gprof_c.c.
void CallGoSleep(void);
void gprofCgoTraceback(void* parg);
void gprofCgoContext(void* parg);
*/
import _ "unsafe"

import (
	"fmt"
	"io"
	"runtime"
	"runtime/pprof"
	"time"
	"unsafe"
)

func init() {
	register("GoroutineProfile", GoroutineProfile)
}

func GoroutineProfile() {
	runtime.SetCgoTraceback(0, unsafe.Pointer(( /*line :31:44*/_Cgo_ptr(_Cfpvar_fp_gprofCgoTraceback) /*line :31:62*/)), unsafe.Pointer(( /*line :31:81*/_Cgo_ptr(_Cfpvar_fp_gprofCgoContext) /*line :31:97*/)), nil)

	go ( /*line :33:5*/_Cfunc_CallGoSleep /*line :33:17*/)()
	go ( /*line :34:5*/_Cfunc_CallGoSleep /*line :34:17*/)()
	go ( /*line :35:5*/_Cfunc_CallGoSleep /*line :35:17*/)()
	time.Sleep(1 * time.Second)

	prof := pprof.Lookup("goroutine")
	prof.WriteTo(io.Discard, 1)
	fmt.Println("OK")
}

//export GoSleep
func GoSleep() {
	time.Sleep(time.Hour)
}
