コード例 #1
0
ファイル: QueryNode.cs プロジェクト: ElinamLLC/SharpDeveloper
        public IQueryable <CallTreeNode> Execute(SQLiteQueryProvider provider, QueryExecutionOptions options)
        {
            StringBuilder   b       = new StringBuilder();
            SqlQueryContext context = new SqlQueryContext(provider);

            BuildSql(b, context);
            if (options.HasLoggers)
            {
                options.WriteLogLine(b.ToString());
            }
            Stopwatch            w      = Stopwatch.StartNew();
            IList <CallTreeNode> result = provider.RunSQLNodeList(b.ToString(), context.HasIDList);

            w.Stop();
            if (options.HasLoggers)
            {
                options.WriteLogLine("Query returned " + result.Count + " rows in " + w.Elapsed);
            }
            return(result.AsQueryable());
        }
コード例 #2
0
 public ExecuteAllQueriesVisitor(SQLiteQueryProvider sqliteProvider, QueryExecutionOptions options)
 {
     this.sqliteProvider = sqliteProvider;
     this.options        = options;
 }
コード例 #3
0
		/// <summary>
		/// Creates a new CallTreeNode.
		/// </summary>
		public SQLiteCallTreeNode(int nameId, CallTreeNode parent, SQLiteQueryProvider provider)
		{
			this.nameId = nameId;
			this.parent = parent;
			this.provider = provider;
		}
コード例 #4
0
		internal IList<CallTreeNode> RunSQLNodeList(SQLiteQueryProvider queryProvider, string command, bool hasIdList)
		{
			List<CallTreeNode> result = new List<CallTreeNode>();
			
			SQLiteCommand cmd;
			using (LockAndCreateCommand(out cmd)) {
				cmd.CommandText = command;
				
				using (SQLiteDataReader reader = cmd.ExecuteReader()) {
					while (reader.Read()) {
						SQLiteCallTreeNode node = new SQLiteCallTreeNode(reader.GetInt32(0), null, queryProvider);
						node.callCount = reader.GetInt32(3);
						node.cpuCyclesSpent = reader.GetInt64(1);
						node.cpuCyclesSpentSelf = reader.GetInt64(2);
						if (hasIdList) {
							object ids = reader.GetValue(6);
							if (ids is long) {
								node.IdList = new int[] { (int)(long)ids };
							} else {
								int[] idList = ids.ToString().Split(',').Select(s => int.Parse(s)).ToArray();
								Array.Sort(idList);
								node.IdList = idList;
							}
						}
						node.hasChildren = reader.GetBoolean(4);
						node.activeCallCount = reader.GetInt32(5);
						result.Add(node);
					}
				}
			}
			
			return result;
		}
コード例 #5
0
		/// <inheritdoc/>
		public override IQueryable<CallTreeNode> GetFunctions(int startIndex, int endIndex)
		{
			if (startIndex < 0 || startIndex >= DataSets.Count)
				throw new ArgumentOutOfRangeException("startIndex", startIndex, "Value must be between 0 and " + endIndex);
			if (endIndex < startIndex || endIndex >= DataSets.Count)
				throw new ArgumentOutOfRangeException("endIndex", endIndex, "Value must be between " + startIndex + " and " + (DataSets.Count - 1));
			
			SQLiteQueryProvider queryProvider = new SQLiteQueryProvider(this, startIndex, endIndex);
			
			var query = queryProvider.CreateQuery(new Filter(AllCalls.Instance, DataSetFilter(startIndex, endIndex)));
			return query.Where(c => c.NameMapping.Id != 0 && !c.IsThread).MergeByName();
		}
コード例 #6
0
		/// <inheritdoc/>
		public override CallTreeNode GetRoot(int startIndex, int endIndex)
		{
			if (startIndex > endIndex) {
				int help = startIndex;
				startIndex = endIndex;
				endIndex = help;
			}
			
			SQLiteQueryProvider queryProvider = new SQLiteQueryProvider(this, startIndex, endIndex);
			Expression<Func<SingleCall, bool>> filterLambda = c => c.ParentID == -1;
			return queryProvider.CreateQuery(new Filter(AllCalls.Instance, DataSetFilter(startIndex, endIndex), filterLambda)).Merge();
		}
コード例 #7
0
		public SqlQueryContext(SQLiteQueryProvider provider)
		{
			this.provider = provider;
			this.StartDataSet = provider.StartDataSet;
			this.EndDataSet = provider.EndDataSet;
		}
コード例 #8
0
ファイル: QueryNode.cs プロジェクト: Bombadil77/SharpDevelop
		public IQueryable<CallTreeNode> Execute(SQLiteQueryProvider provider, QueryExecutionOptions options)
		{
			StringBuilder b = new StringBuilder();
			SqlQueryContext context = new SqlQueryContext(provider);
			BuildSql(b, context);
			if (options.HasLoggers)
				options.WriteLogLine(b.ToString());
			Stopwatch w = Stopwatch.StartNew();
			IList<CallTreeNode> result = provider.RunSQLNodeList(b.ToString(), context.HasIDList);
			w.Stop();
			if (options.HasLoggers) {
				options.WriteLogLine("Query returned " + result.Count + " rows in " + w.Elapsed);
			}
			return result.AsQueryable();
		}
コード例 #9
0
 public SqlQueryContext(SQLiteQueryProvider provider)
 {
     this.provider     = provider;
     this.StartDataSet = provider.StartDataSet;
     this.EndDataSet   = provider.EndDataSet;
 }
コード例 #10
0
			public ExecuteAllQueriesVisitor(SQLiteQueryProvider sqliteProvider, QueryExecutionOptions options)
			{
				this.sqliteProvider = sqliteProvider;
				this.options = options;
			}