Пример #1
0
        private void ParseSysInfoLog(string path)
        {
            _sysInfoItems.Clear();

            using (var file = new StreamReader(Path.GetFullPath(path)))
            {
                string line = file.ReadLine();
                if (line != null)
                {
                    int coreNum = SysInfoItem.GetCoreNumber(line);
                    if (coreNum < 0)
                    {
                        return;
                    }
                    while ((line = file.ReadLine()) != null)
                    {
                        var sii = SysInfoItem.CreateInstance(line, coreNum);
                        if (sii != null)
                        {
                            _sysInfoItems.Add(sii);
                        }
                    }
                }
            }
        }
Пример #2
0
        protected override void LoadData(ProgressMonitor progressMonitor)
        {
            ParseSysInfoLog(Path.Combine(SessionFolder, SessionConstants.ProcFileName));
            DateTime    sysInfoStartTime = DateTime.MinValue;
            SysInfoItem firstSysInfo     = _sysInfoItems.FirstOrDefault();

            if (firstSysInfo != null)
            {
                sysInfoStartTime = firstSysInfo.TimeSeconds.UnixTimeToDateTime();
                CpuCoreCount     = Math.Max(firstSysInfo.CoreNum, 1);
            }
            InitializeDataProvider(progressMonitor, sysInfoStartTime, CpuCoreCount);
            _profilingDataProvider.Load();
//            _profilingDataProvider.SaveClrJobs(Path.Combine(SessionFolder, "clr_jobs.log"));
            PrepareData();
        }
Пример #3
0
        public static SysInfoItem CreateInstance(string str)
        {
            SysInfoItem sii = null;
            Match       m   = RegTempl.Match(str);

            if (m.Success)
            {
                long   timestamp      = Convert.ToInt64(m.Groups[1].Value);
                int    coreNum        = Convert.ToInt32(m.Groups[2].Value);
                long   userLoad       = Convert.ToInt64(m.Groups[3].Value);
                long   sysLoad        = Convert.ToInt64(m.Groups[4].Value);
                long   memTotal       = Convert.ToInt64(m.Groups[8].Value);
                long   memFree        = Convert.ToInt64(m.Groups[9].Value);
                string profilerStatus = m.Groups[11].Value;
                sii = new SysInfoItem(timestamp, coreNum, userLoad, sysLoad, memTotal, memFree, profilerStatus);
            }
            return(sii);
        }