Ejemplo n.º 1
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("price", _price);
     MemoryTracer.Variable("age", _age);
     return(MemoryTracer.End());
 }
 public override string ToString()
 {
     MemoryTracer.Start(this);
     //MemoryTracer.Variable("predicate", _predicate.ToString());
     MemoryTracer.Embedded(base.ToString());
     return(MemoryTracer.End());
 }
Ejemplo n.º 3
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("name", name);
     MemoryTracer.Variable("assembly", assembly);
     return(MemoryTracer.End());
 }
Ejemplo n.º 4
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Embedded(base.ToString());
     MemoryTracer.Embedded(_remoteLoader.ToString());
     return(MemoryTracer.End());
 }
 public override string ToString()
 {
     MemoryTracer.Start(this);
     //MemoryTracer.Variable("transformer", _transformer.ToString());
     MemoryTracer.Embedded(base.ToString());
     return(MemoryTracer.End());
 }
Ejemplo n.º 6
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Variable", "Value before");
     MemoryTracer.Embedded(_inside.ToString());
     MemoryTracer.Variable("Variable", "Value after");
     return(MemoryTracer.End());
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Provides an implementation of a dynamic .ONE memory allocator buffer for loading in the
        /// internal contents of .ONE files. The allocator's purpose is to allocates a new region of memory whenever
        /// the game
        /// </summary>
        public Allocator()
        {
            // Creates an instance of the memory tracer.
            MemoryTracer = new MemoryTracer();

            // Subscribe to the MemoryTracer's free function, we want to free our resources aswell.
            MemoryTracer.AfterFreeDelegate += AfterFreeDelegate;
        }
 public override string ToString()
 {
     MemoryTracer.Start(this);
     if (_account != null)
     {
         MemoryTracer.Embedded(_account.ToString());
     }
     return(MemoryTracer.End());
 }
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Value", value.ToString());
     MemoryTracer.Variable("Charges", charges.ToString());
     MemoryTracer.Variable("Purpose", purpose);
     MemoryTracer.Variable("Positive", positive);
     return(MemoryTracer.End());
 }
Ejemplo n.º 10
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Some variable", "Some value");
     MemoryTracer.StartArray("Local Embedded");
     MemoryTracer.Variable("embedded", "value");
     MemoryTracer.Variable("embedded", "value");
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
Ejemplo n.º 11
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.StartArray("collection");
     foreach (type value in _parent)
     {
         MemoryTracer.Embedded(value.ToString());
     }
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
Ejemplo n.º 12
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Plugin directory", _pluginDirectory);
     MemoryTracer.Variable("Application directory", _applicationDirectory);
     MemoryTracer.Variable("Base Directory", AppDomain.CurrentDomain.BaseDirectory);
     MemoryTracer.Variable("Shadow copy", _shadowCopyAll);
     MemoryTracer.Embedded(base.ToString());
     MemoryTracer.Embedded(_remoteLoader.ToString());
     return(MemoryTracer.End());
 }
