Commit 0b8c983e authored by Russ Cox's avatar Russ Cox

runtime/pprof/internal/profile: move internal/pprof/profile here

Nothing needs internal/pprof anymore except the runtime/pprof tests.
Move the package here to prevent new dependencies.

Change-Id: Ia119af91cc2b980e0fa03a15f46f69d7f71d2926
Reviewed-on: https://go-review.googlesource.com/37165
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMichael Matloob <matloob@golang.org>
parent cbab65fd
......@@ -9,13 +9,14 @@ package main
import (
"bufio"
"fmt"
"internal/pprof/profile"
"internal/trace"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"github.com/google/pprof/profile"
)
func init() {
......
......@@ -258,13 +258,13 @@ var pkgDeps = map[string][]string{
"index/suffixarray": {"L4", "regexp"},
"internal/singleflight": {"sync"},
"internal/trace": {"L4", "OS"},
"internal/pprof/profile": {"L4", "OS", "compress/gzip", "regexp"},
"math/big": {"L4", "math/bits"},
"mime": {"L4", "OS", "syscall", "internal/syscall/windows/registry"},
"mime/quotedprintable": {"L4"},
"net/internal/socktest": {"L4", "OS", "syscall"},
"net/url": {"L4"},
"plugin": {"L0", "OS", "CGO"},
"runtime/pprof/internal/profile": {"L4", "OS", "compress/gzip", "regexp"},
"testing/internal/testdeps": {"L4", "runtime/pprof", "regexp"},
"text/scanner": {"L4", "OS"},
"text/template/parse": {"L4"},
......
......@@ -4,6 +4,9 @@
// Package profile provides a representation of profile.proto and
// methods to encode/decode profiles in this format.
//
// This package is only for testing runtime/pprof.
// It is not used by production Go programs.
package profile
import (
......
......@@ -9,13 +9,13 @@ package pprof
import (
"bytes"
"fmt"
"internal/pprof/profile"
"internal/testenv"
"math/big"
"os"
"os/exec"
"regexp"
"runtime"
"runtime/pprof/internal/profile"
"strings"
"sync"
"testing"
......
......@@ -7,10 +7,10 @@ package pprof
import (
"bytes"
"encoding/json"
"internal/pprof/profile"
"io/ioutil"
"reflect"
"runtime"
"runtime/pprof/internal/profile"
"testing"
)
......
......@@ -6,8 +6,8 @@ package pprof
import (
"bytes"
"internal/pprof/profile"
"runtime"
"runtime/pprof/internal/profile"
"testing"
)
......
......@@ -10,7 +10,10 @@ package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/pprof"
"sync"
"time"
)
......@@ -64,6 +67,13 @@ func checkLinear(typ string, tries int, f func(n int)) {
const offset = 251 // known size of runtime hash table
func main() {
f, err := os.Create("lock.prof")
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
checkLinear("lockone", 1000, func(n int) {
ch := make(chan int)
locks := make([]sync.RWMutex, offset+1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment