1SCONS-TIME(1) SCons 3.0.1 SCONS-TIME(1)
2
3
4
6 scons-time - generate and display SCons timing information
7
9 scons-time subcommand [options...] [arguments...]
10
12 scons-time run [-hnqv] [--aegis=PROJECT] [-f FILE] [--number=NUMBER]
13 [--outdir=OUTDIR] [-p STRING] [--python=PYTHON] [-s DIR]
14 [--scons=SCONS] [--svn=URL] [ARGUMENTS]
15
16 Extracting Function Timings
17 scons-time func [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT]
18 [--func=NAME] [-p STRING] [-t NUMBER] [--title= TITLE] [ARGUMENTS]
19
20 Extracting Memory Statistics
21 scons-time mem [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
22 [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]
23
24 Extracting Object Counts
25 scons-time obj [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
26 [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]
27
28 Extracting Execution Times
29 scons-time time [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
30 [-t NUMBER] [--title=TITLE] [--which=WHICH] [ARGUMENTS]
31
32 Help Text
33 scons-time help SUBCOMMAND [...]
34
36 The scons-time command runs an SCons configuration through a standard
37 set of profiled timings and can extract and graph information from the
38 resulting profiles and log files of those timings. The action to be
39 performed by the scons-time script is specified by a subcommand, the
40 first argument on the command line. See the SUBCOMMANDS section below
41 for information about the operation of specific subcommands.
42
43 The basic way to use scons-time is to run the scons-time run subcommand
44 (possibly multiple times) to generate profile and log file output, and
45 then use one of the other subcommands to display the results captured
46 in the profiles and log files for a particular kind of information:
47 function timings (the scons-time func subcommand), total memory used
48 (the scons-time mem subcommand), object counts (the scons-time obj
49 subcommand) and overall execution time (the scons-time time
50 subcommand). Options exist to place and find the profiles and log files
51 in separate directories, to generate the output in a format suitable
52 for graphing with the gnuplot(1) program, and so on.
53
54 There are two basic ways the scons-time run subcommand is intended to
55 be used to gather timing statistics for a configuration. One is to use
56 the --svn= option to test a configuration against a list of revisions
57 from the SCons Subversion repository. This will generate a profile and
58 timing log file for every revision listed with the --number= option,
59 and can be used to look at the impact of committed changes to the SCons
60 code base on a particular configuration over time.
61
62 The other way is to profile incremental changes to a local SCons code
63 base during a development cycle--that is, to look at the performance
64 impact of changes you're making in the local tree. In this mode, you
65 run the scons-time run subcommand without the --svn= option, in which
66 case it simply looks in the profile/log file output directory (the
67 current directory by default) and automatically figures out the next
68 run number for the output profile and log file. Used in this way, the
69 development cycle goes something like: make a change to SCons; run
70 scons-time run to profile it against a specific configuration; make
71 another change to SCons; run scons-time run again to profile it; etc.
72
74 The scons-time command only supports a few global options:
75
76 -h, --help
77 Displays the global help text and exits, identical to the
78 scons-time help subcommand.
79
80 -V, --version
81 Displays the scons-time version and exits.
82
83 Most functionality is controlled by options to the individual
84 subcommands. See the next section for information about individual
85 subcommand options.
86
88 The scons-time command supports the following individual subcommands.
89
90 The func Subcommand
91 scons-time func [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT]
92 [--func=NAME] [-p STRING] [-t NUMBER] [--title= TITLE] [ARGUMENTS]
93
94 The scons-time func subcommand displays timing information for a
95 specific Python function within SCons. By default, it extracts
96 information about the _main() function, which includes the Python
97 profiler timing for all of SCons.
98
99 The scons-time func subcommand extracts function timing information
100 from all the specified file arguments, which should be Python profiler
101 output files. (Normally, these would be *.prof files generated by the
102 scons-time run subcommand, but they can actually be generated by any
103 Python profiler invocation.) All file name arguments will be globbed
104 for on-disk files.
105
106 If no arguments are specified, then function timing information will be
107 extracted from all *.prof files, or the subset of them with a prefix
108 specified by the -p option.
109
110 Options include:
111
112 -C DIRECTORY, --chdir=DIRECTORY
113 Changes to the specified DIRECTORY before looking for the specified
114 files (or files that match the specified patterns).
115
116 -f FILE, --file=FILE
117 Reads configuration information from the specified FILE.
118
119 -fmt=FORMAT, --format=FORMAT
120 Reports the output in the specified FORMAT. The formats currently
121 supported are ascii (the default) and gnuplot.
122
123 --func=NAME
124 Extracts timings for the specified function NAME. The default is to
125 report cumulative timings for the _main() function, which contains
126 the entire SCons run.
127
128 -h, --help
129 Displays help text for the scons-time func subcommand.
130
131 -p STRING, --prefix=STRING
132 Specifies the prefix string for profiles from which to extract
133 function timing information. This will be used to search for
134 profiles if no arguments are specified on the command line.
135
136 -t NUMBER, --tail=NUMBER
137 Only extracts function timings from the last NUMBER files.
138
139 The help Subcommand
140 scons-time help SUBCOMMAND [...] The help subcommand prints help text
141 for any other subcommands listed as later arguments on the command
142 line.
143
144 The mem Subcommand
145 scons-time mem [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
146 [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]
147
148 The scons-time mem subcommand displays how much memory SCons uses.
149
150 The scons-time mem subcommand extracts memory use information from all
151 the specified file arguments, which should be files containing output
152 from running SCons with the --debug=memory option. (Normally, these
153 would be *.log files generated by the scons-time run subcommand.) All
154 file name arguments will be globbed for on-disk files.
155
156 If no arguments are specified, then memory information will be
157 extracted from all *.log files, or the subset of them with a prefix
158 specified by the -p option.
159
160 -C DIR, --chdir=DIR
161 Changes to the specified DIRECTORY before looking for the specified
162 files (or files that match the specified patterns).
163
164 -f FILE, --file=FILE
165 Reads configuration information from the specified FILE.
166
167 -fmt=FORMAT, --format=FORMAT
168 Reports the output in the specified FORMAT. The formats currently
169 supported are ascii (the default) and gnuplot.
170
171 -h, --help
172 Displays help text for the scons-time mem subcommand.
173
174 -p STRING, --prefix=STRING
175 Specifies the prefix string for log files from which to extract
176 memory usage information. This will be used to search for log files
177 if no arguments are specified on the command line.
178
179 --stage=STAGE
180 Prints the memory used at the end of the specified STAGE: pre-read
181 (before the SConscript files are read), post-read , (after the
182 SConscript files are read), pre-build (before any targets are
183 built) or post-build (after any targets are built). If no --stage
184 option is specified, the default behavior is post-build, which
185 reports the final amount of memory used by SCons during each run.
186
187 -t NUMBER, --tail=NUMBER
188 Only reports memory statistics from the last NUMBER files.
189
190 The obj Subcommand
191 scons-time obj [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
192 [--stage=STAGE] [-t NUMBER] [--title=TITLE] [ARGUMENTS]
193
194 The scons-time obj subcommand displays how many objects of a specific
195 named type are created by SCons.
196
197 The scons-time obj subcommand extracts object counts from all the
198 specified file arguments, which should be files containing output from
199 running SCons with the --debug=count option. (Normally, these would be
200 *.log files generated by the scons-time run subcommand.) All file name
201 arguments will be globbed for on-disk files.
202
203 If no arguments are specified, then object counts will be extracted
204 from all *.log files, or the subset of them with a prefix specified by
205 the -p option.
206
207 -C DIR, --chdir=DIR
208 Changes to the specified DIRECTORY before looking for the specified
209 files (or files that match the specified patterns).
210
211 -f FILE, --file=FILE
212 Reads configuration information from the specified FILE.
213
214 -fmt=FORMAT, --format=FORMAT
215 Reports the output in the specified FORMAT. The formats currently
216 supported are ascii (the default) and gnuplot.
217
218 -h, --help
219 Displays help text for the scons-time obj subcommand.
220
221 -p STRING, --prefix=STRING
222 Specifies the prefix string for log files from which to extract
223 object counts. This will be used to search for log files if no
224 arguments are specified on the command line.
225
226 --stage=STAGE
227 Prints the object count at the end of the specified STAGE: pre-read
228 (before the SConscript files are read), post-read , (after the
229 SConscript files are read), pre-build (before any targets are
230 built) or post-build (after any targets are built). If no --stage
231 option is specified, the default behavior is post-build, which
232 reports the final object count during each run.
233
234 -t NUMBER, --tail=NUMBER
235 Only reports object counts from the last NUMBER files.
236
237 The run Subcommand
238 scons-time run [-hnqv] [--aegis=PROJECT] [-f FILE] [--number=NUMBER]
239 [--outdir=OUTDIR] [-p STRING] [--python=PYTHON] [-s DIR]
240 [--scons=SCONS] [--svn=URL] [ARGUMENTS] The scons-time run subcommand
241 is the basic subcommand for profiling a specific configuration against
242 a version of SCons.
243
244 The configuration to be tested is specified as a list of files or
245 directories that will be unpacked or copied into a temporary directory
246 in which SCons will be invoked. The scons-time run subcommand
247 understands file suffixes like .tar, .tar.gz, .tgz and .zip and will
248 unpack their contents into a temporary directory. If more than one
249 argument is specified, each one will be unpacked or copied into the
250 temporary directory "on top of" the previous archives or directories,
251 so the expectation is that multiple specified archives share the same
252 directory layout.
253
254 Once the file or directory arguments are unpacked or copied to the
255 temporary directory, the scons-time run subcommand runs the requested
256 version of SCons against the configuration three times:
257
258 Startup
259 SCons is run with the --help option so that just the SConscript
260 files are read, and then the default help text is printed. This
261 profiles just the perceived "overhead" of starting up SCons and
262 processing the SConscript files.
263
264 Full build
265 SCons is run to build everything specified in the configuration.
266 Specific targets to be passed in on the command l ine may be
267 specified by the targets keyword in a configuration file; see below
268 for details.
269
270 Rebuild
271 SCons is run again on the same just-built directory. If the
272 dependencies in the SCons configuration are correct, this should be
273 an up-to-date, "do nothing" rebuild.
274
275 Each invocation captures the output log file and a profile.
276
277 The scons-time run subcommand supports the following options:
278
279 --aegis=PROJECT
280 Specifies the Aegis PROJECT from which the version(s) of scons
281 being timed will be extracted. When --aegis is specified, the
282 --number=NUMBER option specifies delta numbers that will be tested.
283 Output from each invocation run will be placed in file names that
284 match the Aegis delta numbers. If the --number= option is not
285 specified, then the default behavior is to time the tip of the
286 specified PROJECT.
287
288 -f FILE, --file=FILE
289 Reads configuration information from the specified FILE. This often
290 provides a more convenient way to specify and collect parameters
291 associated with a specific timing configuration than specifying
292 them on the command line. See the CONFIGURATION FILE section below
293 for information about the configuration file parameters.
294
295 -h, --help
296 Displays help text for the scons-time run subcommand.
297
298 -n, --no-exec
299 Do not execute commands, just printing the command-line equivalents
300 of what would be executed. Note that the scons-time script actually
301 executes its actions in Python, where possible, for portability.
302 The commands displayed are UNIX equivalents of what it's doing.
303
304 --number=NUMBER
305 Specifies the run number to be used in the names of the log files
306 and profile outputs generated by this run.
307
308 When used in conjunction with the --aegis=PROJECT option, NUMBER
309 specifies one or more comma-separated Aegis delta numbers that will be
310 retrieved automatically from the specified Aegis PROJECT.
311
312 When used in conjunction with the --svn=URL option, NUMBER specifies
313 one or more comma-separated Subversion revision numbers that will be
314 retrieved automatically from the Subversion repository at the specified
315 URL. Ranges of delta or revision numbers may be specified be separating
316 two numbers with a hyphen (-).
317
318 Example:
319
320 % scons-time run --svn=http://scons.tigris.org/svn/trunk --num=1247,1249-1252 .
321
322 -p STRING, --prefix=STRING
323 Specifies the prefix string to be used for all of the log files and
324 profiles generated by this run. The default is derived from the
325 first specified argument: if the first argument is a directory, the
326 default prefix is the name of the directory; if the first argument
327 is an archive (tar or zip file), the default prefix is the the base
328 name of the archive, that is, what remains after stripping the
329 archive suffix (.tgz, .tar.gz or .zip).
330
331 --python=PYTHON
332 Specifies a path to the Python executable to be used for the timing
333 runs. The default is to use the same Python executable that is
334 running the scons-time command itself.
335
336 -q, --quiet
337 Suppresses display of the command lines being executed.
338
339 -s DIR, --subdir=DIR
340 Specifies the name of directory or subdirectory from which the
341 commands should be executed. The default is XXX
342
343 --scons=SCONS
344 Specifies a path to the SCons script to be used for the timing
345 runs. The default is XXX
346
347 --svn=URL, --subversion=URL
348 Specifies the URL of the Subversion repository from which the
349 version(s) of scons being timed will be extracted. When --svn is
350 specified, the --number=NUMBER option specifies revision numbers
351 that will be tested. Output from each invocation run will be placed
352 in file names that match the Subversion revision numbers. If the
353 --number= option is not specified, then the default behavior is to
354 time the HEAD of the specified URL.
355
356 -v, --verbose
357 Displays the output from individual commands to the screen (in
358 addition to capturing the output in log files).
359
360 The time Subcommand
361 scons-time time [-h] [--chdir=DIR] [-f FILE] [--fmt=FORMAT] [-p STRING]
362 [-t NUMBER] [--title=TITLE] [--which=WHICH] [ARGUMENTS]
363
364 The scons-time time subcommand displays SCons execution times as
365 reported by the scons --debug=time option.
366
367 The scons-time time subcommand extracts SCons timing from all the
368 specified file arguments, which should be files containing output from
369 running SCons with the --debug=time option. (Normally, these would be
370 *.log files generated by the scons-time run subcommand.) All file name
371 arguments will be globbed for on-disk files.
372
373 If no arguments are specified, then execution timings will be extracted
374 from all *.log files, or the subset of them with a prefix specified by
375 the -p option.
376
377 -C DIR, --chdir=DIR
378 Changes to the specified DIRECTORY before looking for the specified
379 files (or files that match the specified patterns).
380
381 -f FILE, --file=FILE
382 Reads configuration information from the specified FILE.
383
384 -fmt=FORMAT, --format=FORMAT
385 Reports the output in the specified FORMAT. The formats currently
386 supported are ascii (the default) and gnuplot.
387
388 -h, --help
389 Displays help text for the scons-time time subcommand.
390
391 -p STRING, --prefix=STRING
392 Specifies the prefix string for log files from which to extract
393 execution timings. This will be used to search for log files if no
394 arguments are specified on the command line.
395
396 -t NUMBER, --tail=NUMBER
397 Only reports object counts from the last NUMBER files.
398
399 --which=WHICH
400 Prints the execution time for the specified WHICH value: total (the
401 total execution time), SConscripts (total execution time for the
402 SConscript files themselves), SCons (exectuion time in SCons code
403 itself) or commands (execution time of the commands and other
404 actions used to build targets). If no --which option is specified,
405 the default behavior is total, which reports the total execution
406 time for each run.
407
409 Various scons-time subcommands can read information from a specified
410 configuration file when passed the -f or --file options. The
411 configuration file is actually executed as a Python script. Setting
412 Python variables in the configuration file controls the behavior of the
413 scons-time script more conveniently than having to specify command-line
414 options or arguments for every run, and provides a handy way to
415 "shrink-wrap" the necessary information for producing (and reporting)
416 consistent timing runs for a given configuration.
417
418 aegis
419 The Aegis executable for extracting deltas. The default is simply
420 aegis.
421
422 aegis_project
423 The Aegis project from which deltas should be extracted. The
424 default is whatever is specified with the --aegis= command-line
425 option.
426
427 archive_list
428 A list of archives (files or directories) that will be copied to
429 the temporary directory in which SCons will be invoked. .tar,
430 .tar.gz, .tgz and .zip files will have their contents unpacked in
431 the temporary directory. Directory trees and files will be copied
432 as-is.
433
434 initial_commands
435 A list of commands that will be executed before the actual timed
436 scons runs. This can be used for commands that are necessary to
437 prepare the source tree-for example, creating a configuration file
438 that should not be part of the timed run.
439
440 key_location
441 The location of the key on Gnuplot graphing information generated
442 with the --format=gnuplot option. The default is bottom left.
443
444 prefix
445 The file name prefix to be used when running or extracting timing
446 for this configuration.
447
448 python
449 The path name of the Python executable to be used when running or
450 extracting information for this configuration. The default is the
451 same version of Python used to run the SCons
452
453 scons
454 The path name of the SCons script to be used when running or
455 extracting information for this configuration. The default is
456 simply scons.
457
458 scons_flags
459 The scons flags used when running SCons to collect timing
460 information. The default value is --debug=count --debug=memory
461 --debug=time --debug=memoizer.
462
463 scons_lib_dir, scons_wrapper, startup_targets, subdir
464 The subdirectory of the project into which the scons-time script
465 should change before executing the SCons commands to time.
466
467 subversion_url
468 The Subversion URL from
469
470 svn
471 The subversion executable used to check out revisions of SCons to
472 be timed. The default is simple svn.
473
474 svn_co_flag, tar, targets
475 A string containing the targets that should be added to the command
476 line of every timed scons run. This can be used to restrict what's
477 being timed to a subset of the full build for the configuration.
478
479 targets0, targets1, targets2, title, unzip, verbose, vertical_bars
480
481 Example
482 Here is an example scons-time configuration file for a hypothetical
483 sample project:
484
485 # The project doesn't use SCons natively (yet), so we're
486 # timing a separate set of SConscript files that we lay
487 # on top of the vanilla unpacked project tarball.
488 arguments = ['project-1.2.tgz', 'project-SConscripts.tar']
489
490 # The subdirectory name contains the project version number,
491 # so tell scons-time to chdir there before building.
492 subdir = 'project-1.2'
493
494 # Set the prefix so output log files and profiles are named:
495 # project-000-[012].{log,prof}
496 # project-001-[012].{log,prof}
497 # etc.
498 prefix = 'project'
499
500 # The SConscript files being tested don't do any SConf
501 # configuration, so run their normal ./configure script
502 # before we invoke SCons.
503 initial_commands = [
504 './configure',
505 ]
506
507 # Only time building the bin/project executable.
508 targets = 'bin/project'
509
510 # Time against SCons revisions of the branches/core branch
511 subversion_url = 'http://scons.tigris.org/svn/scons/branches/core'
512
514 The scons-time script uses the following environment variables:
515
516 PRESERVE
517 If this value is set, the scons-time script will not remove the
518 temporary directory or directories in which it builds the specified
519 configuration or downloads a specific version of SCons.
520
522 gnuplot(1), scons(1)
523
525 Steven Knight <knight at baldmt dot com>
526
527
528
529SCons 3.0.1 11/14/2017 SCONS-TIME(1)