diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-04-02 12:04:54 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-04-02 13:00:15 +0000 |
| commit | fb6fb6ed7e5734bffbff0af8d67a177ee7640f39 (patch) | |
| tree | 68551c118c59b37a8a9cea81ae4c5b77b901e561 /pkg/report/linux.go | |
| parent | eb2966c4fa240b7304c49e53b51867d8a57eb327 (diff) | |
pkg/symbolizer: add Cache type
When the same crash happens all over again,
we repeatedly symbolize the same PCs.
This is slow and blocks VM loop in the manager.
Cache PCs we already symbolize, we are likely
to symbolize them again.
Diffstat (limited to 'pkg/report/linux.go')
| -rw-r--r-- | pkg/report/linux.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/report/linux.go b/pkg/report/linux.go index a1dafccfd..43f55d918 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -34,6 +34,7 @@ type linux struct { reportStartIgnores []*regexp.Regexp infoMessagesWithStack [][]byte eoi []byte + symbolizerCache symbolizer.Cache } func ctorLinux(cfg *config) (reporterImpl, []string, error) { @@ -399,13 +400,16 @@ func (ctx *linux) Symbolize(rep *Report) error { func (ctx *linux) symbolize(rep *Report) error { symb := symbolizer.NewSymbolizer(ctx.config.target) defer symb.Close() + symbFunc := func(bin string, pc uint64) ([]symbolizer.Frame, error) { + return ctx.symbolizerCache.Symbolize(symb.Symbolize, bin, pc) + } var symbolized []byte s := bufio.NewScanner(bytes.NewReader(rep.Report)) prefix := rep.reportPrefixLen for s.Scan() { line := append([]byte{}, s.Bytes()...) line = append(line, '\n') - newLine := symbolizeLine(symb.Symbolize, ctx.symbols, ctx.vmlinux, ctx.kernelBuildSrc, line) + newLine := symbolizeLine(symbFunc, ctx.symbols, ctx.vmlinux, ctx.kernelBuildSrc, line) if prefix > len(symbolized) { prefix += len(newLine) - len(line) } |
