Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                SQLInterface sql = new SQLInterface(config.db);

                if (!Directory.Exists(config.datadir))
                    Directory.CreateDirectory(config.datadir);

                SortedSet<Job> myJobs = sql.FindJobs(config.datadir, config.username);
                foreach (Job j in myJobs)
                {
                    j.Download(sql);
                    // Global.Say(string.Format("Downloaded {0} batches for job #{1}. Average batch time: {2} sec.", j.BatchCount, j.MetaData.Id, j.AverageBatchTime));
                }

                Jobs jobs = new Jobs(config.datadir); // includes unfinished.

                if (myJobs.Count > 0)
                {
                    uint lastId = 0;
                    foreach (Job j in jobs)
                    {
                        if (j.MetaData.Id >= myJobs.Last().MetaData.Id &&
                            j.MetaData.Reference == 0)
                        {
                            j.MetaData.Reference = lastId;
                            j.MetaData.Save();
                        }
                        lastId = j.MetaData.Id;
                    }

                    Records records = new Records(config.datadir);

                    foreach (Job j in myJobs)
                    {
                        if (j.MetaData.isFinished)
                        {
                            Report r = new Report(j);
                            if (r.IsInteresting)
                                r.SendTo(config.developers);

                            records.Update(j);
                        }
                    }

                    records.Save();
                }

                Aggregate();
            }
            catch (Exception ex)
            {
                Global.Say("Caught exception: " + ex.Message);
            }
        }
