NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Profiling a build



On Tue, 2 Dec 2025 06:23:00 +0000 (UTC)
Benny Siegert <bsiegert%netbsd.org@localhost> wrote:

> Hi!
> 
> I would like to profile a build that takes about 2-3 hours on my Raspberry 
> Pi. The build does not use Make.
> 
> The questions I would like to answer are:
> 
> 1. How much time is spent waiting for I/O?
> 2. How much time is spent in the various processes? i.e. compiler, linker, 
> test binaries.
> 
> Should I be looking at dtrace for that? Or is there something simpler?
> 
> -- 
> Benny

The simplest of all is:

time ./build.sh

If you need to measure time for individual executables, then you can
create shell wrappers:

#!/bin/sh
exec time /usr/bin/gcc.bin "$@" >/dev/null

that log time metrics to various log files. You can process these later
with awk and grep. You many need to play around with stderr redirection
+ subshells if you need to separate stderr output from time and the
other command.

Eliminate disk I/O by building everything on tmpfs file system. Even
better, create a complete chroot environment on tmpfs, this way you
avoid most of the disk I/O when loading executables and shared
libraries.


Home | Main Index | Thread Index | Old Index