public static void Main() { DnSpyEventSource.Log.StartupStart(); var sw = Stopwatch.StartNew(); // Use multicore JIT. // Simple test: x86: ~18% faster startup, x64: ~12% faster startup. try { var profileDir = BGJitUtils.GetFolder(); Directory.CreateDirectory(profileDir); ProfileOptimization.SetProfileRoot(profileDir); ProfileOptimization.StartProfile("startup.profile"); } catch { } if (!dnlib.Settings.IsThreadSafe) { ErrorNotThreadSafe(); } bool readSettings = (Keyboard.Modifiers & ModifierKeys.Shift) == 0; if (!readSettings) { readSettings = AskReadSettings(); } new App(readSettings, sw).Run(); }
public App() { string profilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"GitBlame\Profile"); Directory.CreateDirectory(profilePath); ProfileOptimization.SetProfileRoot(profilePath); ProfileOptimization.StartProfile("Startup"); Log.DebugFormat("Starting new application; version {0}.", Assembly.GetExecutingAssembly().GetName().Version); m_analyticsClient = new GoogleAnalyticsClient("UA-25641987-2", "GitBlame", new GoogleAnalyticsStatisticsProvider()); #if !DEVELOPMENT BugSense.Init("w8cfcffb"); #endif AppDomain.CurrentDomain.UnhandledException += (s, ea) => { var exception = ea.ExceptionObject as Exception; if (exception != null) { Log.FatalFormat("Unhandled Exception: {0} {1}", exception, exception.GetType(), exception.Message); #if !DEVELOPMENT m_analyticsClient.SubmitExceptionAsync(exception, true); #endif } else { Log.FatalFormat("Unhandled Error: {0}", ea.ExceptionObject); } }; m_app = new AppModel(); }
static int Main(string[] args) { FileSystem.CreateDirectory(PlaynitePaths.JitProfilesPath); ProfileOptimization.SetProfileRoot(PlaynitePaths.JitProfilesPath); ProfileOptimization.StartProfile("toolbox"); logger.Debug("Toolbox started."); logger.Debug(Environment.CommandLine); var cmdlineParser = new Parser(with => { with.CaseInsensitiveEnumValues = true; with.HelpWriter = null; }); var result = cmdlineParser.ParseArguments <NewCmdLineOptions, PackCmdLineOptions, UpdateCmdLineOptions>(args); result.WithParsed <NewCmdLineOptions>(ProcessNewOptions) .WithParsed <PackCmdLineOptions>(ProcessPackOptions) .WithParsed <UpdateCmdLineOptions>(ProcessUpdateOptions) .WithNotParsed(errs => DisplayHelp(result, errs)); if (result.Tag == ParserResultType.NotParsed) { AppResult = 2; } if (Debugger.IsAttached) { Console.ReadLine(); } return(AppResult); }
public OtherTabsView() { ProfileOptimization.SetProfileRoot(Environment.CurrentDirectory); ProfileOptimization.StartProfile("App.JIT.Profile"); Dispatcher.BeginInvoke(new Action(() => InitializeComponent())); this.DataContext = new OtherTabsVM(); SelectedItems = new List <object>(); ObservableCollection <string> item = new ObservableCollection <string>(); item.Add("버튼1"); item.Add("버튼2"); item.Add("버튼3"); ObservableCollection <string> item2 = new ObservableCollection <string>(); item2.Add("수신" + "/" + "*****@*****.**" + "/" + "네이버"); item2.Add("참조" + "/" + "*****@*****.**" + "/" + "카카오"); item2.Add("수신" + "/" + "*****@*****.**" + "/" + "네이버"); vm = (OtherTabsVM)DataContext; // ViewModel 객체 가져와 쓰기 }
private static int Main() { const int Pass = 100; ProfileOptimization.SetProfileRoot(Environment.CurrentDirectory); ProfileOptimization.StartProfile("profile.mcj"); // Let multi-core JIT start jitting Thread.Sleep(100); MCJTestStruct s; PromoteToTier1(Foo, () => FooWithLoop(2), () => FooWithGeneric <int>(3), () => FooWithGeneric <string>("MCJ"), () => FooWithGeneric <MCJTestClass>(null), () => FooWithGeneric <MCJTestStruct>(s), () => FooWithGeneric <Regex>(null), () => FooWithGeneric(RegexOptions.IgnoreCase)); Foo(); FooWithLoop(2); FooWithGeneric <int>(3); FooWithGeneric <string>("MCJ"); FooWithGeneric <MCJTestClass>(null); FooWithGeneric <MCJTestStruct>(s); FooWithGeneric <Regex>(null); FooWithGeneric(RegexOptions.IgnoreCase); ProfileOptimization.StartProfile(null); return(Pass); }
public static async Task <int> Main(string[] args) { string profilePath = DirHelper.GetTempPath(); ProfileOptimization.SetProfileRoot(profilePath); ProfileOptimization.StartProfile("bicep.profile"); Console.OutputEncoding = TemplateEmitter.UTF8EncodingWithoutBom; BicepDeploymentsInterop.Initialize(); if (FeatureProvider.TracingEnabled) { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); } // this event listener picks up SDK events and writes them to Trace.WriteLine() using (FeatureProvider.TracingEnabled ? AzureEventSourceListenerFactory.Create(FeatureProvider.TracingVerbosity) : null) { var program = new Program(new InvocationContext( new AzResourceTypeLoader(), Console.Out, Console.Error, features: null, clientFactory: null)); // this must be awaited so dispose of the listener occurs in the continuation // rather than the sync part at the beginning of RunAsync() return(await program.RunAsync(args)); } }
public App() { var profileRoot = Path.Combine(AppDataPath, "ProfileOptimization"); Directory.CreateDirectory(profileRoot); ProfileOptimization.SetProfileRoot(profileRoot); ProfileOptimization.StartProfile("Startup.profile"); var fileTarget = new FileTarget("fileTarget") { FileName = Path.Combine(AppDataPath, "Log", "App.log"), Layout = "${date:format=yyyy-MM-dd HH\\:mm\\:ss.ff} ${level} ${processid} ${logger} ${message} ${exception}", ArchiveAboveSize = 1024 * 1024 * 5, // 5 MB MaxArchiveFiles = 2, }; var logConfig = new LoggingConfiguration(); logConfig.DefaultCultureInfo = CultureInfo.InvariantCulture; logConfig.AddTarget(fileTarget); var maxLevel = LogLevel.AllLoggingLevels.Last(); foreach (var logSetting in logSettings) { logConfig.AddRule(logSetting.Item2, maxLevel, fileTarget, logSetting.Item1); } LogManager.Configuration = logConfig; }
public void ProfileOptimization_CheckFileExists(bool stopProfile) { // Don't put this file into the normal per-test directory, because // when RemoteExecutor.Invoke returns, it disposes this class and deletes // that directory. Instead just put it in temp and delete it manually after. string profileFile = Path.Combine(Path.GetTempPath(), GetTestFileName()); try { RemoteExecutor.Invoke((_profileFile, _stopProfile) => { // Perform the test work ProfileOptimization.SetProfileRoot(Path.GetDirectoryName(_profileFile)); ProfileOptimization.StartProfile(Path.GetFileName(_profileFile)); if (bool.Parse(_stopProfile)) { ProfileOptimization.StartProfile(null); CheckProfileFileExists(_profileFile); } }, profileFile, stopProfile.ToString()).Dispose(); CheckProfileFileExists(profileFile); } finally { try { File.Delete(profileFile); } catch {} } }
protected override void OnStartup(StartupEventArgs e) { ProfileOptimization.SetProfileRoot(AppDomain.CurrentDomain.BaseDirectory); ProfileOptimization.StartProfile("Startup.Profile"); base.OnStartup(e); }
// create new groupEditor public GroupEditor(GroupOverview groupOverview, Border tab, string name) { // Setting from profile ProfileOptimization.StartProfile("GroupEditor.Profile"); InitializeComponent(); // Setting default properties newExt = imageExt.Concat(specialImageExt).ToArray(); GroupOverview = groupOverview; Tab = tab; Group = new Group() { Name = name, ShortcutList = new List <Shortcut>(), SelectedBackgroundOption = BackgroundOption.Light, BackgroundColor = Color.FromRgb(230, 230, 230).ToString(), Opacity = 100 }; IsNew = true; // DropHandler DataContext = new ViewModel(this); // Setting default control values BtnDelete.Visibility = Visibility.Hidden; int num = int.Parse(LblWidth.Content.ToString()); int max = 1; CheckWidth(num, max); }
static void Main(string[] args) { // optimize jit compile on multi-core systems. ProfileOptimization.SetProfileRoot(ParseConfigManager.GetStorePath()); ProfileOptimization.StartProfile("uProveWebService.Profile"); SetupLoggers(); UProveThreadWorkerIssuer workerThread = new UProveThreadWorkerIssuer(); Thread interOp = new Thread(new ThreadStart(workerThread.Startup)); interOp.IsBackground = true; interOp.Start(); UProveThreadWorkerProver workerThreadProver = new UProveThreadWorkerProver(); Thread interOpProver = new Thread(new ThreadStart(workerThreadProver.Startup)); interOpProver.IsBackground = true; interOpProver.Start(); UProveThreadWorkerInfo workerThreadInfo = new UProveThreadWorkerInfo(); Thread interOpInfo = new Thread(new ThreadStart(workerThreadInfo.Startup)); interOpInfo.IsBackground = true; interOpInfo.Start(); Console.ReadLine(); workerThread.Dispose(); workerThreadInfo.Dispose(); }
public App() { // this doesn't appear to be configured automatically for WPF in .NET Core 3.0 RxApp.MainThreadScheduler = new DispatcherScheduler(); string profilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"GitBlame\Profile"); Directory.CreateDirectory(profilePath); ProfileOptimization.SetProfileRoot(profilePath); ProfileOptimization.StartProfile("Startup"); Log.Debug("Starting new application; version {0}.", Assembly.GetExecutingAssembly().GetName().Version); m_analyticsClient = new GoogleAnalyticsClient("UA-25641987-2", "GitBlame", new GoogleAnalyticsStatisticsProvider()); AppDomain.CurrentDomain.UnhandledException += (s, ea) => { if (ea.ExceptionObject is Exception exception) { Log.Fatal(exception, "Unhandled Exception: {0} {1}", exception.GetType(), exception.Message); #if !DEVELOPMENT m_analyticsClient.SubmitExceptionAsync(exception, true); #endif } else { Log.Fatal("Unhandled Error: {0}", ea.ExceptionObject); } }; m_app = new AppModel(); }
private static void Main(string[] args) { ProfileOptimization.SetProfileRoot(Environment.CurrentDirectory); ProfileOptimization.StartProfile("DualityStartup.profile"); bool recover = false; foreach (string a in args) { if (a == "debug") { System.Diagnostics.Debugger.Launch(); } else if (a == "recover") { recover = true; } } //Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); // en-US, de-DE //Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; Application.CurrentCulture = Thread.CurrentThread.CurrentCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += Application_ThreadException; SplashScreen splashScreen = new SplashScreen(recover); splashScreen.Show(); Application.Run(); }
private static bool TryEnableMulticoreJitting(out string errorMessage) { errorMessage = null; try { // Enable multi-core JITing // https://blogs.msdn.microsoft.com/dotnet/2012/10/18/an-easy-solution-for-improving-app-launch-performance/ var profileRoot = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RoslynCompiler", "ProfileOptimization"); var assemblyName = Assembly.GetExecutingAssembly().GetName(); var profileName = assemblyName.Name + assemblyName.Version + ".profile"; Directory.CreateDirectory(profileRoot); #if NET46 ProfileOptimization.SetProfileRoot(profileRoot); ProfileOptimization.StartProfile(profileName); #else AssemblyLoadContext.Default.SetProfileOptimizationRoot(profileRoot); AssemblyLoadContext.Default.StartProfileOptimization(profileName); #endif } catch (Exception e) { errorMessage = string.Format(CodeAnalysisResources.ExceptionEnablingMulticoreJit, e.Message); return(false); } return(true); }
static void Main(string[] args) { ProfileOptimization.SetProfileRoot(Path.GetDirectoryName(typeof(Program).Assembly.Location)); ProfileOptimization.StartProfile("Startup.Profile"); var parseResult = Parser.Default.ParseArguments <Options>(args); if (parseResult.Errors.Any()) { return; } var options = parseResult.Value; var fileOptions = new DisassembleFileOptions { FilePath = options.FilePath, DisableOptimization = options.DisableOptimization, IsVerbose = options.IsVerbose }; try { SeeJitHelper.DisassembleFile(fileOptions, Console.Out); } catch (Exception ex) { Console.Error.WriteLine("Unhandled exception: " + ex.GetType()); Console.Error.WriteLine(ex.Message); Console.Error.WriteLine(ex.StackTrace); } }
static void Main(string[] args) { FileSystem.CreateDirectory(PlaynitePaths.JitProfilesPath); ProfileOptimization.SetProfileRoot(PlaynitePaths.JitProfilesPath); ProfileOptimization.StartProfile("toolbox"); logger.Debug("Toolbox started."); logger.Debug(Environment.CommandLine); var cmdlineParser = new Parser(with => with.CaseInsensitiveEnumValues = true); var result = cmdlineParser.ParseArguments <NewCmdLineOptions, PackCmdLineOptions, UpdateCmdLineOptions>(args) .WithParsed <NewCmdLineOptions>(ProcessNewOptions) .WithParsed <PackCmdLineOptions>(ProcessPackOptions) .WithParsed <UpdateCmdLineOptions>(ProcessUpdateOptions); if (result.Tag == ParserResultType.NotParsed) { logger.Error("No acceptable arguments given."); } if (Debugger.IsAttached) { Console.ReadLine(); } }
private static void useMulticoreJit() { var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); ProfileOptimization.SetProfileRoot(directory.FullName); ProfileOptimization.StartProfile("Startup.Profile"); }
public App(ReadOnlyCollection <string> args) { ProfileOptimization.SetProfileRoot(Assembly.GetEntryAssembly().Location); ProfileOptimization.StartProfile("AppsTrackerProfile"); AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; InitializeComponent(); this.ShutdownMode = ShutdownMode.OnExplicitShutdown; FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement) , new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline) , new PropertyMetadata() { DefaultValue = 40 }); var context = new DispatcherSynchronizationContext(Application.Current.Dispatcher); SynchronizationContext.SetSynchronizationContext(context); container = GetCompositionContainer(); ServiceLocation.ServiceLocator.Instance.Initialize(container); bool autostart = args.Where(a => a.ToUpper().Contains(Constants.CMD_ARGS_AUTOSTART)).Count() > 0; applicationController = container.GetExportedValue <ApplicationController>(); applicationController.Initialize(autostart); this.SessionEnding += (s, e) => ShutdownApp(); }
public static void Main() { DnSpyEventSource.Log.StartupStart(); var sw = Stopwatch.StartNew(); // Use multicore JIT. // Simple test: x86: ~18% faster startup, x64: ~12% faster startup. try { var profileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Constants.DnSpyFile, "Startup"); Directory.CreateDirectory(profileDir); ProfileOptimization.SetProfileRoot(profileDir); ProfileOptimization.StartProfile($"startup-{IntPtr.Size * 8}.profile"); } catch { } if (!dnlib.Settings.IsThreadSafe) { ErrorNotThreadSafe(); } bool readSettings = (Keyboard.Modifiers & ModifierKeys.Shift) == 0; if (!readSettings) { readSettings = AskReadSettings(); } new App(readSettings, sw).Run(); }
static void Main(string[] args) { var sw = Stopwatch.StartNew(); if (args.Length >= 1 && args[0].ToLower().EndsWith("p")) { ProfileOptimization.SetProfileRoot(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); ProfileOptimization.StartProfile("JustInTimeProfileOptimization"); } var rnd = new Random(); var a = new int[100000]; for (int i = 0; i < a.Length; ++i) { a[i] = rnd.Next(int.MaxValue); } QSort(a, 0, a.Length - 1); var d = new double[100000]; for (int i = 0; i < d.Length; ++i) { d[i] = rnd.Next(int.MaxValue); } Console.WriteLine($"Execution time: {sw.ElapsedMilliseconds} ms"); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); _appMutex = new Mutex(true, "Pixel-7331B770-095A-4220-924E-8C22B14701E5"); if (!_appMutex.WaitOne(0, false)) { MessageBox.Show( string.Format("Sorry, only one instance of {0} may be running at a single time.", ApplicationName), ApplicationName, MessageBoxButton.OK, MessageBoxImage.Information); Environment.Exit(0); } if (!Directory.Exists(RoamingPath)) { Directory.CreateDirectory(RoamingPath); } ProfileOptimization.SetProfileRoot(RoamingPath); ProfileOptimization.StartProfile("Pixel.profile"); Uploader = new Uploader(); Settings = UserSettings.Load(); // Register hotkeys try { HotKeyManager.Register(Settings.ScreenKey); HotKeyManager.Register(Settings.SelectionKey); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception"); } }
private static int Main(string[] args) { ProfileOptimization.SetProfileRoot(typeof(Program).Assembly.Location); ProfileOptimization.StartProfile(typeof(Program).Assembly.GetName().Name + ".profile"); var console = new ScriptConsole(); var parser = new ArgumentHandler(new ArgumentParser(console), new ConfigFileParser(console), new FileSystem()); var arguments = parser.Parse(args); var commandArgs = arguments.CommandArguments; var scriptArgs = arguments.ScriptArguments; var configurator = new LoggerConfigurator(commandArgs.LogLevel); configurator.Configure(console); var logger = configurator.GetLogger(); var scriptServicesBuilder = new ScriptServicesBuilder(console, logger) .Cache(commandArgs.Cache) .Debug(commandArgs.Debug) .LogLevel(commandArgs.LogLevel) .ScriptName(commandArgs.ScriptName) .Repl(commandArgs.Repl); var modules = GetModuleList(commandArgs.Modules); var extension = Path.GetExtension(commandArgs.ScriptName); if (string.IsNullOrWhiteSpace(extension) && !commandArgs.Repl) { // No extension was given, i.e we might have something like // "scriptcs foo" to deal with. We activate the default extension, // to make sure it's given to the LoadModules below. extension = ".csx"; if (!string.IsNullOrWhiteSpace(commandArgs.ScriptName)) { // If the was in fact a script specified, we'll extend it // with the default extension, assuming the user giving // "scriptcs foo" actually meant "scriptcs foo.csx". We // perform no validation here thought; let it be done by // the activated command. If the file don't exist, it's // up to the command to detect and report. commandArgs.ScriptName += extension; } } scriptServicesBuilder.LoadModules(extension, modules); var scriptServiceRoot = scriptServicesBuilder.Build(); var commandFactory = new CommandFactory(scriptServiceRoot); var command = commandFactory.CreateCommand(commandArgs, scriptArgs); var result = command.Execute(); return(result == CommandResult.Success ? 0 : -1); }
public App() { //https://docs.devexpress.com/WPF/400286/common-concepts/performance-improvement/reducing-the-application-launch-time // Defines where to store JIT profiles ProfileOptimization.SetProfileRoot(AppFileUtils.GetBaseAppFolder()); // Enables Multicore JIT with the specified profile ProfileOptimization.StartProfile("Startup.Profile"); }
public static void CreateProfile() { string expr_16 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppConfig.AppName, "ProfileOptimization"); Directory.CreateDirectory(expr_16); ProfileOptimization.SetProfileRoot(expr_16); ProfileOptimization.StartProfile("Startup.profile"); }
private static void PerformProfileOptimisation() { var p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Madhon\\Kronos"); Directory.CreateDirectory(p); ProfileOptimization.SetProfileRoot(p); ProfileOptimization.StartProfile("Kronos_Profile"); }
public App() { var profileRoot = Path.Combine(AppDataPath, "ProfileOptimization"); Directory.CreateDirectory(profileRoot); ProfileOptimization.SetProfileRoot(profileRoot); ProfileOptimization.StartProfile("Startup.profile"); }
public App() { var profileRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationInfo.ProductName, "ProfileOptimization"); Directory.CreateDirectory(profileRoot); ProfileOptimization.SetProfileRoot(profileRoot); ProfileOptimization.StartProfile("Startup.profile"); }
public App() { var environmentService = new EnvironmentService(); Directory.CreateDirectory(environmentService.ProfilePath); ProfileOptimization.SetProfileRoot(environmentService.ProfilePath); ProfileOptimization.StartProfile("Startup.profile"); }
static void Main() { System.Windows.Forms.Application.EnableVisualStyles(); AppDomain.CurrentDomain.UnhandledException += (args, e) => Log.Debug(e.ExceptionObject.ToString()); var baseDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) ?? Directory.GetCurrentDirectory(); var profilesDir = Path.Combine(baseDir, "JitProfiles"); if (!Directory.Exists(profilesDir)) { Directory.CreateDirectory(profilesDir); } var dbcdir = Path.Combine(baseDir, "DBC"); if (!Directory.Exists(dbcdir)) { Directory.CreateDirectory(dbcdir); } ProfileOptimization.SetProfileRoot(profilesDir); ProfileOptimization.StartProfile("JitProfile.jpf"); FontCollection.Initialize(); Settings.KeyBindings.Initialize(); XmlService.Initialize(); var window = new EditorWindow(); var context = new GxContext(window.DrawTarget); context.InitContext(); // TODO: move all shader initializations somehwere? context.InitShaders(); WorldFrame.Instance.Initialize(window.DrawTarget, context); WorldFrame.Instance.OnResize((int)window.RenderSize.Width, (int)window.RenderSize.Height); var wnd = new MainWindow { elementHost1 = { Child = window } }; wnd.Show(); var isClosed = false; wnd.FormClosing += (sender, args) => isClosed = true; while (isClosed == false) { context.BeginFrame(); WorldFrame.Instance.OnFrame(); context.EndFrame(); System.Windows.Forms.Application.DoEvents(); } WorldFrame.Instance.Shutdown(); }
public App() { // Enable Multi-JIT startup var profileRoot = UserSettings.SettingsFolder; Directory.CreateDirectory(profileRoot); ProfileOptimization.SetProfileRoot(profileRoot); ProfileOptimization.StartProfile("Startup.profile"); }