Pro Yearly is on sale from $80 to $50! »

Delveを用いたデバッグ & pprofを用いたプロファイリング

Delveを用いたデバッグ & pprofを用いたプロファイリング

golang.tokyo #23 https://golangtokyo.connpass.com/event/126673/
20:20 ~ 20:40「Delveを用いたデバッグ & pprofを用いたプロファイリング」の発表資料です。

444b1af7b8bad3610d78786374ebe223?s=128

Hikaru Watanabe

April 19, 2019
Tweet

Transcript

  1. & D

  2. 02 /1 • • W 4 4 IS M h

    I ? • 8 // 9 • ? a 79B B • O V
  3. • D • 3 3 • 3 • D •

    • • • •
  4. • • • • • • • • • •

    4
  5. -1 -D • 1 . I : • / 5

    % . / . -1 - -1 - • • G • G • G • - • 11 . .- . / . -1 - -1 - 1
  6. 1 • ( . : D package main import (

    "fmt" ) func main() { array := [4]string{} fruits := []string{ "apple", "orange", "grape", "kiwi", "pineapple", } for i, f := range fruits { array[i] = f } fmt.Printf("%#v", array) } panic: runtime error: index out of range goroutine 1 [running]: main.main() /tmp/sandbox760713094/main.go:17 +0x160 Program exited: status 2. : : • ) (/ 1(. : ac • 7. : D • 67 b • . 7 f e
  7. • 2 1 7 / ( ) package main import

    ( "fmt" "runtime" ) func main() { array := [4]string{} fruits := []string{ "apple", "orange", "grape", "kiwi", "pineapple", } for i, f := range fruits { // Breakpoint  runtime.Breakpoint() array[i] = f } fmt.Printf("%#v", array) }
  8. • / /CG SR D • / :2 ) 2

    / 8: 8 : / • ( L
  9. • . • W 9 G S • / •

    • • / . • /
  10. . ) 01 . 1 5 5 5 5 5

    5 ) .5( 0: $ package main import ( "fmt" "github.com/pkg/profile" ) func fib(n int) int { if n < 2 { return n } return fib(n-1) + fib(n-2) } func main() { defer profile.Start(profile.ProfilePath(".")).Stop() fmt.Println("Start") for i := 0; i < 1000; i++ { fib(50) } fmt.Println("Finish") }
  11.  

  12. • B 1 • 1 • 1 • 1 1

    • 1 • 2 C 1 (e.g. go tool pprof --text pprof/test.bin pprof/cpu.out)
  13. • 1 A • N : 4.A • /4 D

    ! • 088 3 433 42 38