Exemplo n.º 1
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Contention> addOn = await FetchDataService.getUpdatedData <Contention>(oldStamp, newStamp);

            foreach (Contention c in addOn)
            {
                if (c.type.Equals("Start"))
                {
                    Client_Contention clientC = new Client_Contention(c);
                    contentionTracker[c.id] = clientC;
                    contentions.Add(clientC);
                }
                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 http so that is sorted by time
            contentions.Reverse();                               // updating http so that the most current http requests are shown first

            totalContentions = contentions.Count;
            updateAvg();
        }
        public DateTime newStamp = DateTime.Now.ToUniversalTime(); // Gets 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.getUpdatedData <CPU_Usage>(oldStamp, newStamp);

            List <Mem_Usage> mem_addOn = await FetchDataService.getUpdatedData <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);
            }

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

            // Updates Mem_Usage list and totalMem to calculate new average
            foreach (Mem_Usage m in mem_addOn)
            {
                totalMem += m.usage;
                mem.Add(m);
            }

            // Calculating new avgMem
            this.timeAccounted += mem_addOn.Count;
            this.avgMem         = totalMem / (double)timeAccounted;
        }
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Exceptions> addOn = await FetchDataService.getUpdatedData <Exceptions>(oldStamp, newStamp);

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

                if (exceptionTracker.ContainsKey(typeOfException))
                {
                    exceptionTracker[typeOfException] = exceptionTracker[typeOfException] + 1;
                }
                else
                {
                    exceptionTracker.Add(typeOfException, 1);
                }
            }

            exceptionSorted = exceptionTracker.ToList();
            exceptionSorted.Sort((pair1, pair2) => pair1.Value.CompareTo(pair2.Value));

            exceptionSorted.Reverse();

            totalExceptions = exceptions.Count;
        }
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Http_Request> addOn = await FetchDataService.getUpdatedData <Http_Request>(oldStamp, newStamp);

            foreach (Http_Request h in addOn)
            {
                if (h.type.Equals("Start"))
                {
                    Client_Http_Request clientH = new Client_Http_Request(h);
                    httpTracker[h.activityID] = clientH;
                    http.Add(clientH);
                }
                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();
        }
Exemplo n.º 5
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Jit> addOn = await FetchDataService.getUpdatedData <Jit>(oldStamp, newStamp);

            foreach (Jit j in addOn)
            {
                jit.Add(j);
            }

            totalJit = jit.Count;
        }
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <DataTransfer.GC> addOn = await FetchDataService.getUpdatedData <DataTransfer.GC>(oldStamp, newStamp);

            foreach (DataTransfer.GC g in addOn)
            {
                gc.Add(g);
            }

            totalGC = gc.Count;
        }
Exemplo n.º 7
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.getUpdatedData <CPU_Usage>(oldStamp, newStamp);

            List <Mem_Usage> mem_addOn = await FetchDataService.getUpdatedData <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));
        }