Example #1
0
        public Tuple<string, string> Execute(IProfiler profiler, string arguments, params object[] args)
        {
            using (GetProcessStep(profiler, arguments, args))
            {
                var process = CreateProcess(arguments, args);

                Func<StreamReader, string> reader = (StreamReader streamReader) => streamReader.ReadToEnd();

                IAsyncResult outputReader = reader.BeginInvoke(process.StandardOutput, null, null);
                IAsyncResult errorReader = reader.BeginInvoke(process.StandardError, null, null);

                process.StandardInput.Close();

                process.WaitForExit();

                string output = reader.EndInvoke(outputReader);
                string error = reader.EndInvoke(errorReader);

                // Sometimes, we get an exit code of 1 even when the command succeeds (e.g. with 'git reset .').
                // So also make sure there is an error string
                if (process.ExitCode != 0)
                {
                    string text = String.IsNullOrEmpty(error) ? output : error;

                    throw new Exception(text);
                }

                return Tuple.Create(output, error);
            }
        }
		public void Attach(IProfiler newProfiler)
		{
			if (newProfiler == null)
				throw new ArgumentNullException("newProfiler");
			if (newProfiler == this.WrappedProfiler)
				return;

			if (this.WrappedProfiler != null)
			{
				try
				{
					this.WrappedProfiler.Detach();
				}
				catch (Exception ex)
				{
					ServerApi.LogWriter.ServerWriteLine(
						string.Format("Profiler \"{0}\" had thrown an unexpected exception:\n{1}", this.ProfilerName, ex), TraceLevel.Error);
				}

				ServerApi.LogWriter.ServerWriteLine(
					string.Format("Profiler \"{0}\" was detached.", this.ProfilerName), TraceLevel.Verbose);
			}

			this.WrappedProfiler = newProfiler;

			ServerApi.LogWriter.ServerWriteLine(
				string.Format("Profiler \"{0}\" was attached.", this.ProfilerName), TraceLevel.Verbose);
		}
 public DefaultPhysicsEngine(
     IPhysicsFactory physicsFactory,
     IProfiler profiler)
 {
     _physicsFactory = physicsFactory;
     _profiler = profiler;
 }
		public MonoProfilerExecutionHandler (IProfiler profiler)
		{
			if (profiler == null)
				throw new ArgumentNullException ("profiler");
			
			this.profiler = profiler;
		}
        /// <summary>
        /// Sets an IProfiler instance for this ConnectionMultiplexer.
        /// 
        /// An IProfiler instances is used to determine which context to associate an
        /// IProfiledCommand with.  See BeginProfiling(object) and FinishProfiling(object)
        /// for more details.
        /// </summary>
        public void RegisterProfiler(IProfiler profiler)
        {
            if (profiler == null) throw new ArgumentNullException("profiler");
            if (this.profiler != null) throw new InvalidOperationException("IProfiler already registered for this ConnectionMultiplexer");

            this.profiler = profiler;
            this.profiledCommands = new ProfileContextTracker();
        }
Example #6
0
        public static IDisposable Step(this IProfiler profiler, string methodName = "")
        {
            var profImpl = profiler as IProfilerImplementation;

            if (profImpl == null)
            {
                return(null);
            }
            return(profImpl.Step(methodName));
        }
Example #7
0
        /// <summary>
        /// Initializes a new <see cref="DbProfiler"/>.
        /// </summary>
        /// <param name="profiler">The profiler.</param>
        public DbProfiler(IProfiler profiler)
        {
            if (profiler == null)
            {
                throw new ArgumentNullException("profiler");
            }

            _profiler = profiler;
            _inProgressDataReaders = new ConcurrentDictionary <DbDataReader, DbTiming>();
        }
Example #8
0
        /// <summary>
        /// Initializes a <see cref="Timing"/>
        /// </summary>
        /// <param name="profiler">The <see cref="IProfiler"/>.</param>
        /// <param name="type">The type of timing.</param>
        /// <param name="parentId">The identity of the parent timing.</param>
        /// <param name="name">The name of the timing.</param>
        /// <param name="tags">The tags of the timing.</param>
        public Timing(IProfiler profiler, string type, Guid?parentId, string name, TagCollection tags)
        {
            _profiler = profiler;
            Type      = type;
            ParentId  = parentId;
            Name      = name;
            Tags      = tags;

            Id = Guid.NewGuid();
        }
