Exemplo n.º 1
0
    static RamjetProfiler()
    {
        _root  = new ProfilerEntry("Game");
        _stack = new Stack <ProfilerEntry> ();

        ResetStack();
    }
Exemplo n.º 2
0
 // TODO : CONVERT THE PROFILER TO MEDIA TIMERS
 public static void Enter(ProfilerEntry entry)
 {
     #if DEBUG
     Entries[(int)entry]++;
     _lastTicks = System.DateTime.Now.Ticks;
     #endif
 }
Exemplo n.º 3
0
        // TODO : CONVERT THE PROFILER TO MEDIA TIMERS
        public static void Enter(ProfilerEntry entry)
        {
#if DEBUG
            Entries[(int)entry]++;
            _lastTicks = System.DateTime.Now.Ticks;
#endif
        }
Exemplo n.º 4
0
 public bool contextChangesWhen(ProfilerEntry entry)
 {
     if (entry.IsSetup)
     {
         return(true);
     }
     return(entry.Type == ProfileType.Enter && entry.IsFixtureConstructor);
 }
Exemplo n.º 5
0
 public void Add(string section, float duration)
 {
     if (!_profiles.ContainsKey(section))
     {
         _profiles[section] = new ProfilerEntry(_averageWindowSize);
     }
     _profiles[section].Age = 0;
     _profiles[section].Average.Update(duration);
     _totalTime = _profiles.Values.Select(entry => entry.Average.GetAverage()).Sum();
 }
Exemplo n.º 6
0
        public MeasureResult(MyCubeGrid myCubeGrid, ProfilerEntry profilerEntry, ulong ticks)
        {
            EntityId              = myCubeGrid.EntityId;
            EntityDisplayName     = myCubeGrid.DisplayName;
            EntityCoords          = myCubeGrid.PositionComp.WorldAABB.Center;
            MainThreadTimePerTick = profilerEntry.MainThreadTime / ticks;
            PlayerIdentityId      = myCubeGrid.BigOwners.FirstOrDefault(it => it != 0);
            PlayerSteamId         = MySession.Static.Players.TryGetSteamId(PlayerIdentityId);
            PlayerDisplayName     = MySession.Static.Players.TryGetIdentity(PlayerIdentityId)?.DisplayName ?? "Nobody";
            var faction = MySession.Static.Factions.GetPlayerFaction(PlayerIdentityId);

            FactionId   = faction?.FactionId;
            FactionName = faction?.Name;
        }
Exemplo n.º 7
0
 private static void LogFrameResultsRecursively(ProfilerEntry e, int depth, StringBuilder b)
 {
     if (e.HasResult())
     {
         // Indentation for callstack depth
         for (int i = 0; i < depth; i++)
         {
             b.Append("-");
         }
         b.AppendFormat(" {0}: {1:0.00}ms, {2}  calls\n", e.Id, e.AverageSeconds * 1000d, e.TimesCalled);
     }
     if (e.HasChildren())
     {
         for (int i = 0; i < e.Children.Count; i++)
         {
             LogFrameResultsRecursively(e.Children[i], depth + 1, b);
         }
     }
 }
Exemplo n.º 8
0
        public void Enrich(ProfilerEntry entry)
        {
            var node = TryGetEfferentCouplingNode(entry.Runtime.Replace('+', '/'));

            entry.Found = node != null;
            if (node != null)
            {
                var tmpname = _testIdentifiers.GetSpecificallyMangledName(node.MemberReference as MethodReference);

                if (tmpname != null)
                {
                    entry.Method  = tmpname;
                    entry.Runtime = tmpname;
                }
                entry.IsTest               = _testIdentifiers.IsProfilerTest(node.MemberReference as MethodReference);
                entry.IsSetup              = _testIdentifiers.IsProfilerSetup(node.MemberReference as MethodReference);
                entry.IsTeardown           = _testIdentifiers.IsProfilerTeardown(node.MemberReference as MethodReference);
                entry.IsFixtureConstructor = IsFixtureConstructor(node);
                entry.Reference            = node.MemberReference;
            }
        }
Exemplo n.º 9
0
        private void DoStart(string token)
        {
            ProfilerEntry entry;
            if (!_watches.TryGetValue(token, out entry))
            {
            entry = new ProfilerEntry();
            _watches[token] = entry;
            }

            entry.StartWatch(token);
        }
Exemplo n.º 10
0
 public static void Leave(ProfilerEntry entry)
 {
     #if DEBUG
     Times[(int)entry] += System.DateTime.Now.Ticks - _lastTicks;
     #endif
 }
Exemplo n.º 11
0
 public uint ReadPerformanceTicks(uint thread, ProfilerEntry entry)
 {
     return NativeAPI.ReadPerformanceTicks(handle, thread, (uint)entry);
 }
Exemplo n.º 12
0
        public static void Leave(ProfilerEntry entry)
        {
#if DEBUG
            Times[(int)entry] += System.DateTime.Now.Ticks - _lastTicks;
#endif
        }