当前位置: 首页>>代码示例>>C#>>正文


C# List.Clear方法代码示例

本文整理汇总了C#中WpfApplication1.List.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# List.Clear方法的具体用法?C# List.Clear怎么用?C# List.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WpfApplication1.List的用法示例。


在下文中一共展示了List.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessingCallStack

        static Dictionary<string, FunctionStat> ProcessingCallStack(string rawTextLog)
        {
            string[] perRecord = rawTextLog.Split(new string[] { recordSep }, StringSplitOptions.None);
            List<string> PrevCallStackString = null;
            List<string> CurCallStackString = new List<string>();
            string curRunningFn = null;
            string prevRunningFn = null;
            Dictionary<string, FunctionStat> histogram = new Dictionary<string, FunctionStat>();

            foreach (string l in perRecord)
            {
                Regex regex = new Regex(@"tsc: ([\w]+ [\w]+) ([\d]+.[\d]+) \(([\d]+.[\d]+)\) rip:([\w]+)");
                Match match = regex.Match(l);
                //bool bFound = false;
                double curTimestamp = 0;
                double previousTimestamp = 0;
                // Read current callstack
                if (match.Success)
                {
                    curTimestamp = double.Parse(match.Groups[2].Value);
                    string temp = l.Trim();
                    CurCallStackString.Clear();
                    foreach (string l2 in temp.Split('\n'))
                    {
                        Regex regex2 = new Regex(@"Pc:([\w]+) AddrReturn:([\w]+) \(([\w\+]+)\) Frame:([\w]+)");
                        Match match2 = regex2.Match(l2);
                        if (match2.Success)
                        {
                            CurCallStackString.Add(l2);
                        }
                    }
                }
                // Compare cur/prev callstack to figure out running fn
                if (PrevCallStackString != null && PrevCallStackString.Count != 0 && CurCallStackString.Count != 0)
                {
                    for (int i = 0; i != CurCallStackString.Count - 1; i++)
                    {
                        for (int j = 0; j != PrevCallStackString.Count - 1; j++)
                        {
                            //Console.WriteLine("i {0} j {1}", i, j);
                            if (CurCallStackString[i] == PrevCallStackString[j] &&
                                CurCallStackString[i + 1] == PrevCallStackString[j + 1] &&
                                IsInFilter(getNameOnlyFunction(CurCallStackString[i])) == false)
                            {
                               // bFound = true;
                                curRunningFn = CurCallStackString[i];
                                goto _break;
                            }
                        }
                    }
                _break: ;
                    //Console.WriteLine("--- curRunningFn: {0} prevRunningFn: {1}", curRunningFn, prevRunningFn);
                }
                // update the current fn
                if (curRunningFn != null && curRunningFn == prevRunningFn)
                {
                    string fnName = getNameOnlyFunction(curRunningFn);
                    //Console.WriteLine("Fn: {0}", fnName);
                    UpdateTimeHistogram(ref histogram, fnName, curTimestamp - previousTimestamp);
                }
                prevRunningFn = curRunningFn;
                previousTimestamp = curTimestamp;
                // update prev callstack
                PrevCallStackString = null;
                PrevCallStackString = CurCallStackString.ToList();
            }
            return histogram;
        }
开发者ID:nitpicker,项目名称:stackpeek,代码行数:68,代码来源:Prog1.cs


注:本文中的WpfApplication1.List.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。