using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace Mono26Perf { class Program { private const long TicksPerMiliSecond = TimeSpan.TicksPerSecond / 1000; static int Main(string[] args) { DateTime mainEntryTime = DateTime.UtcNow;//100 nanoseconds units since 1601/1/1 int result = 0; if (args.Length > 0) { DateTime launchTime = System.DateTime.FromFileTimeUtc(long.Parse(args[0])); long diff = (mainEntryTime.Ticks - launchTime.Ticks) / TicksPerMiliSecond; result = (int)diff; } else { System.GC.Collect(2, GCCollectionMode.Forced); System.GC.WaitForPendingFinalizers(); /* result = (int)(System.Environment.WorkingSet);//return in KB //result = (int)(System.Environment.WorkingSet/1024);//return in KB #if DEBUG Console.WriteLine("runtime version is {0}, self reporting Working set = {1:x8} KB",Environment.Version,result); #endif */ System.Threading.Thread.Sleep(5000); } return result; } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)