示例#1
0
 public Kerncentrale(ThreadingType threadingType)
 {
     this.reactors      = new List <Reactor>();
     this.threadingType = threadingType;
     this.InitializeTmpReactors();
     this.InitialiseTimer();
 }
        public static void ConfigureRollingSizeFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\Log4Net.{threadingType}.RollingSizeFile.log";

            File.Delete(logFileName);

            PatternLayout patternLayout = new PatternLayout
            {
                ConversionPattern = LogOutputTemplate
            };

            patternLayout.ActivateOptions();

            var rollingFileAppender = new RollingFileAppender
            {
                File   = logFileName,
                Layout = patternLayout,

                MaxSizeRollBackups = Parameters.MaxArchiveFiles,
                MaximumFileSize    = Parameters.Log4NetArchiveAboveString,
                RollingStyle       = RollingFileAppender.RollingMode.Size,
                StaticLogFileName  = true
            };

            rollingFileAppender.ActivateOptions();
            Hierarchy.Root.AddAppender(rollingFileAppender);

            Hierarchy.Root.Level = Level.Info;

            Hierarchy.Configured = true;
        }
示例#3
0
        public static void ConfigureRollingSizeFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\NLog.{threadingType}.RollingSizeFile.log";

            File.Delete(logFileName);

            var config = new LoggingConfiguration();

            var rollingSizeLogFileTarget = new FileTarget("RollingSizeLogFileTarget")
            {
                FileName = logFileName,
                Layout   = LogOutputTemplate,

                KeepFileOpen = true, // Improves performance drastically (by default is set to false)

                ArchiveAboveSize = Parameters.ArchiveAboveBytes,
                ArchiveNumbering = ArchiveNumberingMode.Rolling,
                MaxArchiveFiles  = Parameters.MaxArchiveFiles
            };

            config.AddTarget(rollingSizeLogFileTarget);

            config.AddRule(LogLevel.Info, LogLevel.Fatal, rollingSizeLogFileTarget);

            LogManager.Configuration = config;
        }
示例#4
0
        public static void ConfigureOptimizedSimpleFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\NLog.{threadingType}.Optimized.SimpleFile.log";

            File.Delete(logFileName);

            var config = new LoggingConfiguration();

            var simpleLogFileTarget = new FileTarget("SimpleLogFileTarget")
            {
                FileName = logFileName,
                Layout   = LogOutputTemplate,

                KeepFileOpen = true, // Improves performance drastically (by default is set to false)
            };

            var asyncTargetWrapper = new AsyncTargetWrapper()
            {
                Name      = "AsyncTargetWrapper",
                BatchSize = 50,
                FullBatchSizeWriteLimit = 1,
                OptimizeBufferReuse     = true,
                OverflowAction          = AsyncTargetWrapperOverflowAction.Grow,
                QueueLimit = 10000,
                TimeToSleepBetweenBatches = 0,
                WrappedTarget             = simpleLogFileTarget
            };

            config.AddTarget(asyncTargetWrapper);

            config.AddRule(LogLevel.Info, LogLevel.Fatal, asyncTargetWrapper);

            LogManager.Configuration = config;
        }
示例#5
0
        //public void Do<T, U, V, W, X, R>(F<T, U, V, W, X, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, R>(F1<T, U, V, W, X, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, R>(F2<T, U, V, W, X, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, R>(F3<T, U, V, W, X, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, R>(F4<T, U, V, W, X, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, R>(F5<T, U, V, W, X, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F1<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F2<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F3<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F4<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F5<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, R>(F6<T, U, V, W, X, Y, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F1<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F2<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F3<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F4<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F5<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F6<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        //public void Do<T, U, V, W, X, Y, Z, R>(F7<T, U, V, W, X, Y, Z, R> m) { PrivateDo(m); }
        #endregion



        internal void SyncContext(Delegate d)
        {
            threadingType = ThreadingType.SyncContext;
            @delegate     = d;
            VerifyDelegate();
            //TODO: more tests here... see above
        }
