public override void CollectData(ProfilerFrameData frameData) { // 特別枠で frameDataのCPU時間を追加 ThreadViewData frameViewData = null; if (!this.viewData.TryGetValue(FrameWholeDataSpecialKey, out frameViewData)) { frameViewData = new ThreadViewData(FrameWholeDataSpecialKey); viewData.Add(FrameWholeDataSpecialKey, frameViewData); } frameViewData.AddMsec(frameData.frameIndex, frameData.m_TotalCPUTimeInMicroSec / 1000.0f, 0.0f, 0, 0); // 同一フレーム内に同じスレッド名が複数できるので… Dictionary <string, int> threadNameCounter = new Dictionary <string, int>(8); foreach (var thread in frameData.m_ThreadData) { string threadName = thread.FullName; if (threadName == null) { continue; } int cnt = 0; if (threadNameCounter.TryGetValue(threadName, out cnt)) { ++cnt; threadName = threadName + cnt; } threadNameCounter[threadName] = cnt; this.AddDataTo(frameData.frameIndex, threadName, thread); } }
private void AddDataTo(int frameIdx, string threadName, ThreadData data) { ThreadViewData threadViewData = null; if (!this.viewData.TryGetValue(threadName, out threadViewData)) { threadViewData = new ThreadViewData(threadName); viewData.Add(threadName, threadViewData); } float totalMsec = 0.0f; float idleMsec = 0.0f; int totalCount = 0; int idleCount = 0; if (data.m_AllSamples != null) { foreach (var sample in data.m_AllSamples) { if (sample.parent == null) { idleMsec += GetSumOfTimeInSampleChildren(sample, "Idle", ref idleCount); totalMsec += GetSumeOfTimeWithNamedSampleInChildren(sample, ref totalCount);// sample.timeUS / 1000.0f; } } } threadViewData.AddMsec(frameIdx, totalMsec, idleMsec, totalCount, idleCount); }
public async void GoToPostsPage(ThreadViewData paramData) { var parameters = new NavigationParameters { { "ThreadViewData", paramData } }; await _navigationService.NavigateAsync(new System.Uri("/PostsPage/", System.UriKind.Relative), parameters); }