예제 #1
0
		private void BuildBaseCallTables()
		{
			int id = -1;
			string nameAndSignature = null;
			try
			{
				foreach(DictionaryEntry de in basedataId)
				{
					datanode pn= new datanode();
					datanode cn= new datanode();
					nameAndSignature = (string)de.Key;
					id = (int)basedataId[nameAndSignature];
					if(this._prevbasedata.ContainsKey(nameAndSignature))
					{
						pn = (datanode)_prevbasedata[nameAndSignature];
						pn.id = id;
						BuildCallTables(this.callertbl, id, pn.caller, true);
						BuildCallTables(this.calleetbl, id, pn.callee, false);
					}
					else
					{
						if(_currbasedata.ContainsKey(nameAndSignature))
						{
							cn = (datanode)_currbasedata[nameAndSignature];
							cn.id = id;
							BuildCallTables(this.callertbl, id, cn.caller, true);
							BuildCallTables(this.calleetbl, id, cn.callee, false);
						}
					}
				
				}
				ds.Tables.Add(this.callertbl);
				ds.Tables.Add(this.calleetbl);
			}
			catch
			{
				throw new Exception("Faild on build caller/callee data Tables \n");
			}
		}
예제 #2
0
		private void BuildContributionCalleeTable()
		{
			int id = -1;
			string nameAndSignature = null;
			bool exist = false;
			Hashtable cnnew;
			datanode pn1;
			datanode cn1;
			try
			{
				foreach(DictionaryEntry de in basedataId)
				{
					datanode pn= new datanode();
					datanode cn= new datanode();
					nameAndSignature = (string)de.Key;
					
					id = (int)basedataId[nameAndSignature];
					if(this._prevbasedata.ContainsKey(nameAndSignature))
					{
						pn = (datanode)_prevbasedata[nameAndSignature];
						if(_currbasedata.ContainsKey(nameAndSignature))
						{
							cn = (datanode)_currbasedata[nameAndSignature];
							exist = true;
						}
						else
						{
							exist = false;
						}
						cnnew = new Hashtable();
						foreach(string nameAndSignature1 in pn.calleeAlloc.Keys)
						{
							pn1 = new datanode();
							cn1 = new datanode();
						    
							if(this._prevbasedata.ContainsKey(nameAndSignature1))
							{
								pn1 = (datanode)_prevbasedata[nameAndSignature1];
								pn1.id = id;
								pn1.incl = FormatSize(int.Parse(pn.calleeAlloc[nameAndSignature1].ToString()));
								if(exist)
								{
									if(this._currbasedata.ContainsKey(nameAndSignature1))
									{
										cn1 = (datanode)_currbasedata[nameAndSignature1];
										cn1.id = id;
										if(cn.calleeAlloc.ContainsKey(nameAndSignature1))
										{
											cn1.incl = FormatSize(int.Parse(cn.calleeAlloc[nameAndSignature1].ToString()));
										}
										cnnew[nameAndSignature1] = 1;
									}
								}
								AddBaseTableRow(this.ContriTocalleetbl, nameAndSignature1, pn1, cn1);
								
							}
						}
						// adding item in new and not in old
						if(exist)
						{
							foreach(string nameAndSignature1 in cn.calleeAlloc.Keys)
							{
								pn1 = new datanode();
								if(!cnnew.ContainsKey(nameAndSignature1))
								{
									cn1 = (datanode)_currbasedata[nameAndSignature1];
									cn1.id = id;
									cn1.incl = FormatSize(int.Parse(cn.calleeAlloc[nameAndSignature1].ToString()));
									AddBaseTableRow(this.ContriTocalleetbl, nameAndSignature1, pn1, cn1);
								}
							}
						}
					}
					
					if(this._currbasedata.ContainsKey(nameAndSignature))
					{
						cn = (datanode)_currbasedata[nameAndSignature];
						pn1= new datanode();
						if(!this._prevbasedata.ContainsKey(nameAndSignature))
						{
							cn1 = (datanode)_currbasedata[nameAndSignature];
							foreach(string nameAndSignature1 in cn.calleeAlloc.Keys)
							{
								if(this._currbasedata.ContainsKey(nameAndSignature1))
								{
									cn1 = (datanode)_currbasedata[nameAndSignature1];
									cn1.id = id;
									cn1.incl = FormatSize(int.Parse(cn.calleeAlloc[nameAndSignature1].ToString()));
									AddBaseTableRow(this.ContriTocalleetbl, nameAndSignature1, pn1, cn1);
								}
								
							}
						}
					}
				}
				ds.Tables.Add(this.ContriTocalleetbl);
			}
			catch
			{
				throw new Exception("Faild on build caller/callee data Tables \n");
			}
		}
