Bug 59351 - Get per-file compile times
Summary: Get per-file compile times
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-25 14:59 PDT by Nico Weber
Modified: 2012-08-14 12:41 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2011-04-25 14:59:37 PDT
Several approaches:
* ninja outputs these automatically into ninja.log
* Or one can set CC to a wrapper script that does `time gcc $*` and then writes the time somewhere (e.g. just >> to some log file, that's probably easiest)

(https://github.com/nico/complete/blob/master/server/builddb-cc is an overdesigned cc replacement that also injects a clang plugin and writes to a sqlite db. Mostly useful for entertainment purposes, but it also shows how to set CC so that xcodebuild sees it)
Comment 1 Eric Seidel (no email) 2011-04-25 15:22:41 PDT
timing-cc:

#!/bin/bash
echo $* >> /tmp/time.txt
(time gcc "$@") 2>> /tmp/time.txt

CC=/path/to/timing-cc build-webkit

seems to work.  Seems to spit out a bunch of junk at the top of the file, but I think that's just normal gcc stderr output which is normally not displayed by xcodebuild.
Comment 2 Eric Seidel (no email) 2011-04-25 16:22:25 PDT
Follow-up from Sam's session.
Comment 3 Evan Martin 2011-04-25 16:43:22 PDT
You probably will want to lock the output file to prevent parallel gcc processes from interleaving.  Otherwise Eric's script LGTM.