示例#6
0
        private Chord NewChord(ThreadingType threadingType)
        {
            var chord = NewChord();

            chord.ThreadingType = threadingType;
            return(chord);
        }
        public static void ConfigureSimpleFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\Log4Net.{threadingType}.SimpleFile.log";

            File.Delete(logFileName);

            PatternLayout patternLayout = new PatternLayout
            {
                ConversionPattern = LogOutputTemplate
            };

            patternLayout.ActivateOptions();

            var simpleFileAppender = new FileAppender
            {
                File   = logFileName,
                Layout = patternLayout
            };

            simpleFileAppender.ActivateOptions();
            Hierarchy.Root.AddAppender(simpleFileAppender);

            Hierarchy.Root.Level = Level.Info;

            Hierarchy.Configured = true;
        }
示例#8
0
        //public void Continue<T, U, V, W, X, R>(F<T, U, V, W, X, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, R>(F1<T, U, V, W, X, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, R>(F2<T, U, V, W, X, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, R>(F3<T, U, V, W, X, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, R>(F4<T, U, V, W, X, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, R>(F5<T, U, V, W, X, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F1<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F2<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F3<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F4<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F5<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, R>(F6<T, U, V, W, X, Y, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F1<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F2<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F3<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F4<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F5<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F6<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }
        //public void Continue<T, U, V, W, X, Y, Z, R>(F7<T, U, V, W, X, Y, Z, R> m) { PrivateContinue(m); }

        #endregion


        internal void PrivateDo(Delegate d)
        {
            threadingType = ThreadingType.Sync;
            @delegate     = d;
            VerifyDelegate();
            if (!(this is SyncChord))
            {
                throw new IncompatibleSchedulingException("Use \"Continue\" to run an async chord on the incoming thread.");
            }
        }
示例#9
0
        //public void Spawn<T, U, V, W, X, R>(F<T, U, V, W, X, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, R>(F1<T, U, V, W, X, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, R>(F2<T, U, V, W, X, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, R>(F3<T, U, V, W, X, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, R>(F4<T, U, V, W, X, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, R>(F5<T, U, V, W, X, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F1<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F2<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F3<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F4<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F5<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, R>(F6<T, U, V, W, X, Y, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F1<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F2<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F3<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F4<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F5<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F6<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }
        //public void Spawn<T, U, V, W, X, Y, Z, R>(F7<T, U, V, W, X, Y, Z, R> m) { PrivateSpawn(m); }

        #endregion


        internal void PrivateContinue(Delegate d)
        {
            //TODO: only valid for async chords mChord is AsyncChord...
            threadingType = ThreadingType.Continue;
            @delegate     = d;
            VerifyDelegate();
            if (!(this is AsyncChord))
            {
                throw new IncompatibleSchedulingException("Use \"Do\" to run an sync chord on the thread of the primary method.");
            }
        }
        public static void ReportTestResults(ThreadingType threadingType, LogFileType logFileType)
        {
            Console.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine();
            Console.WriteLine($"'{threadingType} -> {logFileType}' test FINISHED: {DateTime.Now}");

            if (Parameters.OutputEnvironmentInfoAfterRun)
            {
                EnvironmentInfoUtil.OutputEnvironmentInfo();
            }
        }
示例#11
0
        //public void Pool<T, U, V, W, X, R>(F<T, U, V, W, X, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, R>(F1<T, U, V, W, X, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, R>(F2<T, U, V, W, X, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, R>(F3<T, U, V, W, X, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, R>(F4<T, U, V, W, X, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, R>(F5<T, U, V, W, X, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F1<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F2<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F3<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F4<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F5<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, R>(F6<T, U, V, W, X, Y, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F1<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F2<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F3<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F4<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F5<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F6<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        //public void Pool<T, U, V, W, X, Y, Z, R>(F7<T, U, V, W, X, Y, Z, R> m) { PrivatePool(m); }
        #endregion

        internal void PrivateSpawn(Delegate d)
        {
            //TODO: only valid for async chords mChord is AsyncChord...
            threadingType = ThreadingType.Spawn;
            @delegate     = d;
            VerifyDelegate();
            if (!(this is AsyncChord))
            {
                throw new IncompatibleSchedulingException("Only asynchronous chords can be spawned.");
            }
        }