예제 #3
0
		private void AddBaseTableRow(DataTable tmptbl, string name, datanode pn,  datanode cn )
		{
			DataRow tmpRow = tmptbl.NewRow();
			if(pn.name != null)
				tmpRow["id"] = pn.id;
			else 
			{
				tmpRow["id"] = cn.id;
			}

			tmpRow["name"] = name;
			tmpRow["prevIncl"] = pn.incl;
			tmpRow["currIncl"] = cn.incl;
			tmpRow["prevExcl"] = pn.excl;
			tmpRow["currExcl"] = cn.excl;
#if(V_EXEC)
			//tmpRow["diffIncl"] = Convert.ToDouble(string.Format("{0:f2}", (cn.incl - pn.incl)));
			tmpRow["diffIncl"] = Math.Round((cn.incl - pn.incl), 2);
			tmpRow["diffExcl"] =  Math.Round((cn.excl - pn.excl), 2);
			tmpRow["prevChildIncl"] =  Math.Round((pn.incl - pn.excl), 2);
			tmpRow["currChildIncl"] =  Math.Round((cn.incl - cn.excl), 2);
			tmpRow["diffChildIncl"] =  Math.Round(((cn.incl - cn.excl) - (pn.incl - pn.excl)), 2);
#else
			tmpRow["diffIncl"] = cn.incl - pn.incl;
			tmpRow["diffExcl"] = cn.excl - pn.excl;
			tmpRow["prevChildIncl"] = pn.incl - pn.excl;
			tmpRow["currChildIncl"] = cn.incl - cn.excl;
			tmpRow["diffChildIncl"] = (cn.incl - cn.excl) - (pn.incl - pn.excl);
			
#endif
			tmpRow["prevTimesCalled"] = pn.timesBeenCalled;
			tmpRow["currTimesCalled"] = cn.timesBeenCalled;
			tmpRow["prevTimesMakecalls"] = pn.timesMakeCalls;
			tmpRow["currTimesMakecalls"] = cn.timesMakeCalls;
			tmpRow["diffTimesCalled"] = cn.timesBeenCalled - pn.timesBeenCalled;
			tmpRow["diffTimesMakecalls"] = cn.timesMakeCalls - pn.timesMakeCalls;
			
			tmptbl.Rows.Add(tmpRow);
		}
예제 #4
0
		private void BuildBaseDataTable()
		{
			 int id = 0;
			try
			{

				foreach(string nameAndSignature in _prevbasedata.Keys)
				{
				
					datanode pn= new datanode();
					datanode cn= new datanode();
					pn = (datanode)_prevbasedata[nameAndSignature];
					pn.id = id;
					if(_currbasedata.ContainsKey(nameAndSignature))
					{
						cn = (datanode)_currbasedata[nameAndSignature];
					}
					AddBaseTableRow(this.basedatatable, nameAndSignature, pn, cn);
					basedataId.Add(nameAndSignature, id);
					Idbasedata.Add(id, nameAndSignature);
					id++;
				}
				foreach( string CnameAndSignature in _currbasedata.Keys)
				{
					if(! _prevbasedata.ContainsKey(CnameAndSignature))
					{
						datanode pn= new datanode();
						datanode cn= new datanode();
						cn = (datanode)_currbasedata[CnameAndSignature];
						cn.id = id;
						AddBaseTableRow(this.basedatatable, CnameAndSignature, pn, cn);
						basedataId.Add(CnameAndSignature, id);
						Idbasedata.Add(id, CnameAndSignature);
						id++;
					}
				}
				ds.Tables.Add(this.basedatatable);
			}
			catch
			{
				throw new Exception("Faild on build base data Tables \n");
			}
		}
