Profile a few more things

This commit is contained in:
David Greenspan
2016-01-29 22:45:25 -08:00
parent 213deebf26
commit d3749485be
3 changed files with 17 additions and 3 deletions

View File

@@ -59,7 +59,9 @@ BCp.processFilesForTarget = function (inputFiles) {
babelOptions.sourceMapTarget = babelOptions.filename + ".map";
try {
var result = Babel.compile(source, babelOptions);
var result = profile('Babel.compile', function () {
return Babel.compile(source, babelOptions);
});
} catch (e) {
if (e.loc) {
inputFile.error({
@@ -86,3 +88,11 @@ BCp.processFilesForTarget = function (inputFiles) {
BCp.setDiskCacheDirectory = function (cacheDir) {
Babel.setCacheDir(cacheDir);
};
function profile(name, func) {
if (typeof Profile !== 'undefined') {
return Profile.time(name, func);
} else {
return func();
}
};

View File

@@ -823,6 +823,8 @@ files.renameDirAlmostAtomically = function (fromDir, toDir) {
files.rm_recursive(garbageDir);
}
};
files.renameDirAlmostAtomically = Profile("files.renameDirAlmostAtomically",
files.renameDirAlmostAtomically);
files.writeFileAtomically = function (filename, contents) {
var tmpFile = files.pathJoin(
@@ -831,6 +833,8 @@ files.writeFileAtomically = function (filename, contents) {
files.writeFile(tmpFile, contents);
files.rename(tmpFile, filename);
};
files.writeFileAtomically = Profile("files.writeFileAtomically",
files.writeFileAtomically);
// Like fs.symlinkSync, but creates a temporay link and renames it over the
// file; this means it works even if the file already exists.

View File

@@ -323,7 +323,7 @@ var lintUnibuild = function ({isopack, isopackCache, sourceArch}) {
// options.isopack.
//
// Returns a list of source files that were used in the compilation.
var compileUnibuild = function (options) {
var compileUnibuild = Profile("compileUnibuild", function (options) {
buildmessage.assertInCapture();
const isopk = options.isopack;
@@ -609,7 +609,7 @@ api.addAssets('${relPath}', 'client').`);
return {
pluginProviderPackageNames: pluginProviderPackageNames
};
};
});
function runLinters({inputSourceArch, isopackCache, sources,
sourceProcessorSet, watchSet}) {