public virtual void Complete() { if (isSuppressed) { return; } if (isCompleted) { throw new InvalidOperationException(Strings.ExMeasurementIsAlreadyCompleted); } isCompleted = true; timeSpent = HighResolutionTime.Now.Subtract(initialTime); memoryAllocated = GC.GetTotalMemory((options & MeasurementOptions.CollectGarbageOnLeave) > 0) - initialBytesAllocated; if ((options & MeasurementOptions.Log) > 0) { if ((options & MeasurementOptions.LogEnter) > 0) { CoreLog.Info("Measurement: Leave {0}.", this); } else { CoreLog.Info("Measurement: {0}.", this); } } }
private void button1_Click(object sender, EventArgs e) { var xcs = Convert.ToInt32(textBox2.Text); var xccs = Convert.ToInt32(textBox3.Text); for (var i = 0; i < xcs; i++) { var i1 = i; new Thread(() => { CoreLog.Info("xc :" + i1 + " Start"); var cc = new CoreClient(textBox1.Text); for (var j = 0; j < xccs; j++) { CoreLog.Info("xc :" + i1 + " j :" + j + " ks"); var n = CorePublic.GenerateId(); var user = new user { id = n, name = i1 + "并发测试" + j }; var ret = cc.Send <int>("Insert", user); CoreLog.Info("id :" + n + " xc :" + i1 + " j :" + j + " " + (ret == 1)); Thread.Sleep(10); } } ).Start(); } }
/// <inheritdoc/> /// <exception cref="ArgumentOutOfRangeException"><c>hints.SourceModel</c> or <c>hints.TargetModel</c> /// is out of range.</exception> public Difference Compare(IModel source, IModel target, HintSet hints) { Source = source; Target = target; Hints = hints ?? new HintSet(Source, Target); if (Hints.SourceModel != Source) { throw new ArgumentOutOfRangeException("hints.SourceModel"); } if (Hints.TargetModel != Target) { throw new ArgumentOutOfRangeException("hints.TargetModel"); } var previous = currentAsync.Value; currentAsync.Value = this; Results = new Dictionary <object, Difference>(); try { Stage = ComparisonStage.BaseComparison; Visit(Source, Target); CoreLog.Info("Base comparison complete."); Stage = ComparisonStage.ReferenceComparison; return(Visit(Source, Target)); } finally { currentAsync.Value = previous; Results = null; } }
public static void LogInfo(Type type, params object[] messages) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < messages.Length; i++) { sb.Append(messages[i]); } CoreLog.Info(ReplaceNewLines(String.Format(TypeBldStr, type, sb.ToString()))); }
/// <summary> /// Initializes new instance of this type. /// </summary> /// <param name="name">The measurement name.</param> /// <param name="options">The measurement options.</param> /// <param name="operationCount">The operation count.</param> public Measurement(string name, MeasurementOptions options, int operationCount) { this.options = options; this.operationCount = operationCount; Name = name; if ((options & MeasurementOptions.LogEnter) > 0) { CoreLog.Info("Measurement: Enter {0}.", FullName); } initialBytesAllocated = GC.GetTotalMemory((options & MeasurementOptions.CollectGarbageOnEnter) > 0); initialTime = HighResolutionTime.Now; }
/// <inheritdoc/> public virtual void Dump() { if (Count == 0) { CoreLog.Info("None"); return; } foreach (var node in list) { node.Dump(); } }
private void button2_Click(object sender, EventArgs e) { var cc = new CoreClient(textBox1.Text); CoreLog.Info(" ks"); var n = CorePublic.GenerateId(); var user = new user { id = n, name = "单次测试" }; var ret = cc.Send <int>("Insert", user); CoreLog.Info("id :" + n + " " + (ret == 1)); MessageBox.Show(@"调用成功返回:" + ret); }
/// <summary> /// Generate actions for specific <see cref="UpgradeStage"/>. /// </summary> /// <param name="stage">The stage.</param> /// <param name="action">The parent action.</param> protected void ProcessStage(UpgradeStage stage, GroupingNodeAction action) { Stage = stage; if (stage == UpgradeStage.Upgrade) { UpdateHints(); Difference = Comparer.Compare(CurrentModel, TargetModel, Hints); } var stageActions = Visit(Difference); if (stageActions != null) { action.Add(stageActions); } CoreLog.Info(string.Format("Stage {0} complete.", stage)); }
private void button2_Click(object sender, EventArgs e) { var cc = new WsSoapClient(); cc.Endpoint.Address = new EndpointAddress(textBox1.Text); CoreLog.Info(" ks"); var n = CorePublic.GenerateId(); var user = new user { id = n, name = "单次测试" }; var ret = cc.Insert(user); CoreLog.Info("id :" + n + " " + ret); MessageBox.Show(@"调用成功返回:" + ret); cc.Close(); }
/// <inheritdoc/> /// <exception cref="ArgumentOutOfRangeException"><c>hints.SourceModel</c> or <c>hints.TargetModel</c> /// is out of range.</exception> /// <exception cref="InvalidOperationException">Upgrade sequence validation has failed.</exception> public ReadOnlyList <NodeAction> GetUpgradeSequence(Difference difference, HintSet hints, IComparer comparer) { ArgumentValidator.EnsureArgumentNotNull(hints, nameof(hints)); ArgumentValidator.EnsureArgumentNotNull(comparer, nameof(comparer)); if (difference == null) { return(new ReadOnlyList <NodeAction>(Enumerable.Empty <NodeAction>().ToList())); } TemporaryRenames = new Dictionary <string, Node>(StringComparer.OrdinalIgnoreCase); SourceModel = (IModel)difference.Source; TargetModel = (IModel)difference.Target; Hints = hints ?? new HintSet(SourceModel, TargetModel); Comparer = comparer; if (Hints.SourceModel != SourceModel) { throw new ArgumentOutOfRangeException("hints.SourceModel"); } if (Hints.TargetModel != TargetModel) { throw new ArgumentOutOfRangeException("hints.TargetModel"); } CurrentModel = (IModel)SourceModel.Clone(null, SourceModel.Name); Difference = difference; var previous = currentAsync.Value; currentAsync.Value = this; using (NullActionHandler.Instance.Activate()) { try { var actions = new GroupingNodeAction(); ProcessStage(UpgradeStage.CleanupData, actions); ProcessStage(UpgradeStage.Prepare, actions); ProcessStage(UpgradeStage.TemporaryRename, actions); ProcessStage(UpgradeStage.Upgrade, actions); ProcessStage(UpgradeStage.CopyData, actions); ProcessStage(UpgradeStage.PostCopyData, actions); ProcessStage(UpgradeStage.Cleanup, actions); var validationHints = new HintSet(CurrentModel, TargetModel); Hints.OfType <IgnoreHint>() .Where(h => CurrentModel.Resolve(h.Path, false) != null && SourceModel.Resolve(h.Path, false) != null) .ForEach(validationHints.Add); var diff = comparer.Compare(CurrentModel, TargetModel, validationHints); if (diff != null) { CoreLog.InfoRegion(Strings.LogAutomaticUpgradeSequenceValidation); CoreLog.Info(Strings.LogValidationFailed); CoreLog.Info(Strings.LogItemFormat, Strings.Difference); CoreLog.Info("{0}", diff); CoreLog.Info(Strings.LogItemFormat + "\r\n{1}", Strings.UpgradeSequence, new ActionSequence() { actions }); CoreLog.Info(Strings.LogItemFormat, Strings.ExpectedTargetModel); TargetModel.Dump(); CoreLog.Info(Strings.LogItemFormat, Strings.ActualTargetModel); CurrentModel.Dump(); throw new InvalidOperationException(Strings.ExUpgradeSequenceValidationFailure); } return(new ReadOnlyList <NodeAction>(actions.Actions, true)); } finally { currentAsync.Value = previous; } } }
public static void Info(object message, Object context) { CoreLog.Info(message, context); }
public static void Info(object message) { CoreLog.Info(message); }
public static void LogInfo(Type type, object message) { CoreLog.Info(ReplaceNewLines(String.Format(TypeBldStr, type, message))); }
/// <summary> /// Uses the string format to write log information using the provided culture. /// </summary> /// <param name="info">The culture information to format the string.</param> /// <param name="type">The class instance type.</param> /// <param name="format">The string format.</param> /// <param name="values">The string values that go with the format.</param> public static void LogInfoStrFormat(Type type, CultureInfo info, string format, params string[] values) { CoreLog.Info(ReplaceNewLines(String.Format(info, format, values))); }