toolkit: add feature to profile & trace to have better diagnostics#5640
Merged
Conversation
dmcilvaney
reviewed
Jun 7, 2023
dmcilvaney
reviewed
Jun 7, 2023
c025414 to
09487d4
Compare
37feff7 to
cb4e4d0
Compare
dmcilvaney
reviewed
Jun 14, 2023
dmcilvaney
reviewed
Jun 14, 2023
cb4e4d0 to
fdcda8c
Compare
dmcilvaney
reviewed
Jun 19, 2023
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
1780daa to
5da038e
Compare
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Sumynwa
approved these changes
Jun 23, 2023
dmcilvaney
reviewed
Jun 23, 2023
| if *pf.EnableCpuProf { | ||
| cpf, err := os.Create(*pf.CpuProfFile) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("Unable to create cpu-pprof file: %s", err) |
Contributor
There was a problem hiding this comment.
Linter will probably be grumpy about the capitalization of "Unable". It likes error strings to be all lowercase.
dmcilvaney
reviewed
Jun 23, 2023
dmcilvaney
approved these changes
Jun 23, 2023
dmcilvaney
left a comment
Contributor
There was a problem hiding this comment.
The big block of flags in the Makefile still seems messy, but not a deal breaker.
Added one suggestion to make the error 'optional' but I think this looks ok.
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Muhammad Falak R Wani falakreyaz@gmail.com
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-staticsubpackages, etc.) have had theirReleasetag incremented../cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json)./SPECS/LICENSES-AND-NOTICES/data/licenses.json,./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md,./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON)*.signatures.jsonfilessudo make go-tidy-allandsudo make go-test-coveragepassSummary
What does the PR accomplish, why was it needed?
Add profiling and tracing support to the toolkit. The go toolchain has inbuilt tools to diagnose logic and performance problems in Go programs. This PR integrates that support for our toolkit.
This PR introduces 3 additional flags, by default all the three flags are disabled.
ENABLE_TRACE: Setting this flag toy, instruments the various tools in the toolkit to recordtracedata. Tracing is a way to instrument code to analyze latency throughout the lifecycle of a call or user request. Traces provide an overview of how much latency each component contributes to the overall latency in a system. Traces can span multiple Go processes.ENABLE_MEM_PROFILE: Setting this flag toyinstruments the toolkit to record the memory profile.ENABLE_CPU_PROFILE: Setting this flag toyinstruments the toolkit to record the cpu profile.Profiling tools analyze the complexity and costs of a Go program such as its memory usage and frequently called functions to identify the expensive sections of a Go program.
It is advisable to only turn one of the flags for a run to get data that does not have noise due to other profiling/tracing flags.
The trace/profile data will be created in the
build/profiledirectory.To use the profile data:
go tool pprof -http=:8080 file.profileTo use the trace data:
go tool trace -http=:8080 file.traceChange Log
Does this affect the toolchain?
NO
Associated issues
Links to CVEs
Test Methodology