Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Microsoft.ML.Core/Data/ProgressReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public CalculationInfo(int index, string name, ProgressChannel channel)
Index = index;
Name = name;
PendingCheckpoints = new ConcurrentQueue<KeyValuePair<DateTime, ProgressEntry>>();
StartTime = DateTime.Now;
StartTime = DateTime.UtcNow;
Channel = channel;
}
}
Expand Down Expand Up @@ -584,7 +584,7 @@ public ProgressEvent(int index, string name, DateTime startTime, ProgressEntry e
Index = index;
Name = name;
StartTime = startTime;
EventTime = DateTime.Now;
EventTime = DateTime.UtcNow;
Kind = EventKind.Progress;
ProgressEntry = entry;
}
Expand All @@ -597,7 +597,7 @@ public ProgressEvent(int index, string name, DateTime startTime, EventKind kind)
Index = index;
Name = name;
StartTime = startTime;
EventTime = DateTime.Now;
EventTime = DateTime.UtcNow;
Kind = kind;
ProgressEntry = null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Data/Utilities/TimerScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void Dispose()

// REVIEW: This is \n\n is to prevent changes across bunch of baseline files.
// Ideally we should change our comparison method to ignore empty lines.
_ch.Info("{0}\t Time elapsed(s): {1}\n\n", DateTime.Now, elapsedSeconds);
_ch.Info("{0}\t Time elapsed(s): {1}\n\n", DateTime.UtcNow, elapsedSeconds);

using (var pipe = _host.StartPipe<TelemetryMessage>("TelemetryPipe"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace Microsoft.ML.Runtime.FastTree.Internal
{
Expand Down Expand Up @@ -164,7 +165,8 @@ public unsafe void SetTreeScores(int idx, double[] scores)

private LassoFit GetLassoFit(IChannel ch, int maxAllowedFeaturesPerModel)
{
DateTime startTime = DateTime.Now;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick note, not major: Stopwatch.StartNew() is made to serve this common case where you both want to create and start a stopwatch. (Not a blocking comment to be clear, only if you happen to post another iteration for some other reason anyway.)


if (maxAllowedFeaturesPerModel < 0)
{
Expand Down Expand Up @@ -450,8 +452,8 @@ private LassoFit GetLassoFit(IChannel ch, int maxAllowedFeaturesPerModel)
// First lambda was infinity; fixing it
fit.Lambdas[0] = Math.Exp(2 * Math.Log(fit.Lambdas[1]) - Math.Log(fit.Lambdas[2]));

TimeSpan duration = DateTime.Now - startTime;
ch.Info("Elapsed time for compression: {0}", duration);
stopWatch.Stop();
ch.Info("Elapsed time for compression: {0}", stopWatch.Elapsed);

return fit;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.FastTree/TreeEnsemble/Ensemble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public string ToTreeEnsembleIni(FeaturesToContentMap fmap,

protected int AppendComments(StringBuilder sb, string trainingParams)
{
sb.AppendFormat("\n\n[Comments]\nC:0=Regression Tree Ensemble\nC:1=Generated using FastTree\nC:2=Created on {0}\n", DateTime.Now);
sb.AppendFormat("\n\n[Comments]\nC:0=Regression Tree Ensemble\nC:1=Generated using FastTree\nC:2=Created on {0}\n", DateTime.UtcNow);

string[] trainingParamsList = trainingParams.Split(new char[] { '\n' });
int i = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Maml/MAML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ internal static int MainCore(TlcEnvironment env, string args, bool alwaysPrintSt
Path.GetTempPath(),
"TLC");
var dumpFilePath = Path.Combine(dumpFileDir,
string.Format(CultureInfo.InvariantCulture, "Error_{0:yyyyMMdd_HHmmss}_{1}.log", DateTime.Now, Guid.NewGuid()));
string.Format(CultureInfo.InvariantCulture, "Error_{0:yyyyMMdd_HHmmss}_{1}.log", DateTime.UtcNow, Guid.NewGuid()));
bool isDumpSaved = false;
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.ResultProcessor/ResultProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ private static bool ValidateMamlOutput(string filename, string[] rawLines, out L
Results = runResults,
PerFoldResults = foldResults,
Time = 0,
ExecutionDate = DateTime.Now.ToString()
ExecutionDate = DateTime.UtcNow.ToString()
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected virtual void InitCore(IChannel ch, int numFeatures, LinearPredictor pr
Contracts.Assert(Iteration == 0);
Contracts.Assert(Bias == 0);

ch.Trace("{0} Initializing {1} on {2} features", DateTime.Now, Name, numFeatures);
ch.Trace("{0} Initializing {1} on {2} features", DateTime.UtcNow, Name, numFeatures);
NumFeatures = numFeatures;

// We want a dense vector, to prevent memory creation during training
Expand Down Expand Up @@ -253,13 +253,13 @@ protected virtual void BeginIteration(IChannel ch)
Iteration++;
NumIterExamples = 0;

ch.Trace("{0} Starting training iteration {1}", DateTime.Now, Iteration);
ch.Trace("{0} Starting training iteration {1}", DateTime.UtcNow, Iteration);
// #if OLD_TRACING // REVIEW: How should this be ported?
if (Iteration % 20 == 0)
{
Console.Write('.');
if (Iteration % 1000 == 0)
Console.WriteLine(" {0} \t{1}", Iteration, DateTime.Now);
Console.WriteLine(" {0} \t{1}", Iteration, DateTime.UtcNow);
}
// #endif
}
Expand All @@ -269,7 +269,7 @@ protected virtual void FinishIteration(IChannel ch)
Contracts.Check(NumIterExamples > 0, NoTrainingInstancesMessage);

ch.Trace("{0} Finished training iteration {1}; iterated over {2} examples.",
DateTime.Now, Iteration, NumIterExamples);
DateTime.UtcNow, Iteration, NumIterExamples);

ScaleWeights();
#if OLD_TRACING // REVIEW: How should this be ported?
Expand Down Expand Up @@ -378,7 +378,7 @@ protected virtual void ProcessDataInstance(IChannel ch, ref VBuffer<Float> feat,
if (_numIterExamples % 5000000 == 0)
{
Host.StdOut.Write(" ");
Host.StdOut.Write(DateTime.Now);
Host.StdOut.Write(DateTime.UtcNow);
}
Host.StdOut.WriteLine();
}
Expand Down