void Awake() { for (int i = 0; i < recordersList.Length; i++) { var sampler = Sampler.Get(recordersList[i].name); if (sampler.isValid) { recordersList[i].recorder = sampler.GetRecorder(); } else if (recordersList[i].oldName != null) { sampler = Sampler.Get(recordersList[i].oldName); if (sampler.isValid) { recordersList[i].recorder = sampler.GetRecorder(); } } } m_style = new GUIStyle { fontSize = 15 }; m_style.normal.textColor = Color.white; m_oldBatcherEnable = m_Enable; ResetStats(); }
public GameStatistics() { m_FrequencyMS = System.Diagnostics.Stopwatch.Frequency / 1000; //System.Diagnostics.Stopwatch.Frequency 10000000 long //m_FrequencyMS 10000 long //초당 tick수를 나타낸다. 1000으로 나누면 ms당 tick 값이다. 그래서 이름이 m_FrequencyMS 이군. m_StopWatch = new System.Diagnostics.Stopwatch(); //stopwatch를 생성한다. m_StopWatch.Start(); //stopwatch를 시작한다. m_LastFrameTicks = m_StopWatch.ElapsedTicks; // Gets the total elapsed time measured by the current instance, in timer ticks. m_FrameTimes = new float[_no_frames]; //_no_frames = 128, 128개의 float 배열 m_TicksPerFrame = new float[2][] { new float[_no_frames], new float[_no_frames] }; //128개의 배열이 2개 m_GraphicsDeviceName = SystemInfo.graphicsDeviceName;// SystemInfo.graphicsDeviceName "NVIDIA GeForce GTX 670M" string for (int i = 0; i < recordersList.Length; i++) { var sampler = Sampler.Get(recordersList[i].name); //Sampler 이름을 사전에 RecorderEntry[] recordersList에 정의해 뒀는데, 이것으로 Sampler를 얻어 온다. if (sampler != null) { recordersList[i].recorder = sampler.GetRecorder(); } } Console.AddCommand("show.profilers", CmdShowProfilers, "Show available profilers."); }
private void Awake() { for (int i = 0; i < recordersList.Length; i++) { var sampler = Sampler.Get(recordersList[i].name); if (sampler.isValid) { recordersList[i].recorder = sampler.GetRecorder(); } else if (recordersList[i].oldName != null) { sampler = Sampler.Get(recordersList[i].oldName); if (sampler.isValid) { recordersList[i].recorder = sampler.GetRecorder(); } } } guiStyle = new GUIStyle(); guiStyle.fontSize = 30; guiStyle.normal.textColor = Color.green; ResetStats(); }
void Awake() { for(int i = 0; i < recordersList.Length; i++) { var sampler = Sampler.Get(recordersList[i].name); if(sampler != null) { recordersList[i].recorder = sampler.GetRecorder(); } } }
public OcclusionCullingSystem(Contexts contexts) { _ocController = contexts.session.clientSessionObjects.OCController; _dynamicObjectsUmbraSampler = Sampler.Get("CullDynamicObjectsWithUmbra"); _objectsWithoutUmbraSampler = Sampler.Get("CullObjectsWithoutUmbra"); _dynamicObjectsUmbraProfileInfo = SingletonManager.Get <DurationHelp>().GetProfileInfo(CustomProfilerStep.CullDynamicObjectsWithUmbra); _objectsWithoutUmbraProfileInfo = SingletonManager.Get <DurationHelp>().GetProfileInfo(CustomProfilerStep.CullObjectsWithoutUmbra); }
void Awake() { for (int i = 0; i < recordersList.Length; i++) { var sampler = Sampler.Get(recordersList[i].name); if (sampler.isValid) { recordersList[i].recorder = sampler.GetRecorder(); } } m_style = new GUIStyle(); m_style.fontSize = 30; m_style.normal.textColor = Color.white; ResetStats(); }
public static int Get_s(IntPtr l) { int result; try { string name; LuaObject.checkType(l, 1, out name); Sampler o = Sampler.Get(name); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public GameStatistics() { m_FrequencyMS = System.Diagnostics.Stopwatch.Frequency / 1000; m_StopWatch = new System.Diagnostics.Stopwatch(); m_StopWatch.Start(); m_LastFrameTicks = m_StopWatch.ElapsedTicks; m_FrameTimes = new float[_no_frames]; m_TicksPerFrame = new float[2][] { new float[_no_frames], new float[_no_frames] }; m_GraphicsDeviceName = SystemInfo.graphicsDeviceName; for (int i = 0; i < recordersList.Length; i++) { var sampler = Sampler.Get(recordersList[i].name); if (sampler != null) { recordersList[i].recorder = sampler.GetRecorder(); } } Console.AddCommand("show.profilers", CmdShowProfilers, "Show available profilers."); }
/// <summary> /// Creates a new instance of the <see cref="UnityUserReportingPlatform"/> class. /// </summary> public UnityUserReportingPlatform() { this.logMessages = new List <LogMessage>(); this.postOperations = new List <PostOperation>(); this.screenshotOperations = new List <ScreenshotOperation>(); this.screenshotStopwatch = new Stopwatch(); // Recorders this.profilerSamplers = new List <ProfilerSampler>(); Dictionary <string, string> samplerNames = this.GetSamplerNames(); foreach (KeyValuePair <string, string> kvp in samplerNames) { Sampler sampler = Sampler.Get(kvp.Key); if (sampler.isValid) { Recorder recorder = sampler.GetRecorder(); recorder.enabled = true; ProfilerSampler profilerSampler = new ProfilerSampler(); profilerSampler.Name = kvp.Value; profilerSampler.Recorder = recorder; this.profilerSamplers.Add(profilerSampler); } } // Log Messages Application.logMessageReceivedThreaded += (logString, stackTrace, logType) => { lock (this.logMessages) { LogMessage logMessage = new LogMessage(); logMessage.LogString = logString; logMessage.StackTrace = stackTrace; logMessage.LogType = logType; this.logMessages.Add(logMessage); } }; }
void DrawSubsystemList(UnityEngine.LowLevel.PlayerLoopSystem system, int increment = 1) { // here were using a stack to generate a path name for the PlayerLoopSystem were currently trying to draw // e.g Update.ScriptRunBehaviourUpdate. Unity uses these path names when storing profiler data on a step // that means we can use these path names to retrieve profiler samples! if (pathStack.Count == 0) { // if this is a root object, add its name to the stack pathStack.Push(system.type.Name); } else { // otherwise add its name to its parents name... pathStack.Push(pathStack.Peek() + "." + system.type.Name); } using (new EditorGUI.IndentLevelScope(increment)) { // if this System has Subsystems, draw a foldout bool header = system.subSystemList != null; if (header) { var name = system.type.Name; var fullName = system.type.FullName; // check fold EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); bool fold = EditorGUILayout.Foldout(GetFoldout(fullName), name, true); // use the GetFoldout helper method to see if its open or closed EditorGUILayout.EndHorizontal(); if (fold) { // if the fold is open, draw all the Subsytems~ foreach (var loopSystem in system.subSystemList) { // store the current system Useful if we need to know the parent of a system later systemStack.Push(system); DrawSubsystemList(loopSystem); systemStack.Pop(); } } SetFoldout(fullName, fold); } else { // at the moment, all the defaut 'native' Systems update via a updateFunction (essentally, a pointer into the unmanaged C++ side of the engine. // So we can tell if a system is a custom one because it has a value in updateDelegate instead. So if this is a custom system, make note of that // so we can change how its drawn later bool custom = system.updateDelegate != null; using (new EditorGUI.DisabledScope(custom)) { EditorGUILayout.BeginHorizontal(); GUILayout.Space((float)EditorGUI.indentLevel * 18f); // indent the entry nicley. We have to do this manually cos the flexible space at the end conflicts with GUI.Indent // draw the remove button... if (GUILayout.Button("x")) { RemoveSystem(system, systemStack.Peek()); } GUILayout.Label(system.type.Name); // draw the name out.... // If the profiling mode is enabled, get the profiler sampler for this System and display its execution times! if (getProfileTimingInfo) { var sampler = Sampler.Get(pathStack.Peek()); var info = ""; if (sampler.GetRecorder().elapsedNanoseconds != 0) { info = (sampler.GetRecorder().elapsedNanoseconds / 1000000f) + "ms"; } else { info = "0.000000ms"; } using (new EditorGUI.DisabledScope(true)) { GUILayout.Label("[" + info + "]"); } } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); //EditorGUILayout.LabelField(new GUIContent(/*"custom"*/));//, EditorGUIUtility.IconContent("cs Script Icon")); } } } pathStack.Pop(); }
// This code is used for holding types and methods, and will never be called. public void Hold() { Resources.Load(""); Resources.UnloadAsset(new Object()); Resources.UnloadUnusedAssets(); Resources.LoadAll(""); GameObject go = null; AssetBundle ab = null; Animator at = null; Animation an = null; ParticleSystem ps = null; TextAsset ta = null; Mesh m = null; Shader s = null; Texture t = null; Texture2D t2 = null; RenderTexture rt = null; AnimationClip ac = null; AudioClip ac2 = null; SkinnedMeshRenderer r = null; Font f = null; #if UNITY_2019_1_OR_NEWER Check(QualitySettings.skinWeights); #else Check(QualitySettings.blendWeights); #endif #if UNITY_2018_3_OR_NEWER Profiler.SetAreaEnabled(ProfilerArea.CPU, false); #endif #if !UNITY_4_7 && !UNITY_4_6 Cursor.lockState = CursorLockMode.None; Check(Cursor.lockState); #endif #if UNITY_5_3_OR_NEWER Check(SystemInfo.processorFrequency); #endif #if UNITY_4_6 || UNITY_4_7 || UNITY_5 t2.LoadImage(null); #else ImageConversion.LoadImage(t2, null); #endif #if UNITY_5_6_OR_NEWER List <string> temp = new List <string>(); Sampler.GetNames(temp); Sampler sampler = Sampler.Get(""); Check(sampler.isValid); Check(sampler.name); Recorder recorder = Recorder.Get(""); recorder.enabled = true; Check(recorder.isValid); Check(recorder.enabled); Check(recorder.sampleBlockCount); Check(recorder.elapsedNanoseconds); #endif Profiler.BeginSample("", new Object()); Profiler.BeginSample(""); Profiler.EndSample(); Profiler.GetRuntimeMemorySize(null); Profiler.GetTotalAllocatedMemory(); Profiler.GetTotalReservedMemory(); Profiler.GetTotalUnusedReservedMemory(); Profiler.GetMonoUsedSize(); Profiler.GetMonoHeapSize(); Profiler.enableBinaryLog = true; Profiler.enabled = true; Profiler.logFile = ""; Check(Profiler.usedHeapSize); Check(Profiler.enableBinaryLog); Check(Profiler.enabled); Check(Profiler.logFile); Check(Profiler.supported); Check(f.fontSize); Check(t2.mipmapCount); }
public ProfilerEntry(string markerName) { ProfileName = markerName; Marker = new ProfilerMarker(markerName); Sampler = Sampler.Get(ProfileName); }
public Sample(string name) { sampler = Sampler.Get(name); TotalAVg = new Utils.MovingAverage(); InstanceAVg = new Utils.MovingAverage(); }