コード例 #1
0
        public void AddEvent(long eventClass, long nestLevel, long databaseID, string databaseName, long objectID,
                             string objectName, string textData, long cpu, long reads, long writes, long duration, long count,
                             long rowcounts)
        {
            CEvent evt;
            string key = String.Format("({0}).({1}).({2})", databaseID, objectID, textData);

            if (!List.TryGetValue(key, out evt))
            {
                evt = new CEvent(databaseID, databaseName, objectID, objectName, textData);
                List.Add(key, evt);
            }

            evt.NestLevel  = nestLevel;
            evt.EventClass = eventClass;
            evt.Count     += count;
            evt.CPU       += cpu;
            evt.Reads     += reads;
            evt.Writes    += writes;
            evt.Duration  += duration;
            evt.RowCounts += rowcounts;
        }
        public void AddEvent(int cnt, long databaseID, string databaseName, long objectID, string objectName, string textData, long cpu, long reads, long writes, long duration, long count,long rowcounts)
        {
            CEvent[] evt;
            CEvent e;
            string key = String.Format("({0}).({1}).({2}).({3})", databaseID, objectID, objectName, textData);
            if (!EventList.TryGetValue(key, out evt))
            {
                evt = new CEvent[2];
                for (int k = 0; k < evt.Length; k++)
                {
                    evt[k] = new CEvent(databaseID, databaseName, objectID, objectName, textData);
                }
                EventList.Add(key, evt);
                e = evt[cnt];
            }
            else
            {
                e = evt[cnt];
            }

            e.Count += count;
            e.CPU += cpu;
            e.Reads += reads;
            e.Writes += writes;
            e.Duration += duration;
            e.RowCounts += rowcounts;
        }
        public void SaveToFile(string filename) 
        {
            CEvent[] a = new CEvent[List.Count];
            List.Values.CopyTo(a, 0);
            XmlSerializer x = new XmlSerializer(typeof(CEvent[]));
            
            FileStream fs = new FileStream(filename, FileMode.Create);
            x.Serialize(fs, a);
            fs.Dispose();

        }
        public void AddEvent(long eventClass, long nestLevel, long databaseID,string databaseName,long objectID,string objectName, string textData, long cpu, long reads, long writes, long duration,long count,long rowcounts)
        { 
            CEvent evt;
            string key = String.Format("({0}).({1}).({2})",databaseID,objectID,textData);
            if(!List.TryGetValue(key,out evt))
            {
                evt = new CEvent(databaseID,databaseName,objectID,objectName,textData);
                List.Add(key, evt);
            }
            evt.NestLevel = nestLevel;
            evt.EventClass = eventClass;
            evt.Count += count;
            evt.CPU += cpu;
            evt.Reads += reads;
            evt.Writes += writes;
            evt.Duration += duration;
            evt.RowCounts += rowcounts;

        }