コード例 #1
0
        //[Required]
        //[BindProperty]
        //[Display(Name = "userReqNum")]
        //public int userReqNum { get; set; }

        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Exceptions> addOn = await FetchDataService.getData <Exceptions>(oldStamp, newStamp); // Get data

            foreach (Exceptions e in addOn)
            {
                exceptions.Add(e);
                string typeOfException = e.type;

                // If exceptionTracker contains the type of exception, update the value
                if (exceptionTracker.ContainsKey(typeOfException))
                {
                    exceptionTracker[typeOfException] = exceptionTracker[typeOfException] + 1;
                }
                // If exceptionTracker does not contain that type of exception, create a new key value pair
                else
                {
                    exceptionTracker.Add(typeOfException, 1);
                }
            }

            // In order to sort the dictionary, first need to put into list
            exceptionSorted = exceptionTracker.ToList();
            // Ordering list by frequency of exception
            exceptionSorted.Sort((pair1, pair2) => pair1.Value.CompareTo(pair2.Value));
            // Reverse list so most frequent exceptions are at the front of the list
            exceptionSorted.Reverse();

            totalExceptions = exceptions.Count; // Update totalExceptions
        }
コード例 #2
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();

            // Geting new data
            List <Contention> addOn = await FetchDataService.getData <Contention>(oldStamp, newStamp);

            foreach (Contention c in addOn)
            {
                // When there is start event, create a new Client_Contention object and add it to contentionTracker
                if (c.type.Equals("Start"))
                {
                    Client_Contention clientC = new Client_Contention(c);
                    contentionTracker[c.id] = clientC;
                    contentions.Add(clientC);
                }
                // When there is a stop event, remove associated contention (by looking at id) from contentionTracker,
                // update the Client_Contention to include stop event and update contentions list
                else if (c.type.Equals("Stop"))
                {
                    Client_Contention clientC = contentionTracker[c.id];
                    contentions.Remove(clientC);
                    clientC.updateEndTimestamp(c.timestamp);
                    contentions.Add(clientC);
                }
            }

            contentions.OrderBy(c => c.StartTimestamp).ToList(); // Updating contentions so that is sorted by time
            contentions.Reverse();                               // Updating contentions so that the most current contentions are shown first

            totalContentions = contentions.Count;
            updateAvg();
        }
コード例 #3
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Http_Request> addOn = await FetchDataService.getData <Http_Request>(oldStamp, newStamp); // Get data

            foreach (Http_Request h in addOn)
            {
                // When there is start event, create a new Client_Http_Request object and add it to httpTracker
                if (h.type.Equals("Start"))
                {
                    Client_Http_Request clientH = new Client_Http_Request(h);
                    httpTracker[h.activityID] = clientH;
                    http.Add(clientH);
                }
                // When there is a stop event, remove associated http request (by looking at id) from httpTracker,
                // update the Client_Http_Request to include stop event and update http list
                else if (h.type.Equals("Stop"))
                {
                    if (httpTracker.ContainsKey(h.activityID))
                    {
                        Client_Http_Request clientH = httpTracker[h.activityID];
                        http.Remove(clientH);
                        clientH.updateEndTimestamp(h.timestamp);
                        http.Add(clientH);
                    }
                }
            }

            http.OrderBy(h => h.StartTimestamp).ToList(); // Updating http so that is sorted by time
            http.Reverse();                               // Updating http so that the most current http requests are shown first

            totalHttpRequest = http.Count;
            updateAvg();
        }
コード例 #4
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <DataTransfer.GC> addOn = await FetchDataService.getData <DataTransfer.GC>(oldStamp, newStamp); // Get data

            foreach (DataTransfer.GC g in addOn)
            {
                gc.Add(g);
            }
        }
コード例 #5
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Jit> addOn = await FetchDataService.getData <Jit>(oldStamp, newStamp); // Get data

            foreach (Jit j in addOn)
            {
                jit.Add(j);
            }
        }
コード例 #6
0
        public DateTime newStamp; // Represents current time

        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime(); // Updating newStamp

            // Getting cpu and mem data based off of dates (oldStamp and newStamp)
            List <CPU_Usage> cpu_addOn = await FetchDataService.getData <CPU_Usage>(oldStamp, newStamp);

            List <Mem_Usage> mem_addOn = await FetchDataService.getData <Mem_Usage>(oldStamp, newStamp);

            double totalCPU = avgCPU * timeAccounted; // Weighting previous avgCPU
            double totalMem = avgMem * timeAccounted; // Weighting previous avgMem

            // Updates CPU_Usage list and totalCPU to calculate new average
            foreach (CPU_Usage c in cpu_addOn)
            {
                totalCPU += c.usage;
                cpu.Add(c);
                String dateString = c.timestamp.ToString("yyyyMMddHHmmssFFF");
                if (dataByTime.ContainsKey(dateString))
                {
                    Tuple <CPU_Usage, Mem_Usage> val = dataByTime[dateString];
                    val = new Tuple <CPU_Usage, Mem_Usage>(c, val.Item2);

                    dataByTime.Remove(dateString);
                    dataByTime.Add(dateString, val);
                }
                else
                {
                    Tuple <CPU_Usage, Mem_Usage> val = new Tuple <CPU_Usage, Mem_Usage>(c, null);
                    dataByTime.Add(dateString, val);
                }
            }

            // Updates Mem_Usage list and totalMem to calculate new average
            foreach (Mem_Usage m in mem_addOn)
            {
                totalMem += m.usage;
                mem.Add(m);
                String dateString = m.timestamp.ToString("yyyyMMddHHmmssFFF");
                if (dataByTime.ContainsKey(dateString))
                {
                    Tuple <CPU_Usage, Mem_Usage> val = dataByTime[dateString];
                    val = new Tuple <CPU_Usage, Mem_Usage>(val.Item1, m);

                    dataByTime.Remove(dateString);
                    dataByTime.Add(dateString, val);
                }
                else
                {
                    Tuple <CPU_Usage, Mem_Usage> val = new Tuple <CPU_Usage, Mem_Usage>(null, m);
                    dataByTime.Add(dateString, val);
                }
            }

            // Calculating new avgMem
            this.timeAccounted += mem_addOn.Count;
            this.avgMem         = totalMem / (double)timeAccounted;
            // Calculating new avgCPUs
            this.timeAccounted += cpu_addOn.Count;
            this.avgCPU         = totalCPU / (double)timeAccounted;

            foreach (KeyValuePair <String, Tuple <CPU_Usage, Mem_Usage> > p in dataByTime)
            {
                string   format = "yyyyMMddHHmmssFFF";
                DateTime d      = DateTime.ParseExact(p.Key, format, CultureInfo.InvariantCulture);
                dataByTimeSorted.Add(new KeyValuePair <DateTime, Tuple <CPU_Usage, Mem_Usage> >(d, p.Value));
            }
            dataByTimeSorted.Sort((pair1, pair2) => pair1.Key.CompareTo(pair2.Key));
        }