Example #9
0
        /// <summary>
        /// Initializes a new <see cref="DbProfiler"/>.
        /// </summary>
        /// <param name="profiler">The profiler.</param>
        public DbProfiler(IProfiler profiler)
        {
            if (profiler == null)
            {
                throw new ArgumentNullException("profiler");
            }

            _profiler = profiler;
            _inProgressDataReaders = new ConcurrentDictionary<IDataReader, DbTiming>();
        }
		public ProcessProfilerExecutionHandler (IProfiler profiler, Process process)
		{
			if (profiler == null)
				throw new ArgumentNullException ("profiler");
			if (process == null)
				throw new ArgumentNullException ("process");
			
			this.profiler = profiler;
			this.process = process;
		}
        /// <summary>
        /// Sets an IProfiler instance for this ConnectionMultiplexer.
        ///
        /// An IProfiler instances is used to determine which context to associate an
        /// IProfiledCommand with.  See BeginProfiling(object) and FinishProfiling(object)
        /// for more details.
        /// </summary>
        /// <param name="profiler">The profiler to register.</param>
        public void RegisterProfiler(IProfiler profiler)
        {
            if (this.profiler != null)
            {
                throw new InvalidOperationException("IProfiler already registered for this ConnectionMultiplexer");
            }

            this.profiler    = profiler ?? throw new ArgumentNullException(nameof(profiler));
            profiledCommands = new ProfileContextTracker();
        }
Example #12
0
 public static ITable <TEntity> Create(
     IConnectionManager connectionManager,
     string tableName,
     IEntityMapping entityMapping = null,
     IProfiler profiler           = null,
     bool noLock = false)
 {
     return(new Table <TEntity>(connectionManager, tableName,
                                entityMapping ?? new EntityMapping(new AutoClassMap <TEntity>()),
                                profiler ?? new ConsoleProfiler(), noLock));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DelayedJobScheduler"/>
        /// class with a specified polling interval and given state changer.
        /// </summary>
        /// <param name="pollingDelay">Delay between scheduler runs.</param>
        /// <param name="stateChanger">State changer to use for background jobs.</param>
        ///
        /// <exception cref="ArgumentNullException"><paramref name="stateChanger"/> is null.</exception>
        public DelayedJobScheduler(TimeSpan pollingDelay, [NotNull] IBackgroundJobStateChanger stateChanger)
        {
            if (stateChanger == null)
            {
                throw new ArgumentNullException(nameof(stateChanger));
            }

            _stateChanger = stateChanger;
            _pollingDelay = pollingDelay;
            _profiler     = new SlowLogProfiler(_logger);
        }
Example #14
0
        /// <summary>
        /// Initializes a <see cref="TimingBase"/>
        /// </summary>
        /// <param name="profiler">The <see cref="IProfiler"/>.</param>
        /// <param name="type">The type of timing.</param>
        /// <param name="parentId">The identity of the parent timing.</param>
        /// <param name="name">The name of the timing.</param>
        protected TimingBase(IProfiler profiler, string type, Guid? parentId, string name)
            : this(type, name)
        {
            if (profiler == null)
            {
                throw new ArgumentNullException("profiler");
            }

            _profiler = profiler;
            ParentId = parentId;
        }
        /// <summary>
        /// Returns an <see cref="IDisposable"/> that will time the code between its creation and disposal.
        /// </summary>
        /// <param name="profiler">The current profiling session or null.</param>
        /// <param name="name">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param>
        /// <param name="level">This step's visibility level; allows filtering when <see cref="MiniProfiler.Start"/> is called.</param>
        public static IDisposable Step(this IProfiler profiler, string name, ProfileLevel level)
        {
            var miniProfiler = profiler.GetMiniProfiler();

            if (CustomStepFn != null)
            {
                return(CustomStepFn(miniProfiler, name));
            }

            return(profiler == null ? null : miniProfiler.StepImpl(name, level));
        }
Example #16
0
        public void StartGame(IScreen screen, IProfiler profiler = null)
        {
            if (profiler != null)
            {
                this.machine.RegisterProfiler(profiler);
            }

            this.machine.RegisterScreen(screen);
            this.machine.Randomize(42);
            this.machine.RunAsync();
        }
Example #17
0
        private void Setup()
        {
            ILogger                 loggerMock                 = Mock.Of <ILogger>();
            IProfiler               profilerMock               = Mock.Of <IProfiler>();
            HttpContextBase         contextBaseMock            = Mock.Of <HttpContextBase>();
            WebSecurity             webSecurityMock            = new Mock <WebSecurity>(null, null).Object;
            IUmbracoSettingsSection umbracoSettingsSectionMock = Mock.Of <IUmbracoSettingsSection>();

            ApplicationContext.Current = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger(loggerMock, profilerMock));
            UmbracoContext.Current     = UmbracoContext.EnsureContext(contextBaseMock, ApplicationContext.Current, webSecurityMock, umbracoSettingsSectionMock, Enumerable.Empty <IUrlProvider>(), true);
        }