Ejemplo n.º 13
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.StartArray("Extension Objects");
     foreach (Object obj in _list)
     {
         MemoryTracer.Variable("type", obj.GetType().FullName);
     }
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
Ejemplo n.º 14
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("runningtotal", _runningTotal);
     MemoryTracer.StartArray("tickets");
     foreach (Ticket ticket in _tickets)
     {
         MemoryTracer.Embedded(ticket.ToString());
     }
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Account count", _accounts.Count);
     MemoryTracer.StartArray("Account Collection");
     foreach (Object account in _accounts)
     {
         MemoryTracer.Embedded(account.ToString());
     }
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
 public override string ToString() {
     MemoryTracer.Start( this );
     MemoryTracer.Variable( "CurrIndex", _currIndex );
     MemoryTracer.Variable( "LastWrittenIndex", _afterLastWrittenIndex );
     MemoryTracer.Variable( "Buffer size", _buffer.Length );
     MemoryTracer.StartArray( "Buffer content" );
     for( ulong c1 = 0; c1 < _afterLastWrittenIndex; c1++ ) {
         MemoryTracer.Variable( "item", _buffer[ c1 ].ToString() );
     }
     MemoryTracer.EndArray();
     return MemoryTracer.End();
 }
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Entry Count", _entries.Count);
     MemoryTracer.StartArray("Entry Collection");
     foreach (Entry entry in _entries)
     {
         MemoryTracer.Embedded(entry.ToString());
     }
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
Ejemplo n.º 18
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     if (_parentReference.Target != null)
     {
         MemoryTracer.Variable("Alive reference", _parentReference.Target.ToString());
     }
     else
     {
         MemoryTracer.Embedded("Not alive");
     }
     return(MemoryTracer.End());
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Our own delegate implementation responsible for freeing our own allocated additional arbitrary memory
        /// whenever the game chooses to free a mapped address.
        /// </summary>
        /// <param name="memoryTracer">The memoryTracer instance that called the Free Delegate.</param>
        /// <param name="address">The address that has been freed.</param>
        /// <param name="memoryAddressDetails">Any extra details about the address that has been freed.</param>
        private void AfterFreeDelegate(ref MemoryTracer memoryTracer, ref int address, ref MemoryAddressDetails memoryAddressDetails)
        {
            // Try to get our own memory mappings for game's memory, then free it.
            if (AllocationMapping.TryGetValue(address, out List <Mapping> ownMemory))
            {
                for (int x = 0; x < ownMemory.Count; x++)
                {
                    MemoryTracer.FreeFunction(ownMemory[x].Address);
                }

                ownMemory.Clear();
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Gets called from OpenTK whenever it is time for an update
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Update(object sender, FrameEventArgs e)
        {
            FrameCounter++;

            MemoryTracer.NextStage("Update Frame: " + FrameCounter);

            MemoryTracer.AddSubStage("Scene Update");
            CurrentScene?.Update((float)e.Time);
            MemoryTracer.NextStage("World Update");
            CurrentScene?.Update((float)e.Time);

            MemoryTracer.NextStage("Physics Update");
            PhysicsEngine.Update((float)e.Time);

            if (_changeScene)
            {
                MemoryTracer.NextStage("Scene Intialization");
                _changeScene = false;


                MemoryTracer.AddSubStage("Removing Old Scene");

                CurrentScene?._Destroy();

                CurrentScene?.DestroyScene(); //Call on destroy on the scene itself.

                MemoryTracer.NextStage("Removing World");

                CurrentScene?.RemoveDestroyedObjects();


                MemoryTracer.NextStage("Create New Scene");

                CurrentScene = (AbstractScene)Activator.CreateInstance(_nextScene);

                MemoryTracer.NextStage("Initialize New Scene");

                CurrentScene._initializeScene();

                MemoryTracer.ReturnFromSubStage();
            }


            //Cleanup
            MemoryTracer.NextStage("Clean up Destroyed Objects");
            CurrentScene?.RemoveDestroyedObjects();
            MemoryTracer.ReturnFromSubStage(); //Returning to root.
            //ResourceManager.ProcessDeleteQueue();
        }
        public void Test_MemoryLeak()
        {
            using (MemoryTracer tracer = MemoryTracer.Begin())
            {
                MemoryLeakTest();

                ForceGC();

                tracer.End();

                (uint dealloc, uint unalloc) = tracer.GetStatus();

                Assert.AreEqual(unalloc, 0u);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Gets called by opentk when it is time for a render update
        /// </summary>
        /// <param name="o"></param>
        /// <param name="e"></param>
        private void OnRender(object o, EventArgs e)
        {
            RenderFrameCounter++;

            MemoryTracer.NextStage("Render Frame: " + RenderFrameCounter);

            MemoryTracer.AddSubStage("Rendering Render Targets");

            Renderer.RenderAllTargets(CurrentScene);

            MemoryTracer.NextStage("Swapping Window Buffers");

            Window.SwapBuffers();

            MemoryTracer.ReturnFromSubStage();
        }
Ejemplo n.º 23
0
                public override string ToString()
                {
                    MemoryTracer.Start(this);
                    MemoryTracer.Variable("application name", _applicationName);

                    MemoryTracer.Variable("Application directory", AppDomain.CurrentDomain.SetupInformation.ApplicationBase);
                    MemoryTracer.Variable("Application bin directory", AppDomain.CurrentDomain.SetupInformation.PrivateBinPath);

                    MemoryTracer.StartArray("Loaded Assemblies");
                    foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                    {
                        MemoryTracer.Variable("Assembly", assembly.FullName);
                    }
                    MemoryTracer.EndArray();
                    return(MemoryTracer.End());
                }
Ejemplo n.º 24
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Base Directory", AppDomain.CurrentDomain.BaseDirectory);
     MemoryTracer.StartArray("Loaded Assemblies");
     foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
     {
         MemoryTracer.Variable("Assembly", assembly.FullName);
     }
     MemoryTracer.EndArray();
     MemoryTracer.StartArray("Loaded Types");
     foreach (TypeDefinitions type in _types)
     {
         MemoryTracer.Embedded(type.ToString());
     }
     MemoryTracer.EndArray();
     return(MemoryTracer.End());
 }
Ejemplo n.º 25
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("identifier", _identifier);
     if (_rating == MOVIE_RATING.GENERAL)
     {
         MemoryTracer.Variable("rating", "GENERAL");
     }
     else if (_rating == MOVIE_RATING.PARENTS_CAUTIONED)
     {
         MemoryTracer.Variable("rating", "PARENTS_CAUTIONED");
     }
     else if (_rating == MOVIE_RATING.RESTRICTED)
     {
         MemoryTracer.Variable("rating", "RESTRICTED");
     }
     return(MemoryTracer.End());
 }
Ejemplo n.º 26
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Embedded(_object.ToString());
     return(MemoryTracer.End());
 }
Ejemplo n.º 27
0
        /// <summary>
        /// merges the targets and draws the results on the back buffer of the OpenGL Window
        /// </summary>
        /// <param name="targets"></param>
        public void MergeAndDisplayTargets(List <RenderTarget> targets)
        {
            if (isDisposed)
            {
                throw new Byt3Exception("Use of Disposed RenderMergeStage");
            }

            if (!_init)
            {
                Init();
            }


            MemoryTracer.AddSubStage("Merge Framebuffers");

            GL.Enable(EnableCap.Blend);
            GL.Disable(EnableCap.DepthTest);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

            foreach (RenderTarget renderTarget in targets)
            {
                MemoryTracer.NextStage("Merge Framebuffer: " + renderTarget.PassMask);
                RenderTarget dst = GetTarget();
                RenderTarget src = GetSource();

                if (dst.IsDisposed || src.IsDisposed)
                {
                    throw new Byt3Exception("Use of Disposed RenderMergeStage");
                }

                _mergeTypes[renderTarget.MergeType].Use();

                GL.BindFramebuffer(FramebufferTarget.Framebuffer, dst.FrameBuffer);

                GL.ClearColor(dst.ClearColor);
                GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);


                GL.ActiveTexture(TextureUnit.Texture0);
                GL.Uniform1(_mergeTypes[renderTarget.MergeType].GetUniformLocation("destinationTexture"), 0);
                GL.BindTexture(TextureTarget.Texture2D, src.RenderedTexture);

                GL.ActiveTexture(TextureUnit.Texture1);
                GL.Uniform1(_mergeTypes[renderTarget.MergeType].GetUniformLocation("otherTexture"), 1);
                GL.BindTexture(TextureTarget.Texture2D, renderTarget.RenderedTexture);

                GL.BindVertexArray(_screenVao);
                GL.DrawArrays(PrimitiveType.Triangles, 0, 6);


                Ping();
            }

            MemoryTracer.ReturnFromSubStage();

            MemoryTracer.NextStage("Rendering To Screen");
            GL.Disable(EnableCap.Blend);

            Ping();
            DefaultFilepaths.DefaultScreenShader.Use();

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);

            GL.ClearColor(Color.FromArgb(168, 143, 50, 255));
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);


            GL.ActiveTexture(TextureUnit.Texture0);
            GL.Uniform1(DefaultFilepaths.DefaultScreenShader.GetUniformLocation("sourceTexture"), 0);
            GL.BindTexture(TextureTarget.Texture2D, GetTarget().RenderedTexture);


            GL.BindVertexArray(_screenVao);

            GL.DrawArrays(PrimitiveType.Triangles, 0, 6);

            GL.BindVertexArray(0);
            GL.ActiveTexture(TextureUnit.Texture0);


            //Clear the ping pong buffers after rendering them to the screen
            //For whatever reason GL.Clear is not acting on the active framebuffer
            GL.ClearTexImage(_screenTarget1.RenderedTexture, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
            GL.ClearTexImage(_screenTarget0.RenderedTexture, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);


            GL.Enable(EnableCap.DepthTest);
        }
Ejemplo n.º 28
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     return(MemoryTracer.End());
 }
Ejemplo n.º 29
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("_value", _value);
     return(MemoryTracer.End());
 }
Ejemplo n.º 30
0
 public override string ToString()
 {
     MemoryTracer.Start(this);
     MemoryTracer.Variable("Identifier", Identifier);
     return(MemoryTracer.End());
 }