mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Update wzprof.
This commit is contained in:
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.19
|
||||
require (
|
||||
github.com/ncruces/julianday v0.1.5
|
||||
github.com/psanford/httpreadat v0.1.0
|
||||
github.com/stealthrocket/wzprof v0.1.1
|
||||
github.com/stealthrocket/wzprof v0.1.3
|
||||
github.com/tetratelabs/wazero v1.1.1-0.20230511035210-78c35acd6e1c
|
||||
golang.org/x/sync v0.2.0
|
||||
golang.org/x/sys v0.8.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -4,8 +4,8 @@ github.com/ncruces/julianday v0.1.5 h1:hDJ9ejiMp3DHsoZ5KW4c1lwfMjbARS7u/gbYcd0FB
|
||||
github.com/ncruces/julianday v0.1.5/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
|
||||
github.com/psanford/httpreadat v0.1.0 h1:VleW1HS2zO7/4c7c7zNl33fO6oYACSagjJIyMIwZLUE=
|
||||
github.com/psanford/httpreadat v0.1.0/go.mod h1:Zg7P+TlBm3bYbyHTKv/EdtSJZn3qwbPwpfZ/I9GKCRE=
|
||||
github.com/stealthrocket/wzprof v0.1.1 h1:/qhSauOzXda4W5rEm+Gj2o2cKRZQqtGBPAulPflRwWk=
|
||||
github.com/stealthrocket/wzprof v0.1.1/go.mod h1:UxCYAWsxjUKpIzJV8Pl5Yyo2QkQwsL29GdaoA38cXKU=
|
||||
github.com/stealthrocket/wzprof v0.1.3 h1:zG1W2AuyvKHe+0YGYS8o9WNYsaaadZhQYHGbFrgfYAs=
|
||||
github.com/stealthrocket/wzprof v0.1.3/go.mod h1:UxCYAWsxjUKpIzJV8Pl5Yyo2QkQwsL29GdaoA38cXKU=
|
||||
github.com/tetratelabs/wazero v1.1.1-0.20230511035210-78c35acd6e1c h1:3vKw5AyUv+16qm9tIVfvm205aDIpDmrjxPydJ87GBKY=
|
||||
github.com/tetratelabs/wazero v1.1.1-0.20230511035210-78c35acd6e1c/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
|
||||
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
|
||||
|
||||
@@ -35,8 +35,6 @@ var (
|
||||
memprof string
|
||||
)
|
||||
|
||||
const defaultSampleRate = 1.0 / 19
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
initFlags()
|
||||
|
||||
@@ -101,12 +99,12 @@ func setupProfiling(ctx context.Context) (context.Context, *wzprof.CPUProfiler,
|
||||
var listeners []experimental.FunctionListenerFactory
|
||||
if cpuprof != "" {
|
||||
cpu = wzprof.NewCPUProfiler()
|
||||
listeners = append(listeners, wzprof.Sample(defaultSampleRate, cpu))
|
||||
listeners = append(listeners, cpu)
|
||||
cpu.StartProfile()
|
||||
}
|
||||
if memprof != "" {
|
||||
mem = wzprof.NewMemoryProfiler()
|
||||
listeners = append(listeners, wzprof.Sample(defaultSampleRate, mem))
|
||||
listeners = append(listeners, mem)
|
||||
}
|
||||
if listeners != nil {
|
||||
ctx = context.WithValue(ctx,
|
||||
@@ -127,7 +125,7 @@ func saveProfiles(module wazero.CompiledModule, cpu *wzprof.CPUProfiler, mem *wz
|
||||
}
|
||||
|
||||
if cpu != nil {
|
||||
prof := cpu.StopProfile(defaultSampleRate, symbols)
|
||||
prof := cpu.StopProfile(1, symbols)
|
||||
err := wzprof.WriteProfile(cpuprof, prof)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -135,7 +133,7 @@ func saveProfiles(module wazero.CompiledModule, cpu *wzprof.CPUProfiler, mem *wz
|
||||
}
|
||||
|
||||
if mem != nil {
|
||||
prof := mem.NewProfile(defaultSampleRate, symbols)
|
||||
prof := mem.NewProfile(1, symbols)
|
||||
err := wzprof.WriteProfile(memprof, prof)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user