Skip to content

Commit

Permalink
Make RunTransformsOnAllFunctions actually obey the threading setting.…
Browse files Browse the repository at this point in the history
… Whoops.

Write the elapsed translation time into the jsillog file.
  • Loading branch information
kg committed Mar 7, 2013
1 parent bae5da8 commit 43760d0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions Compiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ IEnumerable<KeyValuePair<string, string[]>> ignoredMethods
var logText = new StringBuilder();
var asmName = Assembly.GetExecutingAssembly().GetName();
logText.AppendLine(String.Format("// JSILc v{0}.{1}.{2}", asmName.Version.Major, asmName.Version.Minor, asmName.Version.Revision));
logText.AppendLine(String.Format("// Build took {0:0000.00} second(s).", outputs.Elapsed.TotalSeconds));
logText.AppendLine(String.Format("// The following configuration was used when translating '{0}':", inputFile));
logText.AppendLine((new JavaScriptSerializer()).Serialize(configuration));
logText.AppendLine("// The configuration was generated from the following configuration files:");
Expand Down
6 changes: 5 additions & 1 deletion JSIL/AssemblyTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ protected virtual string FormatOutputFilename (AssemblyNameDefinition assemblyNa
public TranslationResult Translate (
string assemblyPath, bool scanForProxies = true
) {
var sw = Stopwatch.StartNew();

if (Configuration.RunBugChecks.GetValueOrDefault(true))
BugChecks.RunBugChecks();
else
Expand Down Expand Up @@ -455,6 +457,8 @@ public TranslationResult Translate (

pr.OnFinished();

sw.Stop();
result.Elapsed = sw.Elapsed;
return result;
}

Expand Down Expand Up @@ -567,7 +571,7 @@ protected void RunTransformsOnAllFunctions (ParallelOptions parallelOptions, Pro
if (Configuration.CodeGenerator.EnableThreadedTransforms.GetValueOrDefault(true)) {
Parallel.ForEach(
FunctionCache.PendingTransformsQueue.TryDequeueAll,
itemHandler
parallelOptions, itemHandler
);
} else {
QualifiedMemberIdentifier _id;
Expand Down
1 change: 1 addition & 0 deletions JSIL/TranslationResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public struct ResultFile {
public readonly List<string> FileOrder = new List<string>();
public readonly Dictionary<string, ResultFile> Files = new Dictionary<string, ResultFile>();
public readonly StringBuilder Log = new StringBuilder();
public TimeSpan Elapsed;
public ArraySegment<byte> Manifest;

internal TranslationResult (Configuration configuration) {
Expand Down
2 changes: 1 addition & 1 deletion build_corlib.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bin\JSILc "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" "Corlib\corlib.jsilconfig"
bin\JSILc "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" "Corlib\corlib.jsilconfig" %*

0 comments on commit 43760d0

Please sign in to comment.