Example #18
0
 public static ITable <TEntity> Create(
     SqlConnection connection,
     string tableName,
     IEntityMapping entityMapping = null,
     TimeSpan?commandTimeout      = null,
     IProfiler profiler           = null,
     bool noLock = false)
 {
     return(Create(new ConnectionManager(connection, commandTimeout ?? new TimeSpan(0, 5, 0)),
                   tableName, entityMapping, profiler ?? new ConsoleProfiler(), noLock));
 }
        public RepositoryProfiler(IRepositoryReader <TEntity> readerDelegate, IRepositoryWriter <TEntity> writerDelegate, IProfiler profiler)
        {
            _readerDelegate = readerDelegate;
            _writerDelegate = writerDelegate;
            _profiler       = profiler;

            // set up profiler
            _profiler      = profiler;
            _profiler.Log  = _log;
            _profiler.Type = typeof(TEntity).Name;
        }
Example #20
0
        public ProfilerWindow(IProfiler Profiler)
        {
            this.Profiler = Profiler;

            InitializeComponent();
            CreateNodeList();
            CreateColumns();
            AddToolstripButtons();
            ProfilerWindow_Resize(this, null);
            OnRealTimeProfilingButton(this, null);
        }
Example #21
0
		public static IAsyncOperation ProfileFile (IProfiler profiler, string fileName)
		{
			if (IdeApp.ProjectOperations.CurrentRunOperation != null
			       && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
			       return IdeApp.ProjectOperations.CurrentRunOperation;
			
			SwitchWorkbenchContext (ProfileWorkbenchContext);
			ExecutionContext context = new ExecutionContext (profiler.GetDefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);

			return IdeApp.ProjectOperations.ExecuteFile (fileName, context);
		}
Example #22
0
 public ContentsService(
     IMediator mediator,
     ContentQueries query,
     IProfiler profiler,
     ContentsConverter converter)
 {
     _mediator  = mediator ?? throw new ArgumentNullException(nameof(mediator));
     _query     = query ?? throw new ArgumentNullException(nameof(query));
     _profiler  = profiler ?? throw new ArgumentNullException(nameof(profiler));
     _converter = converter ?? throw new ArgumentNullException(nameof(converter));
 }
Example #23
0
        public DefaultWorld(
            IProfiler profiler,
            INetworkingSession networkSession,
            IEntityFactory playerFactory,
            ICurrentNode currentNode)
        {
            currentNode.SetName("AmazingWorld");

            playerFactory.CreatePlayer("Player1");
            playerFactory.CreatePlayer("Player2");
        }
Example #24
0
        public DefaultWorld(
            IProfiler profiler,
            INetworkingSession networkSession,
            IEntityFactory playerFactory,
            ICurrentNode currentNode)
        {
            currentNode.SetName("AmazingWorld");

            playerFactory.CreatePlayer("Player1");
            playerFactory.CreatePlayer("Player2");
        }
Example #25
0
        private static void ProfileCommand(Statement statement, IProfiler profiler)
        {
            var message = new StringBuilder();

            message.Append(statement.Text);
            if (statement.Type == Statement.StatementType.StoredProcedure && statement.Parameters.Count > 0)
            {
                message.Append(" " + statement.Parameters.Select(x => x.Key).Aggregate((a, i) => $"{a}, {i}"));
            }
            profiler.Write(message.ToString());
        }
Example #26
0
        private async Task <int> CreateTask(IProfiler profiler, string name)
        {
            using (profiler.Profile(new ProfileOperationSpecification(name)
            {
                Category = "Test"
            }))
            {
                await Task.Delay(100);
            }

            return(42);
        }
Example #27
0
        public static ITable <TEntity> Create(
            IConnectionManager connectionManager,
            string tableName,
            string keyColumn,
            IProfiler profiler = null,
            bool noLock        = false)
        {
            var mapping = new EntityMapping(new AutoClassMap <TEntity>(keyColumn));

            return(new Table <TEntity>(connectionManager, tableName,
                                       mapping, profiler ?? new ConsoleProfiler(), noLock));
        }
Example #28
0
        /// <summary>
        /// Gets the connection.
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="profiler">The profiler.</param>
        /// <returns>IDbConnection.</returns>
        private IDbConnection GetConnection(string connectionString, IProfiler profiler = null)
        {
            var conn = new SqlConnection(connectionString);

            if (profiler == null)
            {
                return(conn);
            }
            var dbProfiler = new DbProfiler(profiler);

            return(new ProfiledDbConnection(conn, dbProfiler));
        }
        internal void InvokeMeasured_WithActionAndNullInstance_InvokesIt(IProfiler profiler)
        {
            var invoked = false;

            profiler.InvokeMeasured((object)null, x =>
            {
                Assert.Null(x);
                invoked = true;
            });

            Assert.True(invoked);
        }
Example #30
0
        /// <summary>
        /// Initializes a new WCF timing.
        /// </summary>
        /// <param name="profiler">
        ///     The <see cref="IProfiler"/> where
        ///     to add the <see cref="CustomTiming"/> to when stops.
        /// </param>
        /// <param name="requestMessage">
        ///     The request message of the WCF service method being called &amp; profiled.
        /// </param>
        public WcfTiming(IProfiler profiler, ref Message requestMessage)
            : base(profiler, WcfTimingType, requestMessage.Headers.Action)
        {
            if (requestMessage == null)
            {
                throw new ArgumentNullException("requestMessage");
            }

            _profiler = profiler;
            InputData = ToXml(ref requestMessage);
            InputSize = InputData.Length;
        }
        /// <exception cref="ArgumentNullException"><paramref name="profiler"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="logger"/> is <see langword="null" />.</exception>
        public ProfileSession([NotNull] IProfiler profiler,
                              [NotNull] IProfilerLogger logger)
        {
            this.stopwatch = Stopwatch.StartNew();

            this.Profiler = profiler ?? throw new ArgumentNullException(nameof(profiler));
            this.logger   = logger ?? throw new ArgumentNullException(nameof(logger));

            this.operations      = new List <ProfileOperation>();
            this.operationsStack = new AsyncLocal <Stack <ProfileOperation> >();
            this.Data            = new Dictionary <string, object>(StringComparer.Ordinal);
        }
Example #32
0
        public static void Run(IRunner caller, IProfiler profiler, int repetitionsCount, IChartBuilder builder)
        {
            var result = profiler.Measure(caller, repetitionsCount);
            var chart  = builder.Build(result);
            var form   = new Form {
                ClientSize = new Size(800, 600)
            };

            chart.Dock = DockStyle.Fill;
            form.Controls.Add(chart);
            Application.Run(form);
        }
Example #33
0
		public static IAsyncOperation ProfileApplication (IProfiler profiler, string executable, string workingDirectory, string args)
		{
			if (IdeApp.ProjectOperations.CurrentRunOperation != null
			       && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
			       return IdeApp.ProjectOperations.CurrentRunOperation;
			
			SwitchWorkbenchContext (ProfileWorkbenchContext);
			ExecutionContext context = new ExecutionContext (profiler.GetDefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);

			//TODO: 
			return NullAsyncOperation.Failure;
		}
        internal void InvokeMeasured_WithAction_InvokesIt(IProfiler profiler)
        {
            var invoked = false;

            profiler.InvokeMeasured(_instance, x =>
            {
                Assert.Same(_instance, x);
                invoked = true;
            });

            Assert.True(invoked);
        }
        /// <summary>
        /// Creates an <see cref="IUmbracoBuilder"/> and registers basic Umbraco services
        /// </summary>
        public static IUmbracoBuilder AddUmbraco(
            this IServiceCollection services,
            IWebHostEnvironment webHostEnvironment,
            IConfiguration config)
        {
            if (services is null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (config is null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            IHostingEnvironment tempHostingEnvironment = GetTemporaryHostingEnvironment(webHostEnvironment, config);

            var loggingDir    = tempHostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.LogFiles);
            var loggingConfig = new LoggingConfiguration(loggingDir);

            services.AddLogger(tempHostingEnvironment, loggingConfig, config);

            // The DataDirectory is used to resolve database file paths (directly supported by SQL CE and manually replaced for LocalDB)
            AppDomain.CurrentDomain.SetData("DataDirectory", tempHostingEnvironment?.MapPathContentRoot(Constants.SystemDirectories.Data));

            // Manually create and register the HttpContextAccessor. In theory this should not be registered
            // again by the user but if that is the case it's not the end of the world since HttpContextAccessor
            // is just based on AsyncLocal, see https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http/src/HttpContextAccessor.cs
            IHttpContextAccessor httpContextAccessor = new HttpContextAccessor();

            services.AddSingleton(httpContextAccessor);

            var requestCache = new HttpContextRequestAppCache(httpContextAccessor);
            var appCaches    = AppCaches.Create(requestCache);

            services.ConfigureOptions <ConfigureKestrelServerOptions>();
            services.ConfigureOptions <ConfigureIISServerOptions>();
            services.ConfigureOptions <ConfigureFormOptions>();

            IProfiler profiler = GetWebProfiler(config);

            ILoggerFactory loggerFactory = LoggerFactory.Create(cfg => cfg.AddSerilog(Log.Logger, false));

            TypeLoader typeLoader = services.AddTypeLoader(
                Assembly.GetEntryAssembly(),
                tempHostingEnvironment,
                loggerFactory,
                appCaches,
                config,
                profiler);

            return(new UmbracoBuilder(services, config, typeLoader, loggerFactory, profiler, appCaches, tempHostingEnvironment));
        }
Example #36
0
 public ChunkManagerEntity(
     TychaiaGameWorld gameWorld, 
     IChunkAI[] chunkAI, 
     IProfiler profiler, 
     IChunkRenderer chunkRenderer)
 {
     this.m_World = gameWorld;
     this.m_ChunkAI = chunkAI;
     this.m_Profiler = profiler;
     this.m_ChunkRenderer = chunkRenderer;
     this.m_ChunksToRenderNext = new ClientChunk[0];
 }
Example #37
0
        void FillSource(IProfiler profiler, DataTable table)
        {
            if (_traces[profiler].DataTable.Rows.Count == 0 && table.Rows.Count > 0)
            {
                _traces[profiler].DataTable.Merge(table, false);
                return;
            }

            foreach (DataRow row in table.Rows)
            {
                _traces[profiler].DataTable.LoadDataRow(row.ItemArray, true);
            }
        }
Example #38
0
        public RecordingManager(IScriptManager ScriptManager, ISettingsManager SettingsManager, ICroppingManager CroppingManager, IAssetManager AssetManager, IProfiler Profiler,
                                IFeatureDetectorFactory FeatureDetectorFactory, IInputCallbacks InputCallbacks)
        {
            this.ScriptManager          = ScriptManager;
            this.SettingsManager        = SettingsManager;
            this.CroppingManager        = CroppingManager;
            this.AssetManager           = AssetManager;
            this.Profiler               = Profiler;
            this.FeatureDetectorFactory = FeatureDetectorFactory;
            this.InputCallbacks         = InputCallbacks;

            InputCallbacks.InputEvent += OnInputEvent;
        }
        public static IAsyncOperation ProfileFile(IProfiler profiler, string fileName)
        {
            if (IdeApp.ProjectOperations.CurrentRunOperation != null &&
                !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
            {
                return(IdeApp.ProjectOperations.CurrentRunOperation);
            }

            SwitchWorkbenchContext(ProfileWorkbenchContext);
            ExecutionContext context = new ExecutionContext(profiler.GetDefaultExecutionHandlerFactory(), IdeApp.Workbench.ProgressMonitors);

            return(IdeApp.ProjectOperations.ExecuteFile(fileName, context));
        }
Example #40
0
 public ProfilingLogger(ILogger logger, IProfiler profiler)
 {
     Logger   = logger;
     Profiler = profiler;
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (profiler == null)
     {
         throw new ArgumentNullException("profiler");
     }
 }
Example #41
0
        private Thread CreateAndStartThread(int threadIndex, IProfiler optionalProfiler)
        {
            var cqIndex = threadIndex % completionQueues.Count;
            var cq      = completionQueues.ElementAt(cqIndex);

            var thread = new Thread(new ThreadStart(() => RunHandlerLoop(cq, optionalProfiler)));

            thread.IsBackground = true;
            thread.Name         = string.Format("grpc {0} (cq {1})", threadIndex, cqIndex);
            thread.Start();

            return(thread);
        }
Example #42
0
        protected override void Run()
        {
            SelectProcessDialog dlg = new SelectProcessDialog();

            if (dlg.Run() == (int)ResponseType.Ok)
            {
                IProfiler profiler = dlg.Profiler;
                Process   process  = dlg.Process;

                ProfilingOperations.ProfileProcess(profiler, process);
            }
            dlg.Destroy();
        }
Example #43
0
 /// <summary>
 /// Initializes a <see cref="DbTiming"/>.
 /// </summary>
 /// <param name="profiler">
 ///     The <see cref="IProfiler"/> where
 ///     to add the <see cref="CustomTiming"/> to when stops.
 /// </param>
 /// <param name="executeType">The <see cref="DbExecuteType"/> of the <see cref="IDbCommand"/> being executed &amp; profiled.</param>
 /// <param name="command">The <see cref="IDbCommand"/> being executed &amp; profiled.</param>
 public DbTiming(
     IProfiler profiler, DbExecuteType executeType, IDbCommand command)
     : base(profiler, "db", command == null ? null : command.CommandText)
 {
     _profiler = profiler;
     DbExecuteType = executeType;
     ExecuteType = executeType.ToString().ToLowerInvariant();
     if (command != null)
     {
         Parameters = new DbTimingParameterCollection(command.Parameters);
         InputSize = Parameters.Size;
         InputData = ToXml(Parameters);
     }
 }
Example #44
0
		public static IAsyncOperation ProfileProcess (IProfiler profiler, Process process)
		{
			if (IdeApp.ProjectOperations.CurrentRunOperation != null
			       && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
			       return IdeApp.ProjectOperations.CurrentRunOperation;
			
			SwitchWorkbenchContext (ProfileWorkbenchContext);

			string workingDir = ProfilingService.GetProcessDirectory (process.Id);
			IExecutionHandler handler = profiler.GetProcessExecutionHandlerFactory (process);
			DotNetExecutionCommand cmd = new DotNetExecutionCommand ();
			cmd.WorkingDirectory = workingDir;
			return handler.Execute (cmd, null /*context.ConsoleFactory.CreateConsole (true)*/);
		}
 public PredeterminedChunkGeneratorAI(
     IProfiler profiler,
     IChunkSizePolicy chunkSizePolicy,
     IDebugCubeRenderer debugCubeRenderer,
     IPredeterminedChunkPositions predeterminedChunkPositions,
     IClientChunkFactory clientChunkFactory)
 {
     this.m_Profiler = profiler;
     this.m_ChunkSizePolicy = chunkSizePolicy;
     this.m_DebugCubeRenderer = debugCubeRenderer;
     this.m_PredeterminedChunkPositions = predeterminedChunkPositions;
     this.m_ClientChunkFactory = clientChunkFactory;
     this.ShowDebugInfo = "false";
 }
Example #46
0
        /// <summary>
        /// Resets <see cref="Current"/>. Indented for testing only, and not supported in production code.
        /// </summary>
        /// <remarks>
        /// <para>For UNIT TESTS exclusively.</para>
        /// <para>Resets everything that is 'current'.</para>
        /// </remarks>
        public static void Reset()
        {
            _factory.DisposeIfDisposable();
            _factory = null;

            _configs                = null;
            _shortStringHelper      = null;
            _logger                 = null;
            _profiler               = null;
            _profilingLogger        = null;
            _publishedValueFallback = null;

            Resetted?.Invoke(null, EventArgs.Empty);
        }
Example #47
0
        private string BuildProject(IProfiler profiler, string buildTempPath)
        {
            string command = @"""{0}"" /nologo /verbosity:m /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir=""{1}"";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;";
            if (String.IsNullOrEmpty(_solutionPath))
            {
                command += "{2}";
                return ExecuteMSBuild(profiler, command, _projectPath, buildTempPath, GetPropertyString());
            }

            string solutionDir = Path.GetDirectoryName(_solutionPath) + @"\\";
            command += @"SolutionDir=""{2}"";{3}";

            // Build artifacts into a temp path
            return ExecuteMSBuild(profiler, command, _projectPath, buildTempPath, solutionDir, GetPropertyString());
        }
Example #48
0
        /// <summary>
        /// Initializes a <see cref="StepTiming"/>.
        /// </summary>
        /// <param name="profiler">
        ///     The <see cref="IProfiler"/> where
        ///     to add the <see cref="StepTiming"/> to when stops.
        /// </param>
        /// <param name="name">The name of the <see cref="StepTiming"/>.</param>
        public StepTiming(IProfiler profiler, string name)
            : base(profiler
                , "step"
                , GetParentId(profiler)
                , name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            _profiler = profiler;
            StartMilliseconds = _profiler.DurationMilliseconds;
            Sort = profiler.GetDurationTicks();
            ProfilingSession.ProfilingSessionContainer.CurrentSessionStepId = Id;
        }
 public DefaultRenderPipeline(
     IGraphicsBlit graphicsBlit,
     IRenderTargetBackBufferUtilities renderTargetBackBufferUtilities,
     IProfiler profiler,
     [FromGame] IEngineHook[] engineHooks)
 {
     _graphicsBlit = graphicsBlit;
     _renderTargetBackBufferUtilities = renderTargetBackBufferUtilities;
     _profiler = profiler;
     _engineHooks = engineHooks;
     _standardRenderPasses = new List<IRenderPass>();
     _postProcessingRenderPasses = new List<IRenderPass>();
     _transientStandardRenderPasses = new List<IRenderPass>();
     _transientPostProcessingRenderPasses = new List<IRenderPass>();
     _renderPass = null;
     _isFirstRenderPass = false;
 }
        public PROJECT_SAFE_NAMEWorld(
            INode worldNode,
            IHierarchy hierarchy,
            IPlatforming platforming,
            I2DRenderUtilities renderUtilities,
            IAssetManagerProvider assetManagerProvider,
            IAudioUtilities audioUtilities,
            IProfiler profiler,
            ILevelManager levelManager)
        {
            this.m_RenderUtilities = renderUtilities;
            this.m_Profiler = profiler;
            this.m_LevelManager = levelManager;
            this.m_AssetManager = assetManagerProvider.GetAssetManager(false);
            this.Entities = new List<IEntity>();

            this.m_LevelManager.Load(this, "level.Level0");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GameAssetManagerProvider"/> class.
 /// </summary>
 /// <param name="kernel">
 /// The kernel.
 /// </param>
 /// <param name="profilers">
 /// The profilers.
 /// </param>
 /// <param name="rawLoader">
 /// The raw loader.
 /// </param>
 /// <param name="rawSaver">
 /// The raw saver.
 /// </param>
 /// <param name="loaders">
 /// The loaders.
 /// </param>
 /// <param name="savers">
 /// The savers.
 /// </param>
 /// <param name="transparentAssetCompiler">
 /// The transparent asset compiler.
 /// </param>
 public GameAssetManagerProvider(
     IKernel kernel, 
     IProfiler[] profilers, 
     IRawAssetLoader rawLoader, 
     IRawAssetSaver rawSaver, 
     IAssetLoader[] loaders, 
     IAssetSaver[] savers, 
     ITransparentAssetCompiler transparentAssetCompiler)
 {
     this.m_AssetManager = new LocalAssetManager(
         kernel,
         profilers,
         rawLoader,
         rawSaver,
         loaders,
         savers,
         transparentAssetCompiler);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GameAssetManagerProvider"/> class.
 /// </summary>
 /// <param name="kernel">
 /// The kernel.
 /// </param>
 /// <param name="profilers">
 /// The profilers.
 /// </param>
 /// <param name="rawLoader">
 /// The raw loader.
 /// </param>
 /// <param name="rawSaver">
 /// The raw saver.
 /// </param>
 /// <param name="loaders">
 /// The loaders.
 /// </param>
 /// <param name="savers">
 /// The savers.
 /// </param>
 /// <param name="transparentAssetCompiler">
 /// The transparent asset compiler.
 /// </param>
 public ReloadableGameAssetManagerProvider(
     IKernel kernel, 
     IProfiler[] profilers, 
     IRawAssetLoader rawLoader, 
     IRawAssetSaver rawSaver, 
     IAssetLoader[] loaders, 
     IAssetSaver[] savers, 
     ITransparentAssetCompiler transparentAssetCompiler)
 {
     this.m_AssetManager = new LocalAssetManager(
         kernel,
         profilers,
         rawLoader,
         rawSaver,
         loaders,
         savers,
         transparentAssetCompiler);
     this.m_AssetManager.GenerateRuntimeProxies = true;
 }
Example #53
0
		protected override void Run (object ob)
		{
			profiler = (IProfiler)ob;

			Solution sol = IdeApp.ProjectOperations.CurrentSelectedSolution;
			if (sol != null) {
				IAsyncOperation op = IdeApp.ProjectOperations.Build (sol);
				op.Completed += delegate {
					if (op.Success)
						ProfilingOperations.Profile (profiler, sol);
				};
			} else {
				doc = IdeApp.Workbench.ActiveDocument;
				if (doc != null) {
					IAsyncOperation op = doc.Build ();
					op.Completed += new OperationHandler (ExecuteFile);
				}
			}
		}
 public ExampleWorld(
     IPlatforming platforming,
     I2DRenderUtilities renderUtilities,
     IAssetManagerProvider assetManagerProvider,
     IAudioUtilities audioUtilities,
     IProfiler profiler,
     ILevelManager levelManager)
 {
     this.m_RenderUtilities = renderUtilities;
     this.m_Profiler = profiler;
     this.m_LevelManager = levelManager;
     this.m_AssetManager = assetManagerProvider.GetAssetManager(false);
     this.Entities = new List<IEntity>();
     
     this.Entities.Add(new Player(
         platforming,
         this.m_AssetManager,
         this.m_RenderUtilities,
         audioUtilities) { X = 400 });
         
     this.m_LevelManager.Load(this, "level.Level0");
 }
Example #55
0
        public GraphicsWindow(IMessageBus bus, IObservableTimer timer, IGUI gui, IAssets assets, IProfiler profiler, ICamera camera)
            : base(1280, 720, new GraphicsMode(32, 0, 0, 4), "Sharp Engine")
        {
            _profiler = profiler;
            _camera = camera;
            _profile = _profiler.Profile("Graphics");
            _timer = timer;
            _gui = gui;
            Bus = bus;

            Views = new ConcurrentDictionary<Guid, IGameObjectView>();
            SetupGUI();

            _assets = assets;
            foreach (var viewtype in AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany(s => s.GetTypes()).Where(p => typeof(IGameObjectView).IsAssignableFrom(p) && p.IsClass && p.IsDefined(typeof(BindViewAttribute), false)).ToList())
            {
                var bindViewAttribute = viewtype.GetCustomAttributes(typeof(BindViewAttribute), true).Cast<BindViewAttribute>().FirstOrDefault();
                if (bindViewAttribute != null) _availableViews.Add(bindViewAttribute.GameObjectType, viewtype);
            }

            Bus.OfType<GameObjectCreated>().Subscribe(OnGameObjectCreated);
        }
Example #56
0
 public static ITableSchema Create(IConnectionManager connectionManager, IProfiler profiler = null)
 {
     return new TableSchema(connectionManager, profiler ?? new ConsoleProfiler());
 }
Example #57
0
 public static ITableSchema Create(SqlConnection connection, TimeSpan? commandTimeout = null, IProfiler profiler = null)
 {
     return Create(new ConnectionManager(connection, commandTimeout ?? new TimeSpan(0, 5, 0)), profiler);
 }
Example #58
0
 public TableSchema(IConnectionManager connectionManager, IProfiler profiler)
 {
     _connectionManager = connectionManager;
     _profiler = profiler;
 }
 public void DeleteProfiler(IProfiler profiler)
 {
     profiler.TraceEvent -= profiler_TraceEvent;
     _traces.Remove(profiler);
     profiler.Dispose();
 }
 public ProfilerInspector(IProfiler profiler)
 {
     _profiler = profiler;
 }