예제 #5
0
		private void FillCallAlloc(ref datanode n, Vertex v)
		{
			n.calleeAlloc = new Hashtable();
			n.callerAlloc = new Hashtable();
			foreach(Edge edge in v.outgoingEdges.Values)
			{
				string nameAndSignature = edge.ToVertex.name;
				if(edge.ToVertex.signature != null)
					nameAndSignature += ' ' + edge.ToVertex.signature;
				if(!n.calleeAlloc.ContainsKey(nameAndSignature))
				{
					n.calleeAlloc.Add(nameAndSignature, FormatSize((int)edge.weight));
				}
			}
			foreach(Edge edge in v.incomingEdges.Values)
			{
				string nameAndSignature = edge.FromVertex.name;
				if(edge.FromVertex.signature != null)
					nameAndSignature += ' ' + edge.FromVertex.signature;
				if(!n.callerAlloc.ContainsKey(nameAndSignature))
				{
					n.callerAlloc.Add(nameAndSignature, FormatSize((int)edge.weight));
				}
			}
		}
예제 #6
0
		private void BuildBaseData(GraphBase gb, CallTreeForm tmpcallTree,  Hashtable htbl, Hashtable FuncExcl, Hashtable TypeExcl)
		{
			Vertex selectedVertex;
			int selectedVertexCount = gb.SelectedVertexCount(out selectedVertex);
			int id = 1;
			
			string nameAndSignature = null;
			datanode n = new datanode();


			try
			{
				foreach (Vertex v in gb.basegraph.vertices.Values)
				{
					if( !v.name.StartsWith("????"))
					{
						if (v.selected || (selectedVertexCount == 0) )
						{
							nameAndSignature  = v.name;
							if(v.signature != null)
								nameAndSignature += ' ' + v.signature;
							n.name = nameAndSignature;
							n.incl = FormatSize((int)v.weight);
							n.caller = v.incomingEdges;
							n.callee = v.outgoingEdges;
							n.level = v.level;
							n.excl = 0;
							n.timesBeenCalled= n.timesMakeCalls = 0;
							FillCallAlloc(ref n, v);
							if(tmpcallTree.LogResult.allocatedHistogram.readNewLog.funcSignatureIdHash.ContainsKey(nameAndSignature))
							{
								n.category = 1;	// func
								id = tmpcallTree.LogResult.callstackHistogram.readNewLog.funcSignatureIdHash[nameAndSignature];
								if(FuncExcl.ContainsKey(nameAndSignature))
								{
									n.excl =  FormatSize((int)FuncExcl[nameAndSignature]);
								}
								if( id > 0 && id <tmpcallTree.CallStats.Length)
								{

									n.timesBeenCalled = (int)tmpcallTree.CallStats[id].timesCalled;
									n.timesMakeCalls = (int)tmpcallTree.CallStats[id].totalFunctionsCalled;
								}
								if( !htbl.ContainsKey(nameAndSignature))
								{
									htbl.Add(nameAndSignature, n);
								}
							}
							else if(tmpcallTree.LogResult.allocatedHistogram.readNewLog.typeSignatureIdHash.ContainsKey(nameAndSignature))
							{
								n.category = 2;	// type
								id = tmpcallTree.LogResult.allocatedHistogram.readNewLog.typeSignatureIdHash[nameAndSignature];
								if(TypeExcl.ContainsKey(nameAndSignature))
								{
									n.excl =  FormatSize((int)TypeExcl[nameAndSignature]);
								}
								if( id > 0 && id <tmpcallTree.AllocStats.Length)
								{
									n.timesBeenCalled = (int)tmpcallTree.AllocStats[id].timesAllocated;
								}
								if( !htbl.ContainsKey(nameAndSignature))
								{
									typemaxIncl = (typemaxIncl > v.weight) ? typemaxIncl : v.weight;
									htbl.Add(nameAndSignature, n);
								}
							}
							else
							{
								if( !htbl.ContainsKey(nameAndSignature))
								{
									maxIncl = v.weight;
									htbl.Add(nameAndSignature, n);
								}
							}

						}
			
					}
				}
			}
			catch
			{
				throw new Exception("Faild on build base data structure \n");
			}
			// max for caculate function/type 9 details 
			if( prevFilter.max == 0)
			{
				prevFilter.max = maxIncl;
				prevTypedeFilter.max = typemaxIncl;
			}
			else
			{
				currFilter.max = maxIncl;
				currTypedeFilter.max = typemaxIncl;
			}
			maxIncl = 0;
			typemaxIncl = 0;
		}
