Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
$ go tool traceを使ってみよう/ Let's use go tool trace
Search
nametake
December 11, 2017
Technology
2
2.4k
$ go tool traceを使ってみよう/ Let's use go tool trace
golang.tokyo #11(
https://techplay.jp/event/641403
)での発表資料です。
nametake
December 11, 2017
Tweet
Share
More Decks by nametake
See All by nametake
実例マッピングで要件のレビューサイクルを回してる話 / Example Mapping Review Cycle
nametake
1
820
アルプ T-QAオンボーディング資料(2022年9月版) / Alp T-QA onboarding 2022-09
nametake
0
1.3k
定式化と自動化に取り組みますという話 / Work on formulation and automation
nametake
0
790
QAエンジニアが実例マッピングを2ヶ月運用した話 / Example Mapping for 2 months
nametake
3
4.5k
1人目QAエンジニアよもやま話 / QA Test Talk Vol.1
nametake
4
580
アルプでのAgile Testing / Alp Agile Testing
nametake
1
1.9k
CFD-Editorというツールを作ってみた話 / Made CFD-Editor
nametake
1
260
スタートアップで1人目QAエンジニアになった話 / Startup first QA
nametake
3
1.2k
テスト技法の話 / Testing techniques
nametake
5
4.5k
Other Decks in Technology
See All in Technology
FrontDoorとWebAppsを組み合わせた際のリダイレクト処理の注意点
kenichirokimura
1
450
Cloud Native Java with Spring Boot (CNCF Aarhus, April 2024)
thomasvitale
1
160
Hands-on Gemini, the Google DeepMind LLM
meteatamel
1
110
Java EE/Jakarta EEの現状と将来―クラウドネイティブ時代にJava EEは対応できるのか?―
takakiyo
1
120
**強い**エンジニアのなり方 - フィードバックサイクルを勝ち取る / grow one day each day
soudai
64
19k
VS CodeでAWSを操作しよう
smt7174
7
1.6k
「手動オペレーションに定評がある」と言われた私が心がけていること / phpcon_odawara2024
blue_goheimochi
2
370
本当のAWS基礎
toru_kubota
0
380
自動生成を活用した、運用保守コストを抑える Error/Alert/Runbook の一元集約管理 / Centralized management of Error/Alert/Runbook to minimize operational costs using automated code generation
biwashi
12
2.3k
AWS認定資格を取得したので、初めてマネコンを触った時を振り返ってみた。
ainatsuptr
2
100
Janus
bkuhlmann
1
490
Databricks:『生成AI World Cup』のご案内
databricksjapan
2
160
Featured
See All Featured
Gamification - CAS2011
davidbonilla
76
4.6k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Ruby is Unlike a Banana
tanoku
96
10k
The Art of Programming - Codeland 2020
erikaheidi
41
12k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.4k
Bash Introduction
62gerente
604
210k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
186
16k
Building Flexible Design Systems
yeseniaperezcruz
318
37k
The Mythical Team-Month
searls
215
42k
A designer walks into a library…
pauljervisheath
199
23k
Happy Clients
brianwarren
91
6.4k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Transcript
$ go tool trace ͬͯΈΑ͏ גࣜձࣾωΫετΧϨϯγʔ @nametake
ࣗݾհ
@nametake
Goྺ1ͪΐͬͱ
ύϑΥʔϚϯεܭଌ
runtime/pprof net/http/pprof
package main import ( "log" "net/http" _ "net/http/pprof" "runtime" )
func main() { runtime.SetBlockProfileRate(1) log.Println( http.ListenAndServe("0.0.0.0:6060", nil), ) }
localhost:6060/debug/pprof/
None
None
None
None
None
$ go tool trace
None
͍ํઆ໌
runtime/trace
package main import ( "os" "runtime/trace" ) func main() {
f, err := os.Create("trace.out") if err != nil { panic(err) } defer f.Close() err = trace.Start(f) if err != nil { panic(err) } defer trace.Stop() }
$ go tool trace trace.out
ϑΝΠϧॻ͖ࠐΈ
f, err := os.Create("test.txt") if err != nil { panic(err)
} defer f.Close() for i := 0; i < 100; i++ { fmt.Fprintf(f, "line number: %d\n", i) }
None
ॲཧ࣌ؒ
ॲཧ࣌ؒ
ϓϩάϥϜ͕֬อͨ͠ώʔϓྖҬ
goroutineͷͱ࣮ߦ࣌ؒ
OSͷThreadͷͱ࣮ߦ࣌ؒ
Proc(CPU)Ͱॲཧ͍ͯ͠Δ༰
ͳΜ͔৭ʑͳใ
Goݴޠ ׂΓͱؾܰʹ syscallΛݺͿ
None
syscallͷݺͼग़͠
ͱ͍ͯ͋͠
syscallΛݺΜͰΔ
f, err := os.Create("test.txt") if err != nil { panic(err)
} defer f.Close() for i := 0; i < 100; i++ { fmt.Fprintf(f, "line number: %d\n", i) }
f, err := os.Create("test.txt") if err != nil { panic(err)
} defer f.Close() for i := 0; i < 100; i++ { fmt.Fprintf(f, "line number: %d\n", i) }
bufio
f, err := os.Create("test.txt") if err != nil { panic(err)
} defer f.Close() w := bufio.NewWriter(f) defer w.Flush() for i := 0; i < 100; i++ { fmt.Fprintf(w, "line number: %d\n", i) }
None
None
None
None
None
GUIͰ֬ೝग़དྷΔʂ
GC
None
GC
None
GCຖʹ֬อ͍ͯ͠͠Δ
n := 400000 list := []int{} for i := 0;
i < n; i++ { list = append(list, i) }
n := 400000 list := []int{} for i := 0;
i < n; i++ { list = append(list, i) }
n := 400000 list := make([]int, n) for i :=
0; i < n; i++ { list[i] = i }
None
GC͕ൃੜ͍ͯ͠ͳ͍
࠷ॳʹΨοπϦྖҬ֬อ
6ms → 2ms
ฒྻԽ
https://making.pusher.com/go-tool-trace/ Connʹॻ͖ࠐΈ
https://making.pusher.com/go-tool-trace/ ͜ͷ෦Ͱॻ͖ࠐΜͰ͍Δ
https://making.pusher.com/go-tool-trace/
https://making.pusher.com/go-tool-trace/ ଞͷϓϩηεͬͯͳ͍
https://making.pusher.com/go-tool-trace/
https://making.pusher.com/go-tool-trace/
https://making.pusher.com/go-tool-trace/ CPUΛແବͳ͘ར༻
͍Ζ͍ΖΘ͔Δ
શ෦ͷ͕ Θ͔ΔΘ͚Ͱͳ͍
CPUͷ༻ pprofͱ͔Λ ݟͨ΄͏͕͍͍
ϓϩάϥϜͷ ྲྀΕΛΔ
ͱΓ͋͑ͣ ݟͯΈΔ͚ͩͰ ͍͍͔
go traceͷ͜ͱɺ ࣌ʑͰ͍͍͔Β……ɹ ࢥ͍ग़͍ͯͩ͘͠͞