本文整理汇总了C#中WpfApplication1.List.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToList方法的具体用法?C# List.ToList怎么用?C# List.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WpfApplication1.List
的用法示例。
在下文中一共展示了List.ToList方法的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;
}