Example #1
0
        /// <summary>
        /// Updates DirectX objects and calls.
        /// Layers are updated first, then the derived control is updated.
        /// </summary>
        protected virtual void UpdateDx(RenderTime updateTime)
        {
            OnUpdating(updateTime);

            lock (Layers)
            {
                Stopwatch sw = Stopwatch.StartNew();
                foreach (var layer in Layers)
                {
                    RenderProfile profile;
                    if (!ProfileStats.TryGetValue(layer.Name, out profile))
                    {
                        profile = new RenderProfile();
                        ProfileStats.Add(layer.Name, profile);
                    }

                    var start = sw.Elapsed;
                    layer.Update(updateTime);
                    profile.UpdateTime = (float)(sw.Elapsed - start).TotalMilliseconds;
                }
            }

            // Update our derived control
            OnUpdated(updateTime);
        }
Example #2
0
        /// <summary>
        /// Release the unmanaged resources used by the <see cref="Direct3DSurface"/> and it's child controls and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">True to release managed resources and unmanaged resources. False to only release unmanaged resources.</param>

        protected override void Dispose(bool disposing)
        {
            if (!disposing)
            {
                UnloadContent();

                Factory2D.Dispose();
                FactoryDirectWrite.Dispose();
                FactoryDxgi.Dispose();

                RenderTargetView.Dispose();
                RenderTarget2D.Dispose();

                _backBuffer.Dispose();
                _swapChain.Dispose();

                Context.Dispose();
                _device.Dispose();
                ProfileStats.Clear();
            }

            base.Dispose(disposing);
        }
        public ActionResult Stats(int id = 0)
        {
            Player user;

            if (id > 0)
            {
                user = db.Players.Find(id);
            }
            else
            {
                user = Auth.User;
            }

            if (user == null)
            {
                return(HttpNotFound());
            }

            var vm = new ProfileStats();

            vm.Player = user;

            var sql  = @"exec spGetPlayerStats @playerId";
            int year = ConfigurationManager.AppSettings["currentYear"] != null?Convert.ToInt32(ConfigurationManager.AppSettings["currentYear"]) : DateTime.Today.Year;

            using (var multi = db.Database.Connection.QueryMultiple(sql, new { playerId = user.Id, year = year }))
            {
                var statItems       = multi.Read <StatsItem>().ToList();
                var seasonSummaries = multi.Read <StatsSeasonSummary>().ToList();

                vm.StatItems = statItems;
                vm.Summaries = seasonSummaries;
            }


            return(View(vm));
        }
Example #4
0
        /// <summary>
        /// Local render. Performs timing calculations and debug rendering if required then calls <see cref="OnRendering"/> for inheriting controls. Presents the swap chain when ready.
        /// </summary>
        protected void Render(RenderTime renderTime)
        {
            if (!PresenterReady)
            {
                return;
            }
            // Update our derived control

            RenderTarget2D.BeginDraw();
            OnRendering(renderTime);

            lock (Layers)
            {
                Stopwatch sw = Stopwatch.StartNew();
                foreach (var layer in Layers)
                {
                    RenderProfile profile;
                    if (!ProfileStats.TryGetValue(layer.Name, out profile))
                    {
                        profile = new RenderProfile();
                        ProfileStats.Add(layer.Name, profile);
                    }

                    var start = sw.Elapsed;
                    layer.Render(renderTime);
                    profile.RenderTime = (float)(sw.Elapsed - start).TotalMilliseconds;
                }
                sw.Stop();
            }

            OnRendered(renderTime);
            RenderTarget2D.EndDraw();

            OnRender3D();

            _swapChain.Present(0, PresentFlags.None);
        }
Example #5
0
 /// <summary>
 /// Retracts the fact W profile.
 /// </summary>
 /// <param name="fact">The fact.</param>
 protected internal virtual void retractFactWProfile(Deffact fact)
 {
     ProfileStats.startRetract();
     root.retractObject(fact, engine, this);
     ProfileStats.endRetract();
 }