Esempio n. 2
0
        public void buildPerformanceChart(string category, Chart chart)
        {
            //Chart chart = new Chart();
            //chart.Style["margin-top"] = "0px";
            //chart.Style["margin-left"] = "20px";
            //chart.Style["margin-bottom"] = "20px";

            // chart.Titles.Add((name == "") ? "Overall" : name);
            ChartArea ca = new ChartArea();
            ca.Name = "Performance";
            double maxdays = config.daysback;

            string rdays = Request.Params.Get("days");
            if (rdays != null) maxdays = Convert.ToUInt32(rdays);

            ca.AxisX.Interval = 30;
            ca.AxisX.Minimum = -maxdays;
            ca.AxisX.Maximum = 0.0;
            ca.AxisX.LabelStyle.Enabled = false;

            // ca.AxisY.TextOrientation = TextOrientation.Rotated270;
            ca.AxisY.Minimum = 0.0;
            ca.AxisY.Maximum = 100.0;
            ca.AxisY.LabelStyle.IsEndLabelVisible = true;
            ca.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None;
            ca.AxisY.LabelAutoFitMinFontSize = 8;
            ca.AxisY.LabelAutoFitMaxFontSize = 8;
            ca.AxisY.CustomLabels.Add(new CustomLabel(-4, 4, "0%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisY.CustomLabels.Add(new CustomLabel(25, 25, "", 0, LabelMarkStyle.None, GridTickTypes.Gridline));
            ca.AxisY.CustomLabels.Add(new CustomLabel(46, 54, "50%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisY.CustomLabels.Add(new CustomLabel(75, 75, "", 0, LabelMarkStyle.None, GridTickTypes.Gridline));
            ca.AxisY.CustomLabels.Add(new CustomLabel(96, 104, "100%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));

            ca.Position.Height = 25;
            ca.Position.Width = 85;
            ca.Position.Auto = false;
            ca.Position.X = 0;
            ca.Position.Y = 75;

            ca.AlignWithChartArea = "Statistics";
            ca.AlignmentOrientation = AreaAlignmentOrientations.Vertical;
            ca.AlignmentStyle = AreaAlignmentStyles.PlotPosition;

            chart.ChartAreas.Add(ca);

            Legend l = new Legend();
            l.Docking = Docking.Right;
            l.IsDockedInsideChartArea = false;
            l.Alignment = StringAlignment.Near;
            l.Name = "PerformanceLegend";
            l.DockedToChartArea = ca.Name;
            chart.Legends.Add(l);

            Jobs jobs = new Jobs(config.datadir, true);
            Records records = new Records(config.datadir);
            CategoryRecord virtualBest = (category == "") ? records.Overall : records.RecordsByCategory[category];
            double virtualBestAvg = (virtualBest.Time / virtualBest.Files);
            DateTime now = DateTime.Now;

            Series ser = new Series("Perf. Index");
            ser.ChartArea = ca.Name;
            ser.Legend = l.Name;
            ser.ChartType = SeriesChartType.Line;
            ser.YAxisType = AxisType.Primary;
            ser.Color = Color.Blue;
            ser.MarkerSize = 2;
            ser.MarkerStyle = MarkerStyle.Circle;

            Series ser2 = new Series("Solved [%]");
            ser2.ChartArea = ca.Name;
            ser2.Legend = l.Name;
            ser2.ChartType = SeriesChartType.Line;
            ser2.YAxisType = AxisType.Primary;
            ser2.Color = Color.PaleGreen;
            ser2.MarkerSize = 2;
            ser2.MarkerStyle = MarkerStyle.Circle;

            Series ser3 = new Series("P. Closeness [%]");
            ser3.ChartArea = ca.Name;
            ser3.Legend = l.Name;
            ser3.ChartType = SeriesChartType.Line;
            ser3.YAxisType = AxisType.Primary;
            ser3.Color = Color.PaleVioletRed;
            ser3.MarkerSize = 2;
            ser3.MarkerStyle = MarkerStyle.Circle;

            Series ser4 = new Series("Exp. Index [%]");
            ser4.ChartArea = ca.Name;
            ser4.Legend = l.Name;
            ser4.ChartType = SeriesChartType.Line;
            ser4.YAxisType = AxisType.Primary;
            ser4.Color = Color.Red;
            ser4.MarkerSize = 2;
            ser4.MarkerStyle = MarkerStyle.Circle;

            bool need_earliest = true;
            double earliest_x = double.MaxValue;
            double earliest_y = 0.0;
            bool need_latest = true;
            double latest_x = double.MinValue;
            double latest_y = 0.0;

            foreach (Job j in jobs)
            {
                if (!j.MetaData.isFinished) continue;

                CategoryStatistics jstats = j.Summary.Overall;

                double vbaGoodPart = virtualBestAvg * jstats.Files;
                double vbaBadPart = (jstats.Files - (jstats.SAT + jstats.UNSAT)) * j.MetaData.Timeout;
                double vbaBoth = (vbaGoodPart + vbaBadPart) / jstats.Files;
                double vwa = j.MetaData.Timeout;

                DateTime pdt = Convert.ToDateTime(j.MetaData.SubmissionTime, Z3Data.Global.culture);
                double x = (now - pdt).TotalDays;
                if (x <= maxdays)
                {
                    double y = 0.0, y2 = 0.0, y3 = 0.0, y4 = 0.0;
                    string tt = "";

                    if (category == "" || j.Summary.ContainsKey(category))
                    {
                        CategoryStatistics cs = (category == "") ? j.Summary.Overall : j.Summary[category];
                        double st = cs.TimeSAT;
                        double ut = cs.TimeUNSAT;
                        double sumf = (cs.SAT + cs.UNSAT);
                        double curAvg = (sumf == 0) ? vwa : (st + ut) / sumf;
                        y2 = 100.0 * sumf / cs.Files;
                        y3 = 100.0 * (1.0 - (vbaBoth / vwa));
                        if (y3 > 100.0) y3 = 100; else if (y3 < 0.0) y3 = 0.0;

                        y = (y2 * y3) / 100.0;
                        tt = pdt.ToString() + ": " + y.ToString();
                        if (y > 100.0) y = 100.0;

                        y4 = (y2 + y3) / 2.0;
                    }
                    else
                    {
                        y = 0.0;
                        y2 = 0.0;
                        y3 = 0.0;
                        y4 = 0.0;
                        tt = pdt.ToString() + ": no data";
                    }

                    ser.Points.AddXY(-x, y);
                    ser.Points.Last().ToolTip = tt;
                    ser2.Points.AddXY(-x, y2);
                    ser.Points.Last().ToolTip = y2.ToString();
                    ser3.Points.AddXY(-x, y3);
                    ser.Points.Last().ToolTip = y3.ToString();
                    ser4.Points.AddXY(-x, y4);
                    ser.Points.Last().ToolTip = y4.ToString();

                    if (x == maxdays)
                        need_earliest = false;
                    else if (x == 0.0)
                        need_latest = false;

                    if (-x < earliest_x)
                    {
                        earliest_x = -x;
                        earliest_y = y;
                    }
                    else if (-x > latest_x)
                    {
                        latest_x = -x;
                        latest_y = y;
                    }

                    j.Dispose();
                    GC.Collect();
                }
            }

            if (need_latest)
            {
                ser.Points.AddXY(0.0, latest_y);
                ser.Points.Last().ToolTip = "Latest: " + latest_y.ToString();
            }

            if (need_earliest)
            {
                ser.Points.InsertXY(0, -maxdays, earliest_y);
                ser.Points.First().ToolTip = "Before: " + earliest_y.ToString();
            }

            chart.Series.Add(ser);
            chart.Series.Add(ser2);
            chart.Series.Add(ser3);
            chart.Series.Add(ser4);
        }
Esempio n. 3
0
        protected void buildPerformanceVectorGraph(string category, Chart chart)
        {
            ChartArea ca = new ChartArea("PerformanceVectors");
            double maxdays = config.daysback;

            string rdays = Request.Params.Get("days");
            if (rdays != null) maxdays = Convert.ToUInt32(rdays);

            ca.AxisX.Minimum = 0.0;
            ca.AxisX.Maximum = 100.0;
            ca.AxisX.LabelStyle.IsEndLabelVisible = true;
            ca.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.None;
            ca.AxisX.LabelAutoFitMinFontSize = 8;
            ca.AxisX.LabelAutoFitMaxFontSize = 8;
            ca.AxisX.CustomLabels.Add(new CustomLabel(0, 8, "0%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisX.CustomLabels.Add(new CustomLabel(25, 25, "", 0, LabelMarkStyle.None, GridTickTypes.Gridline));
            ca.AxisX.CustomLabels.Add(new CustomLabel(46, 54, "50%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisX.CustomLabels.Add(new CustomLabel(75, 75, "", 0, LabelMarkStyle.None, GridTickTypes.Gridline));
            ca.AxisX.CustomLabels.Add(new CustomLabel(92, 100, "100%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisX.Title = "Rel. Success";

            ca.AxisY.Minimum = 0.0;
            ca.AxisY.Maximum = 100.0;
            ca.AxisY.LabelStyle.IsEndLabelVisible = true;
            ca.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None;
            ca.AxisY.LabelAutoFitMinFontSize = 8;
            ca.AxisY.LabelAutoFitMaxFontSize = 8;
            ca.AxisY.CustomLabels.Add(new CustomLabel(0, 8, "0%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisY.CustomLabels.Add(new CustomLabel(25, 25, "", 0, LabelMarkStyle.None, GridTickTypes.Gridline));
            ca.AxisY.CustomLabels.Add(new CustomLabel(46, 54, "50%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisY.CustomLabels.Add(new CustomLabel(75, 75, "", 0, LabelMarkStyle.None, GridTickTypes.Gridline));
            ca.AxisY.CustomLabels.Add(new CustomLabel(92, 100, "100%", 0, LabelMarkStyle.SideMark, GridTickTypes.All));
            ca.AxisY.Title = "Rel. Speed";

            ca.Position.Height = 25;
            ca.Position.Width = 25;
            ca.Position.Auto = false;
            ca.Position.X = 0;
            ca.Position.Y = 75;

            chart.ChartAreas.Add(ca);

            Series series = new Series();
            series.ChartArea = "PerformanceVectors";
            series.ChartArea = ca.Name;
            //series.Legend = l.Name;
            series.ChartType = SeriesChartType.Point;
            series.YAxisType = AxisType.Primary;
            series.Color = Color.Blue;
            series.MarkerSize = 4;
            series.MarkerStyle = MarkerStyle.Circle;

            Records records = new Records(config.datadir);
            CategoryRecord virtualBest = (category == "") ? records.Overall : records.RecordsByCategory[category];
            double virtualBestAvg = (virtualBest.Time / virtualBest.Files);

            DateTime now = DateTime.Now;
            Jobs jobs = new Jobs(config.datadir, true);

            double youngest = double.MaxValue;
            double youngest_x = 0.0;
            double youngest_y = 0.0;

            foreach (Job j in jobs)
            {
                if (!j.MetaData.isFinished) continue;

                DateTime pdt = Convert.ToDateTime(j.MetaData.SubmissionTime, Z3Data.Global.culture);
                double age = (now - pdt).TotalDays;

                if (age > maxdays) continue;

                if (category == "" || j.Summary.ContainsKey(category))
                {
                    CategoryStatistics cs = (category == "") ? j.Summary.Overall : j.Summary[category];

                    uint solved = (cs.SAT + cs.UNSAT);
                    uint unsolved = (cs.Files - (cs.SAT + cs.UNSAT));
                    double avg_time = (cs.TimeSAT + cs.TimeUNSAT) / (double)solved;
                    double top_speed = virtualBestAvg;

                    double x = 100.0 * solved / (double)cs.Files; // % solved.
                    double y = 100.0 * top_speed / avg_time; // rel. speed?

                    int inx = series.Points.AddXY(x, y);
                    series.Points[inx].ToolTip = j.MetaData.SubmissionTime.ToString();

                    int intensity = (int)(255.0 * (age / maxdays));
                    series.Points[inx].MarkerColor = Color.FromArgb(intensity, intensity, 255);

                    if (age < youngest)
                    {
                        youngest_x = x;
                        youngest_y = y;
                    }
                }
            }

            series.Points.AddXY(youngest_x, youngest_y);
            series.Points.Last().MarkerColor = Color.Red;

            chart.Series.Add(series);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            try
            {
                SQLInterface sql = new SQLInterface(config.db);

                if (!Directory.Exists(config.datadir))
                    Directory.CreateDirectory(config.datadir);

                SortedSet<Job> myJobs = sql.FindJobs(config.datadir, config.username);
                foreach (Job j in myJobs)
                {
                    j.Download(sql);
                    // Global.Say(string.Format("Downloaded {0} batches for job #{1}. Average batch time: {2} sec.", j.BatchCount, j.MetaData.Id, j.AverageBatchTime));
                }

                Jobs jobs = new Jobs(config.datadir); // includes unfinished.

                if (myJobs.Count > 0)
                {
                    uint lastId = 0;
                    foreach (Job j in jobs)
                    {
                        if (j.MetaData.Id >= myJobs.Last().MetaData.Id &&
                            j.MetaData.Reference == 0)
                        {
                            j.MetaData.Reference = lastId;
                            j.MetaData.Save();
                        }
                        lastId = j.MetaData.Id;
                    }

                    Records records = new Records(config.datadir);

                    foreach (Job j in myJobs)
                    {
                        if (j.MetaData.isFinished)
                        {
                            Report r = new Report(j);
                            if (r.IsInteresting)
                                r.SendTo(config.developers);

                            records.Update(j);
                        }
                        else
                        {
                            try
                            {
                                string cluster = j.MetaData.Cluster;
                                uint cluster_jid = j.MetaData.ClusterJobId;
                                if (cluster != "" && cluster_jid != 0)
                                {
                                    Scheduler scheduler = new Scheduler();
                                    scheduler.Connect(cluster);
                                    ISchedulerJob job = scheduler.OpenJob(Convert.ToInt32(cluster_jid));
                                    if (job.State == JobState.Canceled &&
                                        job.ErrorMessage.StartsWith("Canceled by the scheduler"))
                                    {
                                        Global.Say("Requeing job #" + j.MetaData.Id + " after the scheduler canceled it (# requeues = " + job.RequeueCount + ").");
                                        try { job.Requeue(); }
                                        catch (Exception ex) { Console.WriteLine("requeue-exception: " + ex.Message); }
                                    }
                                }
                            }
                            catch (SchedulerException) { /* Ignore. */}
                        }
                    }

                    records.Save();
                }

                Aggregate();
            }
            catch (Exception ex)
            {
                Global.Say("Caught exception: " + ex.Message);
            }
        }