private static void ProcessStopDetected(object source, EventArrivedEventArgs e) { ManagementBaseObject process = (ManagementBaseObject)((ManagementBaseObject)e.NewEvent)["TargetInstance"]; //Last three arguements of the new data point call here are filler data. Should be replaced when we actually know how to get the data. ProcessDataPoint pdp = new ProcessDataPoint(process["Name"].ToString(), ProcessDataPoint.PROCESS_TERMINATED, parseCIM(process["CreationDate"].ToString()), process["PeakWorkingSetSize"].ToString()); controller.addDataPoint(container, pdp); }
private static List<Object> GenerateProcessTrainingData() { var rand = new Random(); ProcessDataPoint dataPoint; var dataPoints = new List<Object>(); string[] processNames = { "notepad.exe", "VisualStudio.exe" }; string processName; int type; string ramUsage = ""; DateTime time; /* //generate 25 process names for (int i = 0; i < 25; i++) { processNames[i] = "process" + i; } */ for (int i = 0; i < 10000; i++) { type = rand.Next(4); if (rand.Next(2) == 1) { ramUsage = (rand.Next(50, 200)).ToString(); processName = processNames[0]; } else { ramUsage = (rand.Next(600, 1000)).ToString(); processName = processNames[1]; } time = RandomTimeEightToEleven(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); } for (int i = 0; i < 10000; i++) { type = rand.Next(4); ramUsage = (rand.Next(50, 200)).ToString(); processName = processNames[0]; time = RandomTimeOneToFour(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); } return dataPoints; }
private static List<Object> GenerateProcessAnomalyData() { var rand = new Random(); ProcessDataPoint dataPoint; var dataPoints = new List<Object>(); string[] processNames = { "VisualStudio.exe", "notepad.exe", "virus.txt", "steam.exe" }; string processName; int type; string ramUsage = ""; DateTime time; for (int i = 0; i < 5; i++) { type = rand.Next(4); if (rand.Next(2) == 1) { ramUsage = (rand.Next(50, 200)).ToString(); processName = processNames[0]; } else { ramUsage = (rand.Next(600, 1000)).ToString(); processName = processNames[1]; } time = RandomTimeEightToEleven(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); } for (int i = 0; i < 5; i++) { processName = processNames[rand.Next(4)]; type = rand.Next(4); ramUsage = (rand.Next(50, 200)).ToString(); time = RandomTimeOneToFour(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); } processName = processNames[rand.Next(4)]; type = rand.Next(4); ramUsage = 364.ToString(); time = RandomDateTimeEightToFive(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); processName = processNames[rand.Next(4)]; type = rand.Next(4); ramUsage = 250.ToString(); time = RandomTimeEightToEleven(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); processName = processNames[rand.Next(4)]; type = rand.Next(4); ramUsage = 700.ToString(); time = RandomTimeOneToFour(rand); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); processName = processNames[rand.Next(4)]; type = rand.Next(4); ramUsage = 100.ToString(); time = new DateTime(2016, 4, 29, 12, 00, 00); dataPoint = new ProcessDataPoint(processName, type, time, ramUsage); dataPoints.Add(dataPoint.AsDataObject()); return dataPoints; }