Example #6
0
 /// ----- helper methods that are not defined in WorkingMemory interface ----- ///
 protected internal virtual void assertFactWProfile(Deffact fact)
 {
     ProfileStats.startAssert();
     root.assertObject(fact, engine, this);
     ProfileStats.endAssert();
 }
Example #7
0
 public static string ToString(ProfileStats stats)
 {
     StringBuilder buf = new StringBuilder();
     buf.Append("ANTLR Runtime Report; Profile Version ");
     buf.Append(stats.Version);
     buf.Append(NewLine);
     buf.Append("parser name ");
     buf.Append(stats.name);
     buf.Append(NewLine);
     buf.Append("Number of rule invocations ");
     buf.Append(stats.numRuleInvocations);
     buf.Append(NewLine);
     buf.Append("Number of unique rules visited ");
     buf.Append(stats.numUniqueRulesInvoked);
     buf.Append(NewLine);
     buf.Append("Number of decision events ");
     buf.Append(stats.numDecisionEvents);
     buf.Append(NewLine);
     buf.Append("Number of rule invocations while backtracking ");
     buf.Append(stats.numGuessingRuleInvocations);
     buf.Append(NewLine);
     buf.Append("max rule invocation nesting depth ");
     buf.Append(stats.maxRuleInvocationDepth);
     buf.Append(NewLine);
     //		buf.Append("number of fixed lookahead decisions ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("min lookahead used in a fixed lookahead decision ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("max lookahead used in a fixed lookahead decision ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("average lookahead depth used in fixed lookahead decisions ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("standard deviation of depth used in fixed lookahead decisions ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("number of arbitrary lookahead decisions ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("min lookahead used in an arbitrary lookahead decision ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("max lookahead used in an arbitrary lookahead decision ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("average lookahead depth used in arbitrary lookahead decisions ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("standard deviation of depth used in arbitrary lookahead decisions ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("number of evaluated syntactic predicates ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("min lookahead used in a syntactic predicate ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("max lookahead used in a syntactic predicate ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("average lookahead depth used in syntactic predicates ");
     //		buf.Append();
     //		buf.Append(newline);
     //		buf.Append("standard deviation of depth used in syntactic predicates ");
     //		buf.Append();
     //		buf.Append(newline);
     buf.Append("rule memoization cache size ");
     buf.Append(stats.numMemoizationCacheEntries);
     buf.Append(NewLine);
     buf.Append("number of rule memoization cache hits ");
     buf.Append(stats.numMemoizationCacheHits);
     buf.Append(NewLine);
     buf.Append("number of rule memoization cache misses ");
     buf.Append(stats.numMemoizationCacheMisses);
     buf.Append(NewLine);
     //		buf.Append("number of evaluated semantic predicates ");
     //		buf.Append();
     //		buf.Append(newline);
     buf.Append("number of tokens ");
     buf.Append(stats.numTokens);
     buf.Append(NewLine);
     buf.Append("number of hidden tokens ");
     buf.Append(stats.numHiddenTokens);
     buf.Append(NewLine);
     buf.Append("number of char ");
     buf.Append(stats.numCharsMatched);
     buf.Append(NewLine);
     buf.Append("number of hidden char ");
     buf.Append(stats.numHiddenCharsMatched);
     buf.Append(NewLine);
     buf.Append("number of syntax errors ");
     buf.Append(stats.numReportedErrors);
     buf.Append(NewLine);
     return buf.ToString();
 }
