A helper tool to work with profile.proto (pprof) files

qpprof

qpprof complements the pprof tool.

Commands

Use qpprof command --help to get more information.

Flat aggregation

Alternative flat aggregations allow you to get the top with some of the nodes being folded to their callers.

For instance, take this copyBytes() function:

func copyBytes(b []byte) []byte {
  dst := make([]byte, len(b))
  copy(dst, b)
  return dst
}

If you benchmark it and use pprof top, then you'll see this:

(pprof) top 5
37.56% runtime.mallocgc
12.16% runtime.memclrNoHeapPointers
 9.35% runtime.memmove
 8.47% runtime.scanobject
 6.42% runtime.scanblock

With flat-with-runtime you'll get something that you would expect:

$ qpprof flat-with-runtime cpu.out
6.25s example.copyBytes
 40ms example.BenchmarkCopyBytes
 20ms testing.(*B).runN

There is also flat-with-stdlib that folds all standard library functions, not just the runtime package.

Enriching the profile

Given a CPU profile X and executable E that was used to collect it, we can generate a new CPU profile Y that contains even more useful information.

What we can add to the profile:

  • Explicit bound checks timings (displayed as runtime.boundcheck)
  • Explicit nil checks timings (displayed as runtime.nilcheck)
$ qpprof enrich -o=cpu2.out -exe=prog cpu.out
runtime.boundcheck: 7 samples (300ms)
runtime.nilcheck: 22 samples (300ms)

Now let's open cpu2.out with pprof:

(pprof) top boundcheck|nilcheck
Active filters:
   focus=boundcheck|nilcheck
Showing nodes accounting for 0.60s, 1.10% of 54.68s total
Showing top 10 nodes out of 132
      flat  flat%   sum%        cum   cum%
     0.30s  0.55%  0.55%      0.30s  0.55%  runtime.boundcheck (inline)
     0.30s  0.55%  1.10%      0.30s  0.55%  runtime.nilcheck (inline)

The implicit bound checks are now explicit, visible in the profile.

Owner
Iskander (Alex) Sharipov
🇺🇦💙💛
Iskander (Alex) Sharipov
Similar Resources

Go package for reading from continously updated files (tail -f)

Go package for tail-ing files A Go package striving to emulate the features of the BSD tail program. t, err := tail.TailFile("/var/log/nginx.log", tai

Dec 29, 2022

A simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys.

A simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys.

ipfs-sync is a simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys, so you can always access your directories from the same address. You can use it to sync your documents, photos, videos, or even a website!

Dec 30, 2022

A simple web service for storing text log files

logpaste A minimalist web service for uploading and sharing log files. Run locally go run main.go Run in local Docker container The Docker container a

Dec 30, 2022

Lumberjack is a Go package for writing logs to rolling files.

Lumberjack is a Go package for writing logs to rolling files.

Feb 24, 2022

List files and their creation, modification and access time on android

andfind List files and their access, modification and creation date on a Android

Jan 5, 2022

BRUS - Parses your web server (e.g. nginx) log files and checks with GreyNoise how much noise your website is exposed to.

BRUS bbbbbb rrrrrr u u sssss b b r r u u s bbbbbb rrrrrr u u sssss b b r r u u s bbbbbb r r

May 29, 2022

Peimports - based on golang's debug/pe this package gives quick access to the ordered imports of pe files with ordinal support

This code is almost entirely derived from the Go standard library's debug/pe package. It didn't provide access to ordinal based entries in the IAT and

Jan 5, 2022

A version control system to manage large files.

ArtiVC ArtiVC (Artifacts Version Control) is a handy command-line tool for data versioning on cloud storage. With only one command, it helps you neatl

Jan 4, 2023

A GNU/Linux monitoring and profiling tool focused on single processes.

A GNU/Linux monitoring and profiling tool focused on single processes.

Uroboros is a GNU/Linux monitoring tool focused on single processes. While utilities like top, ps and htop provide great overall details, they often l

Dec 26, 2022
Continuous profiling of golang program based on pprof
Continuous profiling of golang program based on pprof

基于 pprof 的 Golang 程序连续分析 Demo 点击 point Quick Start 需要被收集分析的golang程序,需要提供net/http/pprof端点,并配置在collector.yaml配置文件中 #run server :8080 go run ser

Jan 9, 2023
Easy pprof library for Golang

easypprof Easy pprof library for Go. Rationale TODO Features Simple API. TODO In

Apr 21, 2022
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.

Vegeta is a system resource usage tracking tool built to regularly take snapshots of the memory and CPU load of one or more running processes, so as to dynamically build up a profile of their usage of system resources.

Jan 16, 2022
A simple utility tool to profile go code
A simple utility tool to profile go code

A simple utility tool to profile go code. Profile timer that works like a stop w

Jul 23, 2022
ProfileStatusSyncer - A tool to synchronize user profile status of Github and Netease CloudMusic

ProfileStatusSyncer A tool to synchronize user profile status of GitHub and Nete

Jul 20, 2022
Backend APIs for Hello Profile

Hello Profile Backend Service Backend application for Hello profile. Description This is the backend application for Hello profile. The application is

Dec 12, 2021
structured logging helper

Logart Logart is a structured logging tool that aims to simplify logging to a database It is not yet in stable state, but is used in production and ac

Apr 24, 2021
Golang Rich Error, for having better visibility when things don't work as expected.

Rich Error Why we need better error handling? the error messages in go are ugly and very hard to read, also they don't give us much data about what ex

Dec 19, 2022
Go-logger - A sample go module that I stood up quickly to learn how remote modules work in go

go-logger A sample go module that I stood up quickly to learn how remote modules

Jan 9, 2022
Request-logging-tool - A tool logs the md5 codes of the responses of the given domains in parameter

request-logging-tool Application to send http requests and log the md5 responses

Jan 7, 2022