public static void info(string name) { lock(threadInfoTableLock) { ThreadInfo threadInfo = (ThreadInfo)threadInfoTable[Thread.CurrentThread.GetHashCode()]; Node newNode = new Node(name,"info"); threadInfo.currentNode.childs.Add(newNode); } }
public void dump(Node node,int level,int levelmap) { { string prefix = ""; int locallevelmap = levelmap; for (int i = level; i > 0; i--) { if (locallevelmap >= Math.Pow(i,2)) { locallevelmap -= (int)Math.Pow(i,2); if (i == level) { prefix = " |-" + prefix; } else { prefix = " | " + prefix; } } else { if (i == level) { prefix = " \\-" + prefix; } else { prefix = " " + prefix; } } } retval += prefix + node.key + (node.nodetype=="timer" ?" (" + (node.stop-node.start) + ")":"") + " \n"; } for (int i = 0; i < node.childs.Count; i++) { int locallevelmap = levelmap; if(i < node.childs.Count-1) { locallevelmap += (int)Math.Pow((level+1),2); } dump((Node)node.childs[i],level+1,locallevelmap); } }
public static void start(string name) { lock(threadInfoTableLock) { ThreadInfo threadInfo = (ThreadInfo)threadInfoTable[Thread.CurrentThread.GetHashCode()]; Node newNode = new Node(name,"timer"); newNode.parentNode = threadInfo.currentNode; newNode.start = GetUnixTime(); threadInfo.currentNode.childs.Add(newNode); threadInfo.currentNode = newNode; } //Console.Error.WriteLine("TM start:"+name); }