/// <summary> /// Returns the best matching start page for the given locale names /// </summary> /// <param name="currentPage"></param> /// <param name="names">array</param> /// <returns></returns> public static LanguageRoot GetFirstMatchingLanguageRootOrDefault(ContentItem currentPage, IEnumerable<string> names) { #if DEBUG_T Stopwatch timer = new Stopwatch(); timer.Start(); #endif LanguageRoot translation = null; var translations = CmsFinder.FindTranslationsOf(currentPage).ToArray(); if (translations.Length == 1) translation = translations.First(); // no options, why check else if (names != null) { var locales = GetLocalesFromUserLanguages(names).ToArray(); // match full locales list translation = translations.FirstOrDefault(t => locales.Any(l => t.LanguageCode.StartsWith(l, StringComparison.InvariantCultureIgnoreCase))) ?? translations.FirstOrDefault(t => locales.Any(l => t.LanguageCode.StartsWith(l.Substring(0, 2), StringComparison.InvariantCultureIgnoreCase))); } if (translation == null) translation = translations.FirstOrDefault(); // TODO use configured default, otherwise assume first by sort order if (translation == null) throw new Exception("no translations found for " + currentPage); #if DEBUG_T timer.Stop(); locales = locales ?? GetLocalesFromUserLanguages(names).ToArray(); // can contain en-us, en, de-de etc. var codes = String.Join(", ", translations.Select(t => t.LanguageCode)); Logger.InfoFormat("{3} ms LanguageRoot from locales {0} and translations {1} => {2}", String.Join(", ", locales), codes, translation, timer.Elapsed.TotalMilliseconds); #endif return translation; }
public override void OnResultExecuted(ResultExecutedContext filterContext) { base.OnResultExecuted(filterContext); #if Page_Trace Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); #endif if (Page_Context.Current.PageRequestContext != null) { var site = Page_Context.Current.PageRequestContext.Site; var page = Page_Context.Current.PageRequestContext.Page.AsActual(); var outputTextWriterWrapper = filterContext.HttpContext.Response.Output as OutputTextWriterWrapper; if (outputTextWriterWrapper != null && !(filterContext.Result is CachedContentResult) && filterContext.Exception == null && filterContext.HttpContext.Response.ContentType.ToLower().Contains("text/html")) { var html = outputTextWriterWrapper.ToString(); var htmlParser = Kooboo.CMS.Common.Runtime.EngineContext.Current.TryResolve<IHtmlParser>(); if (htmlParser != null) { html = htmlParser.Parse(html); outputTextWriterWrapper.Flush(); outputTextWriterWrapper.Write(html); } } } #if Page_Trace stopwatch.Stop(); filterContext.HttpContext.Response.Write(string.Format("PageHtmlParserActionFilter.OnResultExecuted, {0}ms.</br>", stopwatch.ElapsedMilliseconds)); #endif }
public override void OnActionExecuting(ActionExecutingContext filterContext) { #if Page_Trace Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); #endif base.OnActionExecuting(filterContext); var page = Page_Context.Current.PageRequestContext.Page.AsActual(); var site = Page_Context.Current.PageRequestContext.Site; if ((!filterContext.HttpContext.User.Identity.IsAuthenticated) && page.EnabledCache && filterContext.HttpContext.Request.HttpMethod.ToUpper() == "GET") { SetCache(page, filterContext.HttpContext, page.OutputCache.Duration, "*"); var cacheKey = GetOutputCacheKey(filterContext.HttpContext, page); var outputCache = site.ObjectCache().Get(cacheKey); if (outputCache != null) { filterContext.Result = new CachedContentResult() { Content = outputCache.ToString(), ContentType = "text/html" }; } } #if Page_Trace stopwatch.Stop(); filterContext.HttpContext.Response.Write(string.Format("OutputCacheFilterAttribute.OnActionExecuting, {0}ms.</br>", stopwatch.ElapsedMilliseconds)); #endif }
static void Main(string[] args) { Console.Write("Press enter to start the timer."); Console.ReadLine(); Stopwatch watch = new Stopwatch(); watch.Start(); Console.Write("Press enter to stop the timer."); Console.ReadLine(); watch.Stop(); Console.ReadLine(); }
public void Run() { Console.WriteLine("StopWatchTest"); // Prompt var stopwatch = new Stopwatch(); Console.WriteLine("Start stopwatch"); // Prompt stopwatch.StartNew(); Console.WriteLine("Start long process"); // Prompt Thread.Sleep(3000); Console.WriteLine("Passed {0}", stopwatch.TimePassed()); // Prompt Console.WriteLine("Stop stopwatch"); // Prompt stopwatch.Stop(); Console.ReadKey(); }
public static void Main(string[] args) { //first assignment var clock = new Stopwatch(); clock.Start (); clock.Stop (); Console.WriteLine ("Duration" + clock.Span ()); //second assignment var post = new Post(); post.title = "The amazing Rachel"; post.UpVote(); post.UpVote(); post.DownVote(); post.DisplayVotes(); }
private PageRequestContext CreatePageRequestContext(ControllerContext controllerContext) { FrontControllerBase frontController = (FrontControllerBase)controllerContext.Controller; string pageUrl = frontController.RequestUrl; #if Page_Trace Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); #endif //pageUrl: product/detail/product1 var rawPage = Services.ServiceFactory.PageManager.GetPageByUrl(frontController.Site, pageUrl); if (rawPage == null) { throw new HttpException(0x194, string.Format(SR.GetString("Path_not_found"), new object[] { frontController.Request.Path })); } var requestUrl = pageUrl; if (pageUrl.Length >= rawPage.VirtualPath.Length) { requestUrl = pageUrl.Substring(rawPage.VirtualPath.Length); } var page = Services.ServiceFactory.ABPageSettingManager.MatchRule(frontController.Site, rawPage, controllerContext.HttpContext); #if Page_Trace stopwatch.Stop(); controllerContext.HttpContext.Response.Write(string.Format("GetPageByUrl, {0}ms.</br>", stopwatch.ElapsedMilliseconds)); #endif var draft = controllerContext.RequestContext.GetRequestValue("_draft_"); if (!string.IsNullOrEmpty(draft) && draft.ToLower() == "true") { page = Services.ServiceFactory.PageManager.Provider.GetDraft(page); frontController.FrontHttpRequest.RequestChannel = FrontRequestChannel.Draft; } else { EnsurePagePublished(frontController, page); } return new PageRequestContext(controllerContext, frontController.FrontHttpRequest.RawSite, frontController.Site, rawPage, page, frontController.FrontHttpRequest.RequestChannel, requestUrl); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { #if Page_Trace Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); #endif base.OnActionExecuting(filterContext); var controllerContext = filterContext.Controller.ControllerContext; PageRequestModuleExecutor.OnResolvingPage(controllerContext); var pageRequestContext = CreatePageRequestContext(controllerContext); PageRequestModuleExecutor.OnResolvedPage(controllerContext, pageRequestContext); Page_Context.Current.InitContext(pageRequestContext, controllerContext); #if Page_Trace stopwatch.Stop(); filterContext.HttpContext.Response.Write(string.Format("PageExecutionFilterAttribute.OnActionExecuting, {0}ms.</br>", stopwatch.ElapsedMilliseconds)); #endif }
private void OnGetEventsCompleted(object sender, FacebookApiEventArgs e) { RFBClient.GetCompleted -= new EventHandler<FacebookApiEventArgs>(OnGetEventsCompleted); if (e.Error == null) { #if !DEBUG Stopwatch OStop = new Stopwatch(); Console.WriteLine("Friends Fetching Started .."); OStop.Start(); #endif var result = (IDictionary<string, object>)e.GetResultData(); ObservableCollection<Event> FriendList = new ObservableCollection<Event>(); //if (Verifier.Verify(ResultsObject, "data")) // ResultsArray = ResultsObject["data"] as JsonArray; var dataItem = (JsonArray)result["data"]; foreach (JsonObject item in dataItem) { FriendList.Add(new Event(item)); } OnEventListUpdated(FriendList); #if !DEBUG Console.WriteLine("Friends Fetching Finished in " + OStop.ElapsedMilliseconds); OStop.Stop(); #endif //FinishedEvents.NotifyFriendsDataFinished(true, FriendList); } else { //FinishedEvents.NotifyFriendsDataFinished(false, null); } }
public IChunk GenerateChunk(IChunk chunk, int x, int z, bool external) { InitGen(); #if PROFILE Stopwatch watch = new Stopwatch(); watch.Start(); #endif GenerateTerrain(chunk, x, z); GenerateFlora(chunk, x, z); if (!external) { chunk.RecalculateHeight(); chunk.LightToRecalculate = true; #if PROFILE watch.Stop(); _World.Logger.Log(Logger.LogLevel.Info, "Chunk {0} {1}, {2}", false, x, z, watch.ElapsedMilliseconds); #endif _World.AddChunk(chunk); chunk.MarkToSave(); } return chunk; }
public void TestNextValidRandom() { const int numberOfIterations = 10000; // Use to allow sequential testing for easier debugging or average timing const bool parallel = true; Random random = new Random(); Calendar calendar = CultureInfo.CurrentCulture.Calendar; Action<int> testAction = iteration => { // Random initial DateTime int year = random.Next(1, 9999); int month = random.Next(1, 13); int daysInMonth = calendar.GetDaysInMonth(year, month); int day = random.Next(1, daysInMonth); DateTime startDateTime = new DateTime( year, month, day, random.Next(24), random.Next(60), random.Next(60)); // Random incrementation int incrementationType = random.Next(5); string incrementationTypeName; int incrementationAmount; DateTime expectedDateTime; switch (incrementationType) { default: case 0: incrementationTypeName = "Month"; incrementationAmount = random.Next(12 - startDateTime.Month); expectedDateTime = calendar.AddMonths( startDateTime, incrementationAmount); if (incrementationAmount > 0) { expectedDateTime = new DateTime( expectedDateTime.Year, expectedDateTime.Month, 1, 0, 0, 0); } break; case 1: incrementationTypeName = "Day"; incrementationAmount = random.Next(daysInMonth - startDateTime.Day); expectedDateTime = calendar.AddDays( startDateTime, incrementationAmount); if (incrementationAmount > 0) { expectedDateTime = new DateTime( expectedDateTime.Year, expectedDateTime.Month, expectedDateTime.Day, 0, 0, 0); } break; case 2: incrementationTypeName = "Hour"; incrementationAmount = random.Next(24 - startDateTime.Hour); expectedDateTime = calendar.AddHours( startDateTime, incrementationAmount); if (incrementationAmount > 0) { expectedDateTime = new DateTime( expectedDateTime.Year, expectedDateTime.Month, expectedDateTime.Day, expectedDateTime.Hour, 0, 0); } break; case 3: incrementationTypeName = "Minute"; incrementationAmount = random.Next(60 - startDateTime.Minute); expectedDateTime = calendar.AddMinutes( startDateTime, incrementationAmount); if (incrementationAmount > 0) { expectedDateTime = new DateTime( expectedDateTime.Year, expectedDateTime.Month, expectedDateTime.Day, expectedDateTime.Hour, expectedDateTime.Minute, 0); } break; case 4: incrementationTypeName = "Second"; incrementationAmount = random.Next(60 - startDateTime.Second); expectedDateTime = calendar.AddSeconds( startDateTime, incrementationAmount); break; } // Random week start day DayOfWeek weekStartDay; string weekStartDayName; switch (random.Next(7)) { default: case 0: weekStartDayName = "Monday"; weekStartDay = DayOfWeek.Monday; break; case 1: weekStartDayName = "Tuesday"; weekStartDay = DayOfWeek.Tuesday; break; case 2: weekStartDayName = "Wednesday"; weekStartDay = DayOfWeek.Wednesday; break; case 3: weekStartDayName = "Thursday"; weekStartDay = DayOfWeek.Thursday; break; case 4: weekStartDayName = "Friday"; weekStartDay = DayOfWeek.Friday; break; case 5: weekStartDayName = "Saturday"; weekStartDay = DayOfWeek.Saturday; break; case 6: weekStartDayName = "Sunday"; weekStartDay = DayOfWeek.Sunday; break; } if (incrementationAmount > 0) { // Test DateTime resultantDateTime; switch (incrementationType) { default: case 0: resultantDateTime = startDateTime.NextValid( inclusive: true, firstDayOfWeek: weekStartDay, month: Schedule .Months( startDateTime .Month + incrementationAmount), hour: Hour.Every, minute: Minute.Every, second: Second.Every); break; case 1: resultantDateTime = startDateTime.NextValid( inclusive: true, firstDayOfWeek: weekStartDay, day: Schedule .Days( startDateTime .Day + incrementationAmount), hour: Hour.Every, minute: Minute.Every, second: Second.Every); break; case 2: resultantDateTime = startDateTime.NextValid( inclusive: true, firstDayOfWeek: weekStartDay, hour: Schedule .Hours( startDateTime .Hour + incrementationAmount), minute: Minute.Every, second: Second.Every); break; case 3: resultantDateTime = startDateTime.NextValid( inclusive: true, firstDayOfWeek: weekStartDay, minute: Schedule .Minutes( startDateTime .Minute + incrementationAmount), hour: Hour.Every, second: Second.Every); break; case 4: resultantDateTime = startDateTime.NextValid( inclusive: true, firstDayOfWeek: weekStartDay, hour: Hour.Every, minute: Minute.Every, second: Schedule .Seconds( startDateTime .Second + incrementationAmount)); break; } // Report Assert.AreEqual( expectedDateTime, resultantDateTime, string.Format( "Started:<{0}>. Iteration: #{1}, Search: {2} {3} ahead, Week start day: {4}", startDateTime, iteration, incrementationAmount, incrementationAmount > 1 ? incrementationTypeName + "s" : incrementationTypeName, weekStartDayName) ); } }; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (parallel) Parallel.For(0, numberOfIterations, testAction); else { for (int iteration = 0; iteration < numberOfIterations; iteration++) testAction(iteration); } stopwatch.Stop(); if (parallel) { Trace.WriteLine( string.Format( "{0} random iterations took {1}ms", numberOfIterations, stopwatch.ElapsedMilliseconds)); } else { Trace.WriteLine( string.Format( "{0} random iterations took {1}ms (~{2}ms per iteration)", numberOfIterations, stopwatch.ElapsedMilliseconds, stopwatch.ElapsedMilliseconds / numberOfIterations)); } }
public void UpdateChunks(int radius, CancellationToken token, bool sync, bool remove) { int chunkX = (int)(Math.Floor(Position.X)) >> 4; int chunkZ = (int)(Math.Floor(Position.Z)) >> 4; Dictionary<int, int> nearbyChunks = new Dictionary<int, int>(); MapChunkBulkPacket chunkPacket = null; if(sync) chunkPacket = new MapChunkBulkPacket(); for (int x = chunkX - radius; x <= chunkX + radius; ++x) { for (int z = chunkZ - radius; z <= chunkZ + radius; ++z) { if (token.IsCancellationRequested) return; int packedChunk = UniversalCoords.FromChunkToPackedChunk(x, z); nearbyChunks.Add(packedChunk, packedChunk); if (!LoadedChunks.ContainsKey(packedChunk)) { Chunk chunk; if (sync) chunk = World.GetChunkFromChunkSync(x, z, true, true) as Chunk; else chunk = World.GetChunkFromChunkAsync(x, z, Client, true, true) as Chunk; LoadedChunks.TryAdd(packedChunk, chunk); if (chunk == null) continue; if (chunk.LightToRecalculate) { #if PROFILE Stopwatch watch = new Stopwatch(); watch.Start(); chunk.RecalculateSky(); watch.Stop(); World.Logger.Log(LogLevel.Info, "Skylight recalc: {0}", watch.ElapsedMilliseconds); #else chunk.RecalculateSky(); #endif } chunk.AddClient(Client); if(!sync) _client.SendChunk(chunk); else chunkPacket.ChunksToSend.Add(chunk); } } } if(sync) _client.Send_Sync_Packet(chunkPacket); if (remove) { foreach (int c in LoadedChunks.Keys.Where(c => !nearbyChunks.ContainsKey(c))) { if (token.IsCancellationRequested) return; Chunk chunk; LoadedChunks.TryRemove(c, out chunk); if (chunk != null) chunk.RemoveClient(_client); } } }
void RFBClient_PostCompleted(object sender, FacebookApiEventArgs e) { RFBClient.PostCompleted -= new EventHandler<FacebookApiEventArgs>(RFBClient_PostCompleted); if (e.Error == null) { #if !DEBUG Stopwatch OStop = new Stopwatch(); Console.WriteLine("Friends Fetching Started .."); OStop.Start(); #endif var result = (IDictionary<string, object>)e.GetResultData(); //if (Verifier.Verify(ResultsObject, "data")) // ResultsArray = ResultsObject["data"] as JsonArray; var id = result["id"] as string; OnNewEventCreated(id); #if !DEBUG Console.WriteLine("Friends Fetching Finished in " + OStop.ElapsedMilliseconds); OStop.Stop(); #endif //FinishedEvents.NotifyFriendsDataFinished(true, FriendList); } else { //FinishedEvents.NotifyFriendsDataFinished(false, null); } }
private void OnGetFriendsCompleted(object sender, FacebookApiEventArgs e) { RFBClient.GetCompleted -= new EventHandler<FacebookApiEventArgs>(OnGetFriendsCompleted); if (e.Error == null) { #if !DEBUG Stopwatch OStop = new Stopwatch(); Console.WriteLine("Friends Fetching Started .."); OStop.Start(); #endif var result = (IDictionary<string, object>)e.GetResultData(); //JsonArray ResultsArray = null; //JsonObject ResultsObject = e.GetResultData() as JsonObject; ObservableCollection<ProfileInfo> FriendList = new ObservableCollection<ProfileInfo>(); List<string> ids = new List<string>(); //if (Verifier.Verify(ResultsObject, "data")) // ResultsArray = ResultsObject["data"] as JsonArray; var dataItem = (JsonArray)result["data"]; foreach (JsonObject item in dataItem) { FriendList.Add(new ProfileInfo(item)); } foreach (var item in FriendList) { ids.Add(item.ID); } OnFriendListUpdated(FriendList); #if !DEBUG Console.WriteLine("Friends Fetching Finished in " + OStop.ElapsedMilliseconds); OStop.Stop(); #endif App.MManager.PublishMessageByType<FriendListMessage>(new FriendListMessage() { FriendIDList = ids }); } else { } }
void loadPage(int pageNum) { #if DEBUG_LOAD Stopwatch loadingTime = new Stopwatch (); loadingTime.Start (); #endif Group page; if (typeof(Wrapper).IsAssignableFrom (items.GetType ())){ page = items; itemPerPage = int.MaxValue; }else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) { GenericStack gs = new GenericStack (); gs.CurrentInterface = items.CurrentInterface; gs.initialize (); gs.Orientation = (items as GenericStack).Orientation; gs.Width = items.Width; gs.Height = items.Height; gs.VerticalAlignment = items.VerticalAlignment; gs.HorizontalAlignment = items.HorizontalAlignment; page = gs; }else page = Activator.CreateInstance (items.GetType ()) as Group; page.Name = "page" + pageNum; for (int i = (pageNum - 1) * itemPerPage; i < pageNum * itemPerPage; i++) { if (i >= data.Count) break; if (cancelLoading) return; loadItem (i, page); } if (page == items) return; lock (CurrentInterface.LayoutMutex) items.AddChild (page); #if DEBUG_LOAD loadingTime.Stop (); Debug.WriteLine("Listbox {2} Loading: {0} ticks \t, {1} ms", loadingTime.ElapsedTicks, loadingTime.ElapsedMilliseconds, this.ToString()); #endif }
/// <summary> /// Picks the translation best matching the browser-language or the first translation in the list /// typically called from LanguageIntersectionController /// compare ContentController.SetCulture for actual Culture setting. /// /// Picks the first site and start page that matches the user's culture codes. /// </summary> /// <param name="currentPage"></param> /// <param name="userLanguages"></param> /// <returns></returns># public static ContentItem SelectLanguage(this ContentItem currentPage, IList<string> userLanguages) { #if DEBUG_T Stopwatch timer = new Stopwatch(); timer.Start(); #endif // TODO: If multiple sites have start pages that match of of the user's culture codes, is there some other way to fine-tune // TODO: site selection instead of arbitrarily picking the first one? var start = Find.ClosestOf<IStartPage>(currentPage) ?? Find.StartPage; if (start is LanguageIntersection || start is StartPage) { if (userLanguages != null && userLanguages.Count > 0) start = GetFirstMatchingLanguageRootOrDefault(currentPage, userLanguages); else start = GetFirstMatchingLanguageRootOrDefault(currentPage, DefaultLangs); } #if DEBUG_T timer.Stop(); Logger.InfoFormat("{3} ms SelectLanguage for Page {0} and languages {1} => {2}", currentPage, userLanguages, start, timer.Elapsed.TotalMilliseconds); #endif //if (start == null) Logger.Error("SelectLanguage failed: " + userLanguages); return start; }
public override void OnResultExecuted(ResultExecutedContext filterContext) { base.OnResultExecuted(filterContext); #if Page_Trace Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); #endif if (Page_Context.Current.PageRequestContext != null) { var site = Page_Context.Current.PageRequestContext.Site; var page = Page_Context.Current.PageRequestContext.Page.AsActual(); if (!filterContext.HttpContext.User.Identity.IsAuthenticated && page.EnabledCache) { var outputTextWriterWrapper = filterContext.HttpContext.Response.Output as OutputTextWriterWrapper; if (outputTextWriterWrapper != null && filterContext.Exception == null && filterContext.HttpContext.Response.ContentType.ToLower().Contains("text/html")) { var cacheKey = GetOutputCacheKey(filterContext.HttpContext, page); if (outputTextWriterWrapper != null && site.ObjectCache().Get(cacheKey) == null) { site.ObjectCache().Add(cacheKey, outputTextWriterWrapper.ToString(), page.AsActual().OutputCache.ToCachePolicy()); } } } } #if Page_Trace stopwatch.Stop(); filterContext.HttpContext.Response.Write(string.Format("OutputCacheFilterAttribute.OnResultExecuted, {0}ms.</br>", stopwatch.ElapsedMilliseconds)); #endif }
static void Main(string[] args) { System.IO.StreamWriter s = new System.IO.StreamWriter("in.txt"); Random rand = new Random(); Console.WriteLine("Generating random values: "); array = new int[arraySize, arraySize]; arrayLinear = new int[arraySize, arraySize]; int c = 0; for (int i = 0; i < arraySize; ++i) { for (int j = 0; j < arraySize; ++j) { c = rand.Next(50); array[i, j] = c; arrayLinear[i, j] = c; s.Write(" {0} ", c); } s.WriteLine(); } s.Close(); Console.WriteLine("Start sorting: "); Stopwatch sw = new Stopwatch(); sw.Start(); ParallelShellSort(); sw.Stop(); Console.WriteLine("Parallel sort ended. Time: {0}", sw.Elapsed.Milliseconds); Console.WriteLine("Start linear sort: "); Stopwatch sw1 = new Stopwatch(); sw1.Start(); c = 0; for (int k = 0; k < arraySize; ++k) { for (int i = 0; i < arrayLinear.GetLength(1) - 1; i++) { for (int j = 0; j < arrayLinear.GetLength(1) - i - 1; j++) { if (arrayLinear[k, j] > arrayLinear[k, j + 1]) { c = arrayLinear[k, j + 1]; arrayLinear[k, j + 1] = arrayLinear[k, j]; arrayLinear[k, j] = c; } } } } sw1.Stop(); Console.WriteLine("Planar sorting ended. Time: {0}", sw1.Elapsed.Milliseconds); s = new System.IO.StreamWriter("out.txt"); for (int i = 0; i < arraySize; ++i) { for (int j = 0; j < arraySize; ++j) { s.Write(" {0} ", array[i, j]); } s.WriteLine(); } s.Close(); Console.WriteLine("Writing to file ended."); Console.ReadLine(); return; }
public void Run(IAssemblyTrackerFactory trackerFactory, IEnumerable<IAssemblyTransformationFactory> transformationFactories, IAssemblySignerFactory signerFactory, IAppDomainInfoBroker infoBroker) { ArgumentUtility.CheckNotNull ("trackerFactory", trackerFactory); ArgumentUtility.CheckNotNull ("transformationFactories", transformationFactories); ArgumentUtility.CheckNotNull ("signerFactory", signerFactory); #if PERFORMANCE_TEST Stopwatch s = new Stopwatch (); Stopwatch total = new Stopwatch (); s.Start (); total.Start(); #endif var tracker = trackerFactory.CreateTracker(); #if PERFORMANCE_TEST total.Stop(); Process procObj = Process.GetCurrentProcess (); Console.WriteLine (Environment.NewLine + " Private Memory Size : {0:N0}" + Environment.NewLine + " Virtual Memory Size : {1:N0}" + Environment.NewLine + " Working Set Size: {2:N0}", procObj.PrivateMemorySize64, procObj.VirtualMemorySize64, procObj.WorkingSet64); Console.WriteLine (Environment.NewLine + " Initialization: " + s.Elapsed); Console.WriteLine (Environment.NewLine + " press key to continue with transformations"); total.Start (); s.Restart (); #endif foreach (var factory in transformationFactories) { Console.WriteLine ("Transforming assemblies according to " + factory.GetType().Name); factory.CreateTransformation(infoBroker).Transform (tracker); } infoBroker.Unload(); #if PERFORMANCE_TEST total.Stop (); procObj = Process.GetCurrentProcess (); Console.WriteLine (Environment.NewLine + " Private Memory Size : {0:N0}" + Environment.NewLine + " Virtual Memory Size : {1:N0}" + Environment.NewLine + " Working Set Size: {2:N0}", procObj.PrivateMemorySize64, procObj.VirtualMemorySize64, procObj.WorkingSet64); Console.WriteLine (Environment.NewLine + " Transformation: " + s.Elapsed); Console.WriteLine (Environment.NewLine + " press key to continue with sign and save"); total.Start (); s.Restart (); #endif var signer = signerFactory.CreateSigner(); Console.WriteLine ("Signing and writing the transformed assemblies ... "); signer.SignAndSave (tracker); #if PERFORMANCE_TEST s.Stop(); total.Stop (); procObj = Process.GetCurrentProcess (); Console.WriteLine (Environment.NewLine + " Private Memory Size : {0:N0}" + Environment.NewLine + " Virtual Memory Size : {1:N0}" + Environment.NewLine + " Working Set Size: {2:N0}", procObj.PrivateMemorySize64, procObj.VirtualMemorySize64, procObj.WorkingSet64); Console.WriteLine (Environment.NewLine + " Signing & Saving: " + s.Elapsed); Console.WriteLine (Environment.NewLine + "Total: " + total.Elapsed + Environment.NewLine); #endif }