// TODO: probabably does not belong in this class. public void CaptureCurrentMachineInfo(Assembly assemblyWithCode, bool skipMachineStats) { this["Computer Name"] = Environment.MachineName; if (!skipMachineStats) { ComputerSpecs specs = new ComputerSpecs(); this["Number of Processors"] = specs.NumberOfProcessors; this["Processor Name "] = specs.ProcessorName; this["Processor Mhz"] = specs.ProcessorClockSpeedMhz; this["Memory MBytes"] = specs.MemoryMBytes; this["L1 Cache KBytes"] = specs.L1KBytes; this["L2 Cache KBytes"] = specs.L2KBytes; this["Operating System"] = specs.OperatingSystem; this["Operating System Version"] = specs.OperatingSystemVersion; this["Stopwatch resolution (nsec)"] = (CodeTimer.ResolutionUsec * 1000.0).ToString("f3"); } // Are we NGENed or JITTed? if (IsNGenedCodeLoaded(assemblyWithCode)) { this["CompileType"] = "NGEN"; } else { this["CompileType"] = "JIT"; } // Are we Appdomain Shared, or not? MethodInfo currentMethod = Assembly.GetEntryAssembly().EntryPoint; LoaderOptimizationAttribute loaderAttribute = (LoaderOptimizationAttribute)System.Attribute.GetCustomAttribute(currentMethod, typeof(LoaderOptimizationAttribute)); if (loaderAttribute != null && loaderAttribute.Value == LoaderOptimization.MultiDomain) { this["CodeSharing"] = "AppDomainShared"; } else { this["CodeSharing"] = "AppDomainSpecific"; } DebuggableAttribute debugAttribute = (DebuggableAttribute)System.Attribute.GetCustomAttribute(assemblyWithCode, typeof(System.Diagnostics.DebuggableAttribute)); if (debugAttribute != null && debugAttribute.IsJITOptimizerDisabled) { this["CodeOptimization"] = "Unoptimized"; } else { this["CodeOptimization"] = "Optimized"; } }
private void CaptureCodeSharing() { // get a method in this assembly. var currentMethod = Assembly.GetAssembly(this.GetType()).GetExportedTypes().First(x => x.GetMethods() != null).GetMethods().First(); LoaderOptimizationAttribute loaderAttribute = (LoaderOptimizationAttribute)System.Attribute.GetCustomAttribute(currentMethod, typeof(LoaderOptimizationAttribute)); if (loaderAttribute != null && loaderAttribute.Value == LoaderOptimization.MultiDomain) { this["CodeSharing"] = "AppDomainShared"; } else { this["CodeSharing"] = "AppDomainSpecific"; } }