mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
(fix tree burn; no bug): The js/src subtree needs its own copy of pgomerge.py.
--HG-- rename : build/win32/pgomerge.py => js/src/build/win32/pgomerge.py
This commit is contained in:
parent
1c4ac98a6c
commit
4b4e1290be
40
js/src/build/win32/pgomerge.py
Executable file
40
js/src/build/win32/pgomerge.py
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/python
|
||||
# Usage: pgomerge.py <binary basename> <dist/bin>
|
||||
# Gathers .pgc files from dist/bin and merges them into
|
||||
# $PWD/$basename.pgd using pgomgr, then deletes them.
|
||||
# No errors if any of these files don't exist.
|
||||
|
||||
import sys, os, os.path, subprocess
|
||||
if not sys.platform == "win32":
|
||||
raise Exception("This script was only meant for Windows.")
|
||||
|
||||
def MergePGOFiles(basename, pgddir, pgcdir):
|
||||
"""Merge pgc files produced from an instrumented binary
|
||||
into the pgd file for the second pass of profile-guided optimization
|
||||
with MSVC. |basename| is the name of the DLL or EXE without the
|
||||
extension. |pgddir| is the path that contains <basename>.pgd
|
||||
(should be the objdir it was built in). |pgcdir| is the path
|
||||
containing basename!N.pgc files, which is probably dist/bin.
|
||||
Calls pgomgr to merge each pgc file into the pgd, then deletes
|
||||
the pgc files."""
|
||||
if not os.path.isdir(pgddir) or not os.path.isdir(pgcdir):
|
||||
return
|
||||
pgdfile = os.path.abspath(os.path.join(pgddir, basename + ".pgd"))
|
||||
if not os.path.isfile(pgdfile):
|
||||
return
|
||||
for file in os.listdir(pgcdir):
|
||||
if file.startswith(basename) and file.endswith(".pgc"):
|
||||
try:
|
||||
pgcfile = os.path.normpath(os.path.join(pgcdir, file))
|
||||
subprocess.call(['pgomgr', '-merge',
|
||||
pgcfile,
|
||||
pgdfile])
|
||||
os.remove(pgcfile)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print >>sys.stderr, "Usage: pgomerge.py <binary basename> <dist/bin>"
|
||||
sys.exit(1)
|
||||
MergePGOFiles(sys.argv[1], os.getcwd(), sys.argv[2])
|
@ -57,7 +57,7 @@ def fnmatch_any(filename, patterns):
|
||||
return True
|
||||
return False
|
||||
|
||||
# Check the contents of COPY/SUBDIR against ORIGINAL/SUBDIR. For each
|
||||
# Check the contents of the directory tree COPY against ORIGINAL. For each
|
||||
# file that differs, apply REPORT to COPY, ORIGINAL, and the file's
|
||||
# relative path. COPY and ORIGINAL should be absolute. Ignore files
|
||||
# that match patterns given in the list IGNORE.
|
||||
|
Loading…
Reference in New Issue
Block a user