コード例 #1
0
	public static void Init()
	{
		Stopwatch stopwatch = new Stopwatch();

		stopwatch.Start();

			for(int i = 0; i < ITERATIONS; i ++)
			{
				Thread.Sleep(SLEEP);
			}
		stopwatch.Stop();

		pb_Profiler profiler = new pb_Profiler();
			profiler.BeginSample("Sleep");
				for(int i = 0; i < ITERATIONS; i++)
				{
					profiler.BeginSample("Thread.Sleep");
					Thread.Sleep(SLEEP);
					profiler.EndSample();
				}
			profiler.EndSample();

		profiler.EndSample();

		long s_sum = stopwatch.ElapsedMilliseconds;
		long p_sum = profiler.GetRootSample().sum;

		if( System.Math.Abs(p_sum - s_sum) > MAX_SUM_DELTA )
			UE.Debug.LogError("Stopwatch: " + s_sum + "\nProfiler: " + s_sum);
		else
			UE.Debug.Log("Stopwatch: " + s_sum + "\nProfiler: " + s_sum);
	}
コード例 #2
0
        void OnGUI()
        {
            int availableProfilerCount = profiles.Count;

            string[] display = new string[availableProfilerCount];
            int[]    values  = new int[availableProfilerCount];

            for (int i = 0; i < availableProfilerCount; i++)
            {
                display[i] = profiles[i].name;
                values[i]  = i;
            }

            if (profiler == null && availableProfilerCount > 0)
            {
                profiler = profiles[0];
                sampleView.SetProfiler(profiler);
            }

            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            EditorGUI.BeginChangeCheck();
            view = EditorGUILayout.IntPopup("", view, display, values, EditorStyles.toolbarDropDown);
            if (EditorGUI.EndChangeCheck())
            {
                profiler = view > -1 && view < availableProfilerCount ? profiles[view] : null;
                sampleView.SetProfiler(profiler);
            }

            GUILayout.FlexibleSpace();

            resolution = (Resolution)EditorGUILayout.EnumPopup("", resolution, EditorStyles.toolbarDropDown);

            // if(GUILayout.Button("Print"))
            //  UnityEngine.Debug.Log(profiler.ToString());

            if (GUILayout.Button("Clear", EditorStyles.toolbarButton) && profiler != null)
            {
                profiler.Reset();
            }

            GUILayout.EndHorizontal();

            sampleView.Draw();

            if (sampleView.wantsRepaint)
            {
                sampleView.wantsRepaint = false;
                Repaint();
            }
        }
コード例 #3
0
 public virtual void SetProfiler(pb_Profiler profiler)
 {
     this.profiler = profiler;
 }
コード例 #4
0
	public static bool GeneratePolygonCrosshatch(pb_Profiler profiler, Vector2[] polygon, float scale, Color color, int lineSpacing, ref Texture2D texture)
コード例 #5
0
ファイル: SampleTree.cs プロジェクト: karl-/pb_Profiler
 public override void SetProfiler(pb_Profiler profiler)
 {
     base.SetProfiler(profiler);
     row_visibility.Clear();
 }
コード例 #6
0
 public override void SetProfiler(pb_Profiler profiler)
 {
     base.SetProfiler(profiler);
     row_visibility.Clear();
 }
コード例 #7
0
ファイル: ISampleView.cs プロジェクト: karl-/pb_Profiler
 public virtual void SetProfiler(pb_Profiler profiler)
 {
     this.profiler = profiler;
 }
コード例 #8
0
ファイル: ProfilerEditor.cs プロジェクト: karl-/pb_Profiler
        void OnGUI()
        {
            int availableProfilerCount = profiles.Count;
            string[] display = new string[availableProfilerCount];
            int[] values = new int[availableProfilerCount];

            for(int i = 0; i < availableProfilerCount; i++)
            {
                display[i] = profiles[i].name;
                values[i] = i;
            }

            if(profiler == null && availableProfilerCount > 0)
            {
                profiler = profiles[0];
                sampleView.SetProfiler(profiler);
            }

            GUILayout.BeginHorizontal(EditorStyles.toolbar);

                EditorGUI.BeginChangeCheck();
                    view = EditorGUILayout.IntPopup("", view, display, values, EditorStyles.toolbarDropDown);
                if(EditorGUI.EndChangeCheck())
                {
                    profiler = view > -1 && view < availableProfilerCount ? profiles[view] : null;
                    sampleView.SetProfiler(profiler);
                }

                GUILayout.FlexibleSpace();

                resolution = (Resolution) EditorGUILayout.EnumPopup("", resolution, EditorStyles.toolbarDropDown);

                // if(GUILayout.Button("Print"))
                // 	UnityEngine.Debug.Log(profiler.ToString());

                if( GUILayout.Button("Clear", EditorStyles.toolbarButton) && profiler != null)
                    profiler.Reset();

            GUILayout.EndHorizontal();

            sampleView.Draw();

            if(sampleView.wantsRepaint)
            {
                sampleView.wantsRepaint = false;
                Repaint();
            }
        }