Example #8
0
        public static string ToString(ProfileStats stats)
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("ANTLR Runtime Report; Profile Version ");
            buf.Append(stats.Version);
            buf.Append(NewLine);
            buf.Append("parser name ");
            buf.Append(stats.name);
            buf.Append(NewLine);
            buf.Append("Number of rule invocations ");
            buf.Append(stats.numRuleInvocations);
            buf.Append(NewLine);
            buf.Append("Number of unique rules visited ");
            buf.Append(stats.numUniqueRulesInvoked);
            buf.Append(NewLine);
            buf.Append("Number of decision events ");
            buf.Append(stats.numDecisionEvents);
            buf.Append(NewLine);
            buf.Append("Number of rule invocations while backtracking ");
            buf.Append(stats.numGuessingRuleInvocations);
            buf.Append(NewLine);
            buf.Append("max rule invocation nesting depth ");
            buf.Append(stats.maxRuleInvocationDepth);
            buf.Append(NewLine);
            //		buf.Append("number of fixed lookahead decisions ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("min lookahead used in a fixed lookahead decision ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("max lookahead used in a fixed lookahead decision ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("average lookahead depth used in fixed lookahead decisions ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("standard deviation of depth used in fixed lookahead decisions ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("number of arbitrary lookahead decisions ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("min lookahead used in an arbitrary lookahead decision ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("max lookahead used in an arbitrary lookahead decision ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("average lookahead depth used in arbitrary lookahead decisions ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("standard deviation of depth used in arbitrary lookahead decisions ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("number of evaluated syntactic predicates ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("min lookahead used in a syntactic predicate ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("max lookahead used in a syntactic predicate ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("average lookahead depth used in syntactic predicates ");
            //		buf.Append();
            //		buf.Append(newline);
            //		buf.Append("standard deviation of depth used in syntactic predicates ");
            //		buf.Append();
            //		buf.Append(newline);
            buf.Append("rule memoization cache size ");
            buf.Append(stats.numMemoizationCacheEntries);
            buf.Append(NewLine);
            buf.Append("number of rule memoization cache hits ");
            buf.Append(stats.numMemoizationCacheHits);
            buf.Append(NewLine);
            buf.Append("number of rule memoization cache misses ");
            buf.Append(stats.numMemoizationCacheMisses);
            buf.Append(NewLine);
            //		buf.Append("number of evaluated semantic predicates ");
            //		buf.Append();
            //		buf.Append(newline);
            buf.Append("number of tokens ");
            buf.Append(stats.numTokens);
            buf.Append(NewLine);
            buf.Append("number of hidden tokens ");
            buf.Append(stats.numHiddenTokens);
            buf.Append(NewLine);
            buf.Append("number of char ");
            buf.Append(stats.numCharsMatched);
            buf.Append(NewLine);
            buf.Append("number of hidden char ");
            buf.Append(stats.numHiddenCharsMatched);
            buf.Append(NewLine);
            buf.Append("number of syntax errors ");
            buf.Append(stats.numReportedErrors);
            buf.Append(NewLine);
            return(buf.ToString());
        }
Example #9
0
                public void UpdateProfileChanged()
                {
                    string currentProfile=Zeta.CommonBot.Settings.GlobalSettings.Instance.LastProfile;
                                if (CurrentProfile!=null&&CurrentProfile.ProfileName!=currentProfile)
                                {
                                     //Update last profile, start tracking a new one
                                     CurrentProfile.FinalizeStats();
                                     completedProfiles.Add(CurrentProfile);
                                     Bot.BotStatistics.ItemStats.CurrentGame.ProfileChanged(CurrentProfile.ItemStats);
                                     CurrentProfile=new ProfileStats(currentProfile);
                                }
                                else if (CurrentProfile==null)
                                     CurrentProfile=new ProfileStats(currentProfile);

                                //shouldUpdateXPCache = true;
                }
Example #10
0
 /// <summary> if the profiling is turned on for Remove, the method is
 /// called to Remove activations.
 /// </summary>
 /// <param name="">actv
 ///
 /// </param>
 public virtual void removeActivationWProfile(IActivation actv)
 {
     ProfileStats.startRemoveActivation();
     actv.Rule.Module.removeActivation(actv);
     ProfileStats.endRemoveActivation();
 }
Example #11
0
 /// <summary> if profiling is turned on, the method is called to Add
 /// new activations to the agenda
 /// </summary>
 /// <param name="">actv
 ///
 /// </param>
 public virtual void addActivationWProfile(IActivation actv)
 {
     ProfileStats.startAddActivation();
     actv.Rule.Module.addActivation(actv);
     ProfileStats.endAddActivation();
 }