Esempio n. 1
0
        public void Parse()
        {
            Clear();

            var editor  = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument;
            var project = ((editor != null && editor.HasProject) ? editor.Project : MonoDevelop.Ide.IdeApp.ProjectOperations.CurrentSelectedProject) as AbstractDProject;
            var file    = FindTraceLogFileName(project);

            if (file == null)
            {
                profilerPadWidget.AddTracedFunction(0, 0, 0, 0, new DVariable {
                    Name = trace_log + " not found.."
                });
                return;
            }

            var ctxt = ResolutionContext.Create(DResolverWrapper.CreateParseCacheView(editor), null, null);

            StreamReader reader = File.OpenText(file);
            string       line;

            while ((line = reader.ReadLine()) != null)
            {
                var m = traceFuncRegex.Match(line);

                if (m.Success)
                {
                    var symName = m.Groups["name"].Value;

                    if (symName.StartsWith("="))
                    {
                        continue;
                    }

                    bool mightBeLegalUnresolvableSymbol;
                    var  dn = ExamTraceSymbol(symName, ctxt, out mightBeLegalUnresolvableSymbol);

                    long v;
                    if (dn != null || mightBeLegalUnresolvableSymbol)
                    {
                        profilerPadWidget.AddTracedFunction(
                            long.TryParse(m.Groups["numcalls"].Value, out v) ? v : 0,
                            long.TryParse(m.Groups["treetime"].Value, out v) ? v : 0,
                            long.TryParse(m.Groups["functime"].Value, out v) ? v : 0,
                            long.TryParse(m.Groups["percall"].Value, out v) ? v : 0,
                            dn ?? new DVariable {
                            Name = symName
                        });
                    }
                }
            }
        }
Esempio n. 2
0
        public void Parse(DProject project)
        {
            string file = TraceLogFile(project);

            if (file == null)
            {
                profilerPadWidget.AddTracedFunction(0, 0, 0, 0, new DVariable {
                    Name = "trace.log not found.."
                });
                return;
            }

            lastProfiledProject = project;
            profilerPadWidget.ClearTracedFunctions();

            var ctxt = ResolutionContext.Create(Resolver.DResolverWrapper.CreateCacheList(lastProfiledProject), null, null);

            StreamReader reader = File.OpenText(file);
            string       line;

            while ((line = reader.ReadLine()) != null)
            {
                var m = traceFuncRegex.Match(line);

                if (m.Success)
                {
                    var symName = m.Groups[5].Value;

                    if (symName.StartsWith("="))
                    {
                        continue;
                    }

                    bool mightBeLegalUnresolvableSymbol;
                    var  dn = ExamTraceSymbol(symName, ctxt, out mightBeLegalUnresolvableSymbol);

                    if (dn != null || mightBeLegalUnresolvableSymbol)
                    {
                        profilerPadWidget.AddTracedFunction(long.Parse(m.Groups[1].Value), long.Parse(m.Groups[2].Value),
                                                            long.Parse(m.Groups[3].Value), long.Parse(m.Groups[4].Value), dn ?? new DVariable {
                            Name = symName
                        });
                    }
                }
            }
        }