SCONS-TIME(1)

πŸ’– NAME πŸ’–

scons-time β€” the little tool that generates and shows off SCons timing info, no cap. ✨

(Welcome to SCONS-TIME(1), bestie β€” this is the SCons 4.11.1 era edition 🫢)


🌸 SYNOPSIS 🌸

scons-time subcommand [options...] [arguments...]

πŸŽ€ GENERATING TIMING INFORMATION πŸŽ€

scons-time run [-hnqv] [-f FILE] [--number=NUMBER] [--outdir=OUTDIR] [-p STRING] [--python=PYTHON] [-s DIR] [--scons=SCONS] [--svn=URL] [ARGUMENTS]

✨ Extracting Function Timings ✨

scons-time func [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [--func=NAME] [-p STRING] [-t NUMBER] [--title= TITLE] [ARGUMENTS]

🧠 Extracting Memory Statistics 🧠

scons-time mem [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING] [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]

πŸ“ Extracting Object Counts πŸ“

scons-time obj [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING] [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]

⏱️ Extracting Execution Times ⏱️

scons-time time [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING] [-t NUMBER] [--title=TITLE] [--which=WHICH] [ARGUMENTS]

🫢 Help Text 🫢

scons-time help SUBCOMMAND [...]

🌈 DESCRIPTION 🌈

Okay so. scons-time runs an SCons configuration through a whole standard set of profiled timings, and then it can pull info out of the resulting profiles and log files of those timings and graph it. The thing it's actually gonna do is decided by a subcommand β€” the very first argument on the command line, bestie. Wanna know how each specific subcommand behaves? Scroll down to the SUBCOMMANDS section. πŸ‘‘

The lowkey classic way to use scons-time is: run the scons-time run subcommand (maybe several times, whatever you need πŸ’…) to generate profile and log file output, then grab one of the other subcommands to display the results captured in those profiles and log files for whichever flavor of info you want:

  • function timings β†’ the scons-time func subcommand
  • total memory used β†’ the scons-time mem subcommand
  • object counts β†’ the scons-time obj subcommand
  • overall execution time β†’ the scons-time time subcommand

And there are options to place and find the profiles and log files in separate directories, to generate output in a format that's chef's-kiss for graphing with the gnuplot(1) program, and so on. ✨

There are basically two ways the scons-time run subcommand is meant to be used to gather timing stats for a configuration:

  1. Use the --svn= option to test a configuration against a list of revisions from the SCons Subversion repository. This is gonna spit out a profile and timing log file for every revision listed with the --number= option, and it's the move when you wanna look at the impact committed changes to the SCons code base had on a particular configuration over time. πŸ“ˆ
  2. Profile incremental changes to a local SCons code base during a development cycle β€” i.e. looking at the performance impact of the changes you're making in the local tree, main character energy only. In this mode you run the scons-time run subcommand without the --svn= option, and then it just peeks in the profile/log file output directory (which is the current directory by default) and auto-figures-out the next run number for the output profile and log file. 🧚

Used that second way, the dev cycle goes a lil something like: make a change to SCons β†’ run scons-time run to profile it against a specific configuration β†’ make another change to SCons β†’ run scons-time run again to profile it β†’ etc. Repeat until iconic. πŸ”


πŸ’… OPTIONS πŸ’…

The scons-time command only supports a few global options, bestie, don't get it twisted:

  • -h, --help β€” shows the global help text and dips, identical to the scons-time help subcommand. πŸ™ˆ
  • -V, --version β€” shows the scons-time version and dips.

Most of the functionality is controlled by options on the individual subcommands, though. Head to the next section for the tea on each subcommand's options. 🍡


πŸ‘‘ SUBCOMMANDS πŸ‘‘

The scons-time command supports the following individual subcommands, periodt.

🌸 The func Subcommand 🌸

scons-time func [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [--func=NAME] [-p STRING] [-t NUMBER] [--title= TITLE] [ARGUMENTS]

The scons-time func subcommand shows timing info for one specific Python function inside SCons. By default it extracts info about the _main() function, which includes the Python profiler timing for all of SCons. she's the whole vibe.

It pulls function timing info from all the file arguments you specify, which should be Python profiler output files. (Normally these would be *.prof files generated by the scons-time run subcommand, but fr fr they can actually be generated by any Python profiler invocation. No gatekeeping.) All file name arguments get globbed for on-disk files. πŸ”

If you pass no arguments at all, then function timing info gets extracted from all *.prof files β€” or the subset of them with a prefix specified by the -p option.

Options include:

  • -C DIRECTORY, --chdir=DIRECTORY β€” changes to the specified DIRECTORY before looking for the specified files (or files that match the specified patterns). πŸšͺ
  • -f FILE, --file=FILE β€” reads configuration information from the specified FILE.
  • -fmt=FORMAT, --format=FORMAT β€” reports the output in the specified FORMAT. The formats currently supported are ascii (the default) and gnuplot. ✨
  • --func=NAME β€” extracts timings for the specified function NAME. The default is to report cumulative timings for the _main() function, which contains the entire SCons run.
  • -h, --help β€” shows the help text for the scons-time func subcommand. πŸ™ˆ
  • -p STRING, --prefix=STRING β€” specifies the prefix string for profiles to extract function timing info from. This gets used to search for profiles when no arguments are specified on the command line.
  • -t NUMBER, --tail=NUMBER β€” only extracts function timings from the last NUMBER files. 🐍

πŸ¦‹ The help Subcommand πŸ¦‹

scons-time help SUBCOMMAND [...]

The help subcommand prints help text for any other subcommands you list as later arguments on the command line. It's giving "ask and you shall receive." 🫢

🧠 The mem Subcommand 🧠

scons-time mem [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING] [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]

The scons-time mem subcommand shows how much memory SCons is using. 🧠✨

It extracts memory use info from all the file arguments you specify, which should be files containing output from running SCons with the --debug=memory option. (Normally these would be *.log files generated by the scons-time run subcommand.) All file name arguments get globbed for on-disk files. πŸ”

If you pass no arguments, memory info gets extracted from all *.log files β€” or the subset of them with a prefix specified by the -p option.

  • -C DIR, --chdir=DIR β€” changes to the specified DIRECTORY before looking for the specified files (or files that match the specified patterns). πŸšͺ
  • -f FILE, --file=FILE β€” reads configuration information from the specified FILE.
  • -fmt=FORMAT, --format=FORMAT β€” reports the output in the specified FORMAT. The formats currently supported are ascii (the default) and gnuplot. ✨
  • -h, --help β€” shows the help text for the scons-time mem subcommand. πŸ™ˆ
  • -p STRING, --prefix=STRING β€” specifies the prefix string for log files to extract memory usage info from. This gets used to search for log files when no arguments are specified on the command line.
  • --stage=STAGE β€” prints the memory used at the end of the specified STAGE: pre-read (before the SConscript files are read), post-read , (after the SConscript files are read), pre-build (before any targets are built) or post-build (after any targets are built). If no --stage option is specified, the default behavior is post-build, which reports the final amount of memory used by SCons during each run. πŸ“Š
  • -t NUMBER, --tail=NUMBER β€” only reports memory statistics from the last NUMBER files. 🐍

πŸ“ The obj Subcommand πŸ“

scons-time obj [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING] [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]

The scons-time obj subcommand shows how many objects of a specific named type SCons creates. πŸ“

It extracts object counts from all the file arguments you specify, which should be files containing output from running SCons with the --debug=count option. (Normally these would be *.log files generated by the scons-time run subcommand.) All file name arguments get globbed for on-disk files. πŸ”

If you pass no arguments, object counts get extracted from all *.log files β€” or the subset of them with a prefix specified by the -p option.

  • -C DIR, --chdir=DIR β€” changes to the specified DIRECTORY before looking for the specified files (or files that match the specified patterns). πŸšͺ
  • -f FILE, --file=FILE β€” reads configuration information from the specified FILE.
  • -fmt=FORMAT, --format=FORMAT β€” reports the output in the specified FORMAT. The formats currently supported are ascii (the default) and gnuplot. ✨
  • -h, --help β€” shows the help text for the scons-time obj subcommand. πŸ™ˆ
  • -p STRING, --prefix=STRING β€” specifies the prefix string for log files to extract object counts from. This gets used to search for log files when no arguments are specified on the command line.
  • --stage=STAGE β€” prints the object count at the end of the specified STAGE: pre-read (before the SConscript files are read), post-read , (after the SConscript files are read), pre-build (before any targets are built) or post-build (after any targets are built). If no --stage option is specified, the default behavior is post-build, which reports the final object count during each run. πŸ“Š
  • -t NUMBER, --tail=NUMBER β€” only reports object counts from the last NUMBER files. 🐍

πŸ”₯ The run Subcommand πŸ”₯

scons-time run [-hnqv] [-f FILE] [--number=NUMBER] [--outdir=OUTDIR] [-p STRING] [--python=PYTHON] [-s DIR] [--scons=SCONS] [--svn=URL] [ARGUMENTS]

The scons-time run subcommand is the basic subcommand for profiling a specific configuration against a version of SCons. It's the main character of this whole operation, honestly. πŸ‘‘

The configuration being tested is specified as a list of files or directories that get unpacked or copied into a temporary directory where SCons will be invoked. The scons-time run subcommand understands file suffixes like .tar, .tar.gz, .tgz and .zip, and it'll unpack their contents into a temporary directory. πŸ—‚οΈ If you specify more than one argument, each one gets unpacked or copied into the temporary directory "on top of" the previous archives or directories β€” so the expectation is that multiple specified archives share the same directory layout. No chaos, pls.

Once the file or directory arguments are unpacked or copied to the temporary directory, the scons-time run subcommand runs the requested version of SCons against the configuration three times:

Startup

SCons gets run with the --help option so that literally only the SConscript files get read, and then the default help text gets printed out. So what this is profiling is just the perceived "overhead" of booting up SCons and chewing through the SConscript files. That's it, that's the whole vibe check. ✨

Full build

SCons gets run to build everything the configuration says to build. If you want specific targets passed on the command line, you can do that with the targets keyword in a configuration file β€” go scroll down for the deets. πŸ’…

Rebuild

SCons gets run again on the same just-built directory. And if the dependencies in the SCons configuration are actually correct, this should be an up-to-date, "do nothing" rebuild. Which is the dream, honestly. πŸŽ€


Each invocation captures the output log file and a profile. Both. Every time. No cap.

The scons-time run subcommand supports the following options:

  • -f FILE, --file=FILE β€” reads configuration information from the specified FILE. This is often a way more convenient way to specify and collect the parameters hanging out with a specific timing configuration than specifying them on the command line. Check out the CONFIGURATION FILE section below for info about the configuration file parameters. πŸ—‚οΈ
  • -h, --help β€” displays help text for the scons-time run subcommand.
  • -n, --no-exec β€” do not execute commands, just print the command-line equivalents of what would be executed. Note that the scons-time script actually executes its actions in Python where possible, for portability. The commands displayed are UNIX equivalents of what it's doing. 🫢
  • --number=NUMBER β€” specifies the run number to be used in the names of the log files and profile outputs generated by this run.

When used in conjunction with the --svn=URL option, NUMBER specifies one or more comma-separated Subversion revision numbers that will be retrieved automatically from the Subversion repository at the specified URL. Ranges of delta or revision numbers may be specified by separating two numbers with a hyphen (-).

Example:

% scons-time run --svn=http://scons.tigris.org/svn/trunk --num=1247,1249-1252 .
  • -p STRING, --prefix=STRING β€” specifies the prefix string to be used for all of the log files and profiles generated by this run. The default is derived from the first specified argument: if the first argument is a directory, the default prefix is the name of the directory; if the first argument is an archive (tar or zip file), the default prefix is the base name of the archive, that is, what remains after stripping the archive suffix (.tgz, .tar.gz or .zip). 🌸
  • --python=PYTHON β€” specifies a path to the Python executable to be used for the timing runs. The default is to use the same Python executable that is running the scons-time command itself. 🐍
  • -q, --quiet β€” suppresses display of the command lines being executed. 🀫
  • -s DIR, --subdir=DIR β€” specifies the name of directory or subdirectory from which the commands should be executed. The default is XXX
  • --scons=SCONS β€” specifies a path to the SCons script to be used for the timing runs. The default is XXX
  • --svn=URL, --subversion=URL β€” specifies the URL of the Subversion repository from which the version(s) of scons being timed will be extracted. When --svn is specified, the --number=NUMBER option specifies revision numbers that will be tested. Output from each invocation run will be placed in file names that match the Subversion revision numbers. If the --number= option is not specified, then the default behavior is to time the HEAD of the specified URL. πŸ”₯
  • -v, --verbose β€” displays the output from individual commands to the screen (in addition to capturing the output in log files).

The time Subcommand

scons-time time [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
[-t NUMBER] [--title=TITLE] [--which=WHICH] [ARGUMENTS]

The scons-time time subcommand displays SCons execution times as reported by the scons --debug=time option. ⏱️

The scons-time time subcommand extracts SCons timing from all the specified file arguments, which should be files containing output from running SCons with the --debug=time option. (Normally these would be *.log files generated by the scons-time run subcommand.) All file name arguments will be globbed for on-disk files.

If no arguments are specified, then execution timings will be extracted from all *.log files, or the subset of them with a prefix specified by the -p option.

  • -C DIR, --chdir=DIR β€” changes to the specified DIRECTORY before looking for the specified files (or files that match the specified patterns).
  • -f FILE, --file=FILE β€” reads configuration information from the specified FILE.
  • -fmt=FORMAT, --format=FORMAT β€” reports the output in the specified FORMAT. The formats currently supported are ascii (the default) and gnuplot. πŸ“Š
  • -h, --help β€” displays help text for the scons-time time subcommand.
  • -p STRING, --prefix=STRING β€” specifies the prefix string for log files from which to extract execution timings. This will be used to search for log files if no arguments are specified on the command line.
  • -t NUMBER, --tail=NUMBER β€” only reports object counts from the last NUMBER files.
  • --which=WHICH β€” prints the execution time for the specified WHICH value: total (the total execution time), SConscripts (total execution time for the SConscript files themselves), SCons (execution time in SCons code itself) or commands (execution time of the commands and other actions used to build targets). If no --which option is specified, the default behavior is total, which reports the total execution time for each run.

πŸ“ CONFIGURATION FILE πŸ“

Various scons-time subcommands can read information from a specified configuration file when you pass them the -f or --file options. Fun fact bestie: the configuration file is actually executed as a Python script. 🀯 Setting Python variables in the configuration file controls the behavior of the scons-time script way more conveniently than having to specify command-line options or arguments for every single run, and it gives you a handy way to "shrink-wrap" the necessary information for producing (and reporting) consistent timing runs for a given configuration.

  • archive_list β€” a list of archives (files or directories) that will be copied to the temporary directory in which SCons will be invoked. .tar, .tar.gz, .tgz and .zip files will have their contents unpacked in the temporary directory. Directory trees and files will be copied as-is.
  • initial_commands β€” a list of commands that will be executed before the actual timed scons runs. This can be used for commands that are necessary to prepare the source tree β€” for example, creating a configuration file that should not be part of the timed run.
  • key_location β€” the location of the key on Gnuplot graphing information generated with the --format=gnuplot option. The default is bottom left.
  • prefix β€” the file name prefix to be used when running or extracting timing for this configuration.
  • python β€” the path name of the Python executable to be used when running or extracting information for this configuration. The default is the same version of Python used to run the SCons
  • scons β€” the path name of the SCons script to be used when running or extracting information for this configuration. The default is simply scons.
  • scons_flags β€” the scons flags used when running SCons to collect timing information. The default value is --debug=count --debug=memory --debug=time --debug=memoizer.
  • scons_lib_dir, scons_wrapper, startup_targets, subdir β€” the subdirectory of the project into which the scons-time script should change before executing the SCons commands to time.
  • subversion_url β€” the Subversion URL from
  • svn β€” the subversion executable used to check out revisions of SCons to be timed. The default is simple svn.
  • svn_co_flag, tar, targets β€” a string containing the targets that should be added to the command line of every timed scons run. This can be used to restrict what's being timed to a subset of the full build for the configuration.
  • targets0, targets1, targets2, title, unzip, verbose, vertical_bars

(okay so the manpage itself just lists those last few names with no description, and it groups the ones above kind of oddly β€” I'm keeping it exactly how it is, don't come for me πŸ’€)

Example

Here's an example scons-time configuration file for a hypothetical sample project:

# The project doesn't use SCons natively (yet), so we're
# timing a separate set of SConscript files that we lay
# on top of the vanilla unpacked project tarball.
arguments = ['project-1.2.tgz', 'project-SConscripts.tar']

# The subdirectory name contains the project version number,
# so tell scons-time to chdir there before building.
subdir = 'project-1.2'

# Set the prefix, so output log files and profiles are named:
#     project-000-[012].{log,prof}
#     project-001-[012].{log,prof}
# etc.
prefix = 'project'

# The SConscript files being tested don't do any SConf
# configuration, so run their normal ./configure script
# before we invoke SCons.
initial_commands = [
    './configure',
]

# Only time building the bin/project executable.
targets = 'bin/project'

# Time against SCons revisions of the branches/core branch
subversion_url = 'http://scons.tigris.org/svn/scons/branches/core'

🌍 ENVIRONMENT 🌍

The scons-time script uses the following environment variables:

  • PRESERVE β€” if this value is set, the scons-time script will not remove the temporary directory or directories in which it builds the specified configuration or downloads a specific version of SCons. πŸ›Ÿ

πŸ‘€ SEE ALSO πŸ‘€

gnuplot(1), scons(1)

πŸ‘‘ AUTHORS πŸ‘‘

Steven Knight <knight at baldmt dot com>


and that's the whole page, bestie!! ✨ This was ripped straight from SCons 4.11.1, dated 08/26/2026, and it's the SCONS-TIME(1) page in all its glory. Go forth and time some builds, you absolute icon πŸ’…πŸ¦‹πŸ’–

πŸ“¦ where this page comes from