예제 #7
0
		private void BuildContributionCallerTable()
		{
			int id = -1;
			string nameAndSignature = null;
			bool exist = false;
			Hashtable cnnew;
			datanode pn1;
			datanode cn1;
			try
			{
				foreach(DictionaryEntry de in basedataId)
				{
					datanode pn= new datanode();
					datanode cn= new datanode();
					nameAndSignature = (string)de.Key;
					id = (int)basedataId[nameAndSignature];
					if(this._prevbasedata.ContainsKey(nameAndSignature))
					{
						pn = (datanode)_prevbasedata[nameAndSignature];
						if(_currbasedata.ContainsKey(nameAndSignature))
						{
							cn = (datanode)_currbasedata[nameAndSignature];
							exist = true;
						}
						else
						{
							exist = false;
						}
						cnnew = new Hashtable();
						foreach(Edge edge in pn.caller.Values)
						{
							pn1 = new datanode();
							cn1 = new datanode();
							string nameAndSignature1 = edge.FromVertex.name;
							if(edge.FromVertex.signature != null)
								nameAndSignature1 += ' ' + edge.FromVertex.signature;
							if(this._prevbasedata.ContainsKey(nameAndSignature1))
							{
								pn1 = (datanode)_prevbasedata[nameAndSignature1];
								pn1.id = id;
								pn1.incl = FormatSize((int)edge.weight);
								if(exist)
								{
									foreach(Edge edgec in cn.caller.Values)
									{
										if(edgec.FromVertex.name == edge.FromVertex.name && edgec.FromVertex.signature == edge.FromVertex.signature)
										{
											if(this._currbasedata.ContainsKey(nameAndSignature1))
											{
												cn1 = (datanode)_currbasedata[nameAndSignature1];
												cn1.id = id;
												cn1.incl = FormatSize((int)edgec.weight);
												cnnew[nameAndSignature1] = 1;
											}
										}
									}
								}
								AddBaseTableRow(this.ContriTocallertbl, nameAndSignature1, pn1, cn1);
								
							}
						}
						// adding item in new and not in old
						if(exist)
						{
							foreach(Edge edgec in cn.caller.Values)
							{
								pn1 = new datanode();
								string nameAndSignature1 = edgec.FromVertex.name;
								if(edgec.FromVertex.signature != null)
									nameAndSignature1 += ' ' + edgec.FromVertex.signature;

								if(!cnnew.ContainsKey(nameAndSignature1))
								{
									cn1 = (datanode)_currbasedata[nameAndSignature1];
									cn1.id = id;
									cn1.incl = FormatSize((int)edgec.weight);
									AddBaseTableRow(this.ContriTocallertbl, nameAndSignature1, pn1, cn1);
								}
							}
						}
					}
					
					if(this._currbasedata.ContainsKey(nameAndSignature))
					{
						cn = (datanode)_currbasedata[nameAndSignature];
						pn1= new datanode();
						if(!this._prevbasedata.ContainsKey(nameAndSignature))
						{
							cn1 = (datanode)_currbasedata[nameAndSignature];
							foreach(Edge edge in cn.caller.Values)
							{
								string nameAndSignature1 = edge.FromVertex.name;
								if(edge.FromVertex.signature != null)
									nameAndSignature1 += ' ' + edge.FromVertex.signature;
								if(this._currbasedata.ContainsKey(nameAndSignature1))
								{
									cn1 = (datanode)_currbasedata[nameAndSignature1];
									cn1.id = id;
									cn1.incl = FormatSize((int)edge.weight);
									AddBaseTableRow(this.ContriTocallertbl, nameAndSignature1, pn1, cn1);
								}
								
							}
						}
					}
				}
				ds.Tables.Add(this.ContriTocallertbl);
			}
			catch
			{
				throw new Exception("Faild on build caller/callee data Tables \n");
			}
		}