示例#12
0
 public void Copy(GitSettings settings)
 {
     AutoStage                 = settings.AutoStage;
     AutoFetch                 = settings.AutoFetch;
     ExternalsType             = (ExternalsTypeEnum)settings.ExternalsType;
     ExternalProgram           = settings.ExternalProgram;
     CredentialsManager        = settings.CredentialsManager;
     ProjectStatusOverlayDepth = settings.ProjectStatusOverlayDepth;
     ShowEmptyFolders          = settings.ShowEmptyFolders;
     Threading                 = (settings.GitStatusMultithreaded ? DefalutThreadingType : 0);
     UseGavatar                = settings.UseGavatar;
     MaxCommitTextAreaSize     = settings.MaxCommitTextAreaSize;
     DetectRenames             = settings.DetectRenames ? RenameTypeEnum.All : RenameTypeEnum.None;
 }
        public static Logger ConfigureSimpleFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\Serilog.{threadingType}.SimpleFile.log";

            File.Delete(logFileName);

            var logger = new LoggerConfiguration()
                         .WriteTo.File(
                logFileName,
                outputTemplate: LogOutputTemplate)
                         .Enrich.WithThreadId()
                         .Enrich.WithProperty("LoggerName", "PerformanceTests")
                         .MinimumLevel.Information()
                         .CreateLogger();

            return(logger);
        }
        public static Logger ConfigureRollingSizeFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\Serilog.{threadingType}.RollingSizeFile.log";

            File.Delete(logFileName);

            var logger = new LoggerConfiguration()
                         .WriteTo.File(
                logFileName,
                outputTemplate: LogOutputTemplate,

                rollOnFileSizeLimit: true,
                fileSizeLimitBytes: Parameters.ArchiveAboveBytes,
                retainedFileCountLimit: Parameters.MaxArchiveFiles)
                         .Enrich.WithThreadId()
                         .Enrich.WithProperty("LoggerName", "PerformanceTests")
                         .MinimumLevel.Information()
                         .CreateLogger();

            return(logger);
        }
示例#15
0
        public static void ConfigureSimpleFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\NLog.{threadingType}.SimpleFile.log";

            File.Delete(logFileName);

            var config = new LoggingConfiguration();

            var simpleLogFileTarget = new FileTarget("SimpleLogFileTarget")
            {
                FileName = logFileName,
                Layout   = LogOutputTemplate,

                KeepFileOpen = true, // Improves performance drastically (by default is set to false)
            };

            config.AddTarget(simpleLogFileTarget);

            config.AddRuleForOneLevel(LogLevel.Info, simpleLogFileTarget);

            LogManager.Configuration = config;
        }
        public static void ConfigureOptimizedSimpleFileLogger(ThreadingType threadingType)
        {
            var logFileName = $"{Parameters.RootLogsDirectory}\\Log4Net.{threadingType}.Optimized.SimpleFile.log";

            File.Delete(logFileName);

            PatternLayout patternLayout = new PatternLayout
            {
                ConversionPattern = LogOutputTemplate
            };

            patternLayout.ActivateOptions();

            var simpleFileAppender = new FileAppender
            {
                File   = logFileName,
                Layout = patternLayout
            };

            simpleFileAppender.ActivateOptions();

            var asyncBufferingForwarderAppender = new AsyncBufferingForwardingAppender()
            {
                Lossy      = false,
                BufferSize = 512,
                Fix        = FixFlags.ThreadName | FixFlags.Message | FixFlags.Exception,
                IdleTime   = 500
            };

            asyncBufferingForwarderAppender.AddAppender(simpleFileAppender);
            asyncBufferingForwarderAppender.ActivateOptions();
            Hierarchy.Root.AddAppender(asyncBufferingForwarderAppender);

            Hierarchy.Root.Level = Level.Info;

            Hierarchy.Configured = true;
        }
示例#17
0
 /// <summary>
 /// Updates what threading type will be used
 /// </summary>
 /// <param name="type"></param>
 private void UpdateThreadingType(ThreadingType type)
 {
     (App.Current as App).threadingType = type;
 }
示例#18
0
 /// <summary>
 /// set the selected TreadingType
 /// </summary>
 /// <param name="threadingType"></param>
 public void SetSelectedThreadingType(ThreadingType threadingType)
 {
     this.selectedThreadingType = threadingType;
 }
 public static void ReportStartedTest(ThreadingType threadingType, LogFileType logFileType)
 {
     Console.WriteLine($"'{threadingType} -> {logFileType}' test STARTED: {DateTime